Universal Data Mover Script Files


Universal Data Mover Script Files

You can execute UDM commands interactively or in batch, depending on the operating system.

On all platforms other than IBM i, the batch method reads the UDM commands from a script file specified by the SCRIPT_FILE option.

z/OS

SCRIPT_FILE is not specified, the commands are read from the file allocated to the UNVSCR DD statement in the execution JCL.

IBM i

The script file and member can be specified by position as the first two command parameters or by using the SRCFILE and SRCMBR command parameters.


The UDM interactive method also can read UDM commands from a script file.

Syntactically, there is no differences in the command structure between the two methods, with the exception that commands in the batch method script files can contain parameters.

Invoking UDM in Batch Mode with Commands from a Script File

To launch UDM in batch from the Windows or UNIX command line, use the SCRIPT_FILE option to specify the filename of the script.

For example:

udm -script script_filename
 

Scripts also can have parameters, which are specified in the same name=value format of command parameters. To specify options parameters for a script file on the command line, use the SCRIPT_FILE option.

For example:

udm -script copyfiles.udm -options "file=* source=c:\source dest=c:\destination"

In this example, UDM is invoked with a script file name copyfiles.udm. It has three parameters that are passed to the script file:

Parameter

Value

file

*

source

c:\source

dest

c:\destination

When UDM has finished executing the copyfiles.udm, it will terminate.
 

The following example shows the same options for a batch execution in z/OS:

//jobname JOB CLASS=A,MSGCLASS=X
//STEP1 EXEC UDMPRC*
//UNVSCR1 DD * 
udm commands?? 
*/ 
//SYSIN DD * 
-script UNVSCR1 -options "file=* source=c:\source dest=c:\destination"*
*/ 


For IBM i examples, see Universal Data Mover Manager for IBM i.

Invoking UDM Interactively with Commands from a Script File

You also can invoke scripts directly from the UDM prompt in interactive mode (or as part of a script file itself) using the call command. Any parameters to the call command are passed on to the script being called.

The following example illustrates the call command executing the copyfiles.udm script (as identified in the previous example):

UDM
UDM>call copyfiles.udm file=* source=c:\source dest=c:\destination
UDM>
UDM>quit


Unlike executing a script from the command line, UDM will not exit automatically when it finishes processing a script invoked using the call command.

A Stonebranch Tip

If you are passing a large number of parameters to a script, you may want to break up the call command into multiple lines.

You can do this by putting a + at the end of each line break, except for the last line.

However, this method cannot be used for invoking UDM script files with -script and -optons command line options (SCRFILE and OPTIONS command parameters under IBM i).

Invoking Scripts from within Scripts

As mentioned in the previous section, scripts can use the call command to invoke other scripts. Scripts can be nested up to ten levels deep. As each script finishes processing, control is returned to the script that invoked it immediately following the point of invocation.

When nesting scripts, parameters from higher-level invocations are available to scripts invoked at a lower level. If the same parameter name is used in more than one invocation of a series of nested scripts, the value for the instance of the parameter at the lowest level is used.

Parameter Processing

A parameter is referenced inside of a UDM script using the following format:

$(parameter_name)


When a parameter reference is encountered, it is replaced with the value of parameter matching the enclosed name. Continuing with copyfiles.udm script example (used previously on this page), a reference to $(source) would be replaced with c:\source.

An example of how the copyfiles.udm script might look is as follows:

cd src=$(source)
cd dst=$(dest)
copy src=$(file)


In this example:

  • Transfer server with the logical name src would change its directory to c:\source.
  • Transfer server with the logical name dst would change its directory to c:\destination.
  • All files in the c:\source directory then would be copied from the first transfer server over to the second.