User Return Codes of Executable Objects

Individually defined return codes can be used in addition to system return codes. The names of the corresponding states are easily selectable (such as USER_100 with the user return code 100).

These user-defined states can be used in Workflow and Schedule objects. They are defined in the Result tab (Defining Schedule Objects) and Post Conditions tab (Conditions, Preconditions, Postconditions) in the form of expected end states. You can also define states in the Dependencies tab (Workflow object) in order to react to return codes of preceding tasks.

Defining User Return Codes

User-defined return codes and their status descriptions are stored in the table UC_ZUTYP. Modify or extend them in this AE database table. The returned code must be below 1000 and have 4 digits with leading zeros. Use alpha-numeric character chains for status descriptions. User return codes can be selected in all clients.

Examples:

  • Task Status/Condition: USER_100

    User return code: 0100

    Drescription: An individual user return code (100) is assigned to the task status USER_100

  • Task Status/Condition: USER_200_300

    User return code: 0200-0300

    Description: A range of user return codes (200-300) is assigned to the task status USER_200_300

  • Task Status/Condition: USER_301_401_501

    User return code: 0301,0401,0501

    Description: A listing of return codes (301, 401 and 501) is assigned to the task status USER_301_401_501

Setting User Return Codes

Script

Use the :EXIT script statement to specify user return codes in your scripts. If the option Generate Task at: Runtime has been activated in the Attributes tab,  you can react to  user-defined return codes within a workflow.

By setting and evaluating user return codes, you can define how to react to conditions that a generated job encounters in the target system. Job messenger calls in the job trailers depend on whether a job ended normally or abnormally. If the job was canceled, the Job Messenger assumes the specified return code.

Windows

You can set a particular return code within a job. With this return code being specified, the job ends abnormally. The following syntax applies:

SET RETCODE=nnn

GOTO RETCODE

Instead of a fixed value, the MSDOS error variable "Errorlevel" can also be used. Of course, this depends on the specifications of the operating system. The following syntax applies:

SET RETCODE=%ERRORLEVEL%

GOTO RETCODE

UNIX

A job in UNIX can be terminated with the statement exit nnn at any time.

BS2000

The BS2000 Job Messenger can retrieve the return code from a job variable or with a file command. The BS2000 trailer contains two labels where processing is made.

The use of job variables requires the assignment of a job variable of the name *RETCODE. The following syntax applies:

/DCLJV #RETCODE,LINK=*RETCODE

/SETJV #RETCODE,'421'

/SKIP .RETJV

If the return code should be retrieved with a file command, a file with the link name RETCODE must be assigned. The string "RETCODE" is searched for in the file name. The user return code has to follow the string. The following syntax applies:

/FILE #RETCODE421,LINK=RETCODE

/SKIP .RETTFT

See also: