![]() TASK_EXIT |
![]() DEVELOPER |
![]() |
|
|
Purpose |
TASK_EXIT() automatically links to the Task Exit or Task Error function and return error codes. |
Syntax |
TASK_EXIT() TASK_EXIT(Err#) TASK_EXIT(Err#, argument-list) TASK_EXIT(‘U’, message-string) |
Operation |
Err# is the number of the message in the message file. Message-string is any programmer-defined string variable. The presence of a message string is flagged by the character string ‘U’. argument list is an optional list of values to be inserted into a parameterised message. If the second argument is not ‘U’, then the operand is expected to be an argument list. |
Remarks |
Not available under S/390 environments. If an error number is supplied, it is presumed to be an error number with a message defined for the function. The error numbers are incremented by 1000 and the message is stored in @ERR and @ERRTEXT. The assigned ERR# overrides any PROIV system error messages already stored. The function is processed as if FNEXIT was executed, system variables are updated, and the task error function is executed. If the task was already executing the task error function when TASK_EXIT() is executed, the task is considered finished. In component mode, the contents of @ERR are returned to the caller. The caller can distinguish between PROIV errors and application errors by looking at the range of the error number. If the number is greater than 1000, the error is generated by the application. If there are no error numbers, the TASK_EXIT() function is executed and the status ‘SUCCESS’ is returned to the caller. If there is no active task when TASK_EXIT() is executed, it behaves like FNEXIT() except that it does update system variables. |
Example |
Example 1 TASK_EXIT () A status of SUCCESS is returned to the task caller. @ERR is zero, as is @ERRTEXT. Example 2 TASK_EXIT(200) @ERR is set to 200 + 1000 = 1200, and the message text associated with message id 200 is set into @ERRTEXT. Example 3 TASK_EXIT(53, "John Smith") @ERR is set to 53 + 1000 = 1053. Application message id 53 (for example, 'User %1 is already deleted') is retrieved from the message file, and the first parameter (marked by %1) is taken from the first element ("John Smith") in the argument list. The resultant message is 'User John Smith is already deleted' is set into @ERRTEXT. Example 4 TASK_EXIT(‘U’, "Fatal Error") The message 'Fatal Error' appears on the screen. @ERR is set to zero, and @ERRTEXT set to 'Fatal Error'. |
Topic ID: 540182