UDM - Creating In-Stream Data with the data Command




Creating In-Stream Data with the data Command

The data command can be used to define in-stream data elements that can be passed as input for other commands, such as the exec command.

Syntax

The syntax for the data command is as follows:

data [NAME|print=NAME] [resolve=all|defined|no] [end=ENDSEQUENCE]
[DATA]
end|ENDSEQUENCE


Creating an In-Stream Data Element

An in-stream data element has four parts:

  1. Name
  2. Optional variable resolution method
  3. In-stream data itself
  4. End-of-data marker or end sequence

The name uniquely identifies the data element and is used to refer to the data element.

The optional variable resolution method tells UDM whether to resolve variables wrapped in the $() sequence when the data element is referred to.

  • If the resolution method is all (default), all variables are resolved and an error is issued if the variable is not defined in UDM.
  • If the resolution method is defined, only references to variables defined in UDM are resolved and all other $() references are left as is in the data element.
  • If the resolution method is no, UDM does not try to resolve any variable references in the data when the data element is used.

The data portion of the data element is the actual data that will be used by the command that is referencing that data element.

Note

The data is used as entered, including any leading spaces or tabs; no trimming is done.

The end-of-data marker or end sequence marks the end of the data. By default, this is simply the word end. It must appear separately, on its own line. However, it is possible that end is valid instream data and you can change the end sequence with the end parameter of the data command.


Example

The following example shows how to use the data command in conjunction with the exec command to look through a series of copied files and display lines with the occurrence of some string under UNIX:

open remote=yourmachine user=someguy pwd=somepwd

data mydata resolve=all
grep "this is my sequence" $(_file)
exit
end

copy local=*.txt

forfiles remote=*.txt
   exec remote cmd=ksh input=mydata
end

close


Printing Data Element Information

Issuing the data command by itself prints a list of the names of all the data elements that have been defined.

Note

Data elements persist beyond individual UDM transfer sessions.

Issuing the data command with the print parameter and the name of a data element will print the data in that element.

Continuing with the previous example, issuing:

data print=mydata


Will produce the following output:

  ----> Begin 'mydata' <----
     grep "this is my sequence" $(_file)
     exit
  ---->  End 'mydata'  <----