Executing Universal Return Code within a Script via UCMD Manager for zOS

Executing Universal Return Code within a Script via Universal Command Manager for z/OS

Note

As of Windows 2000, the Universal Return Code command is no longer necessary in Windows batch files. Microsoft added the ability to specify a script return code as an argument to the EXIT command in Windows 2000 and above.

This example illustrates the use of Universal Return Code to exit the script with a specific return code value.

By default, the return code of the last command within the script sets the return code of the script. Universal Return Code is useful when multiple commands are executed within one script.

The following example executes a Windows batch file as a script. The script executes the backup.exe program and saves its return code value in the variable RC. URC is then used to set the ERRORLEVEL value back to the saved RC value before exiting. A user variable called RC is set to the value of the ERRORLEVEL of the previous command.



The first command executes a backup script. The next line sets a variable called RC to the value of the return code of the backup.exe.

The UCOPY command copies the log file to the Universal Command Manager. The next step deletes the log file.

The last line of the script then uses the variable RC as the URC value in order to set the return code of the script equal to the exit code of the backup.exe execution, instead of the return code of the DEL command.

SYSIN Options

The SYSIN options used in this example are:

Option

Description

-host

Host name or IP address of the remote system on which to execute the script.

-script

ddname from which to read the script file. The script file is sent to the remote system by the UCMD Manager for execution.

-userid

Remote user ID with which to execute the command.

-pwd

Password for the user ID.

Components

Universal Command Manager for z/OS

Universal Return Code