Environment and RETURN-CODE
| RETURN-CODE | |
| Special registers | |
| Shell integration |
RETURN-CODE
RETURN-CODE is a special register that holds the exit status. Move a value into it before STOP RUN, and the shell sees it as the program exit code:
MOVE 8 TO RETURN-CODE.
STOP RUN.
Special registers
Other special registers: COMMAND-LINE holds the raw command line, LINE-COUNTER and PAGE-COUNTER track report position, and TALLYING registers count INSPECT operations. They read like variables but live in the run unit.
Shell integration
Test the exit code in a shell script to chain batch jobs. Zero means success, and any other value stops the chain, which is how mainframe job schedulers and Unix makefiles alike decide what runs next.
Next: Logging to files
Article author: Arthur Isaev