Error handling

If a syntax or run time error is encountered during the execution of the exec and the exec does not trap on it, System REXX will return to the AXREXX invoker with a return code of X'8', reason code X'xxxx0828'. The AXREXX invoker should look at the data set specified on the REXXOUTDSN parameter for any error messages. If the invoker specified CONSDATA, but not REXXOUTDSN, the error messages will be directed to the console specified by the CONSNAME parameter. The message id corresponding to syntax error message IRXnnnnI is inserted into AXRDIAG1 of the REXXDIAG parameter, the line number is inserted into AXRDIAG2, and the message IDs of the last 2 IRX or IKJ messages that were issued are inserted into AXRDIAG3 and AXRDIAG4. When the exec completes successfully and AXREXX returns a code of 0 then AXRDIAG1, AXRDIAG2, AXRDIAG3 and AXRDIAG4 will contain the message ids of the last 4 IRX or IKJ messages issued while the exec was running. The format of these message ids is packed decimal with the sign bits shifted out. A value of 1 in the high order byte distinguishes an IKJ message from an IRX message. The REXXDIAG parameter of the AXREXX macro is mapped by the AXRDIAG in AXRZARL.

System REXX execs should release any obtained resources prior to exiting. In the event the exec is aborted due to a syntax error, time out or CANCEL, the task under which the exec is running will be terminated; thus any task related resources that were obtained by the exec will be freed. In the TSO=YES environment, any data sets that were left allocated by the exec are unallocated. Any other address space or system resources are not freed by System REXX.