Uses of return code tests

Certain IBM® programs produce standard return codes. For example, a compiler or linkage editor returns a code of 8 to indicate serious errors in the compiled or link-edited program; the program may not execute correctly. Before executing a newly compiled or link-edited program, test the return code from the compiler or linkage editor; if it is 8, bypass execution of the program.

In user-written programs, assign a return code to signify a certain condition. For example, STEP1 of a job reads accounts that subsequent steps process. STEP1 sets a return code of 10 if delinquent accounts are found. STEP3 processes only delinquent accounts. Before STEP3 executes, test the return code from STEP1:
Code the IF/THEN/ELSE/ENDIF statement construct as follows:
   //RCTEST   IF   (STEP1.RC = 10)   THEN
   //STEP3    EXEC
   //IFNOT    ELSE
   //         ENDIF
   //NEXTSTEP EXEC