User Guide > Objects > Working with Objects > User Return Codes of Executable Objects

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 (Schedule object) and Post Conditions tab (Workflow object) 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 databaseA database is an organized collection of data including relevant data structures. 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 Return Code

Description

USER_100

0100

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

USER_200_300

0200-0300

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

USER_301_401_501

0301,0401,0501

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

 


Setting User Return Codes

Script

User return codes can be specified using the script statement :EXIT. If the option Generate at runtime has been activated in the Attributes tab,  you can react to  user-defined return codes within a workflow.

Reacting to conditions that a generated job can encounter in the target system is possible via the setting and evaluation of user return codes. 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:

System Return Codes of Executable Objects
Script Statement :EXIT