UDM Scripting Language Statements


The following table lists all of the statements that can be used in the Universal Data Mover scripting language.
 

Statement

Description

if

Adds conditional branching of UDM commands.
 
An if statement consists of:

  1. Comparison operation.
  2. Series of UDM commands that are carried out if the comparison operation evaluates to true.
  3. *end* statement that indicates the end of the if.

A comparison consists of three parts:

  1. Left\-hand value
  2. Comparator (see if Statement Comparators)
  3. Right\-hand value

The left\-hand and right\-hand values can be either:

  • Variable reference
  • Variable attribute
  • Constant


The syntax is:
 

if comparison
   ...
   UDM commands
   ...
end


If the comparison does not evaluate to true, UDM picks up execution from the line after the end statement.

else

Provides an alternate path, when used as part of an if statement, if the comparison evaluates to false.
 
The syntax is:
 

if expression
...
[else
...]
end

 
In this if statement, the parameter for if is an expression.
 
If the expression evaluates to a value that is not equal to zero, the positive branch is taken; otherwise, the negative else statement branch is taken.

while

Implements a simple while loop.
 
The syntax is:
 

while expression
...
end

 
In this case, the loop iterates (executing the commands between the while and end statements) as long as the expression evaluates to a value that is not zero.
 
If the expression evaluates to a value of zero, code execution picks up at the point immediately following the end of the while loop.

fordata

Iterates through a data element, once for each line.
 
For each iteration, a variable provided by the user is set to hold the contents of the line in the data element corresponding to the current iteration.
 
The syntax is:
 

fordata variable-name=data-element
...
end

forfiles

Iterates through a series of statements for each file found that matches a given file specification.
 
The syntax is:
 

forfiles logical_name=file_spec
         [sortby=attribute-name[,ascending|descending]]
   ...
   UDM commands
   ...
end

subroutine

Names a subroutine and defines the script code that becomes associated with that subroutine name.
 
The syntax is:
 

subroutine name
[script line 1]
...
[script line 2]
endsub

callsub

Carries out the work of lines of script associated with a subroutine.
 
The syntax is:
 

callsub name

For an explanation of how these statements are used, see Universal Data Mover Scripting Language.