Purpose

TASK_EXIT() automatically links to the Task Exit or Task Error function and return error codes.
 

Syntax

TASK_EXIT (Err# {‘U’, <message string>|<argument list>})
 

Operation

Err# is the error message number.  In the case of a screen, it may be displayed on the screen.
message string
 is any defined variable.  It can be the string passed to UMSG in the preceding call.  The presence of a message string is flagged by the character ‘U’. 
argument list
 is an optional list of values to be inserted into parameterized error message.  If the second argument is not ‘U’, then there is no argument list. 

The syntax is either ‘U’ <message string> or  <argument list>.
 

Remarks

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 and the task error function is executed.  If the task is already executing the task error function when TASK_EXIT() id 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().
 

Example

TASK_EXIT (200, {‘U’, “Task not ready"})  -

PROIV adds 1000 to the error message number when it processes the command.  In this example, the number returned by the kernel to the caller is 1200.
 

Comment on this topic

Topic ID: 520127