MrSpock wrote:Job steps execute, in order, from top to bottom. What happens in one step does not matter to any other step, other than the instance of a JCL error causing the entire job to be flushed. Now, if you use COND= or IF/THEN/ELSE statements to control the flow of the job steps, then yes, it does matter according to the rules as YOU wrote them.
Not necessarily. Consider this -
//S01 EXEC PGM=RETCODE,PARM=0
//S02 EXEC PGM=RETCODE,PARM=0
//S03 EXEC PGM=RETCODE,PARM=4
// IF RC = 0 THEN
//S04 EXEC PGM=RETCODE,PARM=0
//ADD DD DISP=(,PASS),UNIT=SYSDA,SPACE=(TRK,1)
// ELSE
//S04 EXEC PGM=RETCODE,PARM=0
// ENDIF
//S05 EXEC PGM=RETCODE,PARM=0
//ADD DD DISP=(OLD,PASS),DSN=*.S04.ADD
//S06 EXEC PGM=RETCODE,PARM=0
//S07 EXEC PGM=RETCODE,PARM=0
//S08 EXEC PGM=RETCODE,PARM=0
//S09 EXEC PGM=RETCODE,PARM=0
//S10 EXEC PGM=RETCODE,PARM=0
The RETCODE program translates the PARM data to binary and returns with the value as its return code. In other words, it's just a fancy version of the IEFBR14 utility program
There are two versions of step S04. One version executes and creates a dataset. The second version executes but does not create a dataset. Step S05 uses the dataset created by the first version of step S04. This job skips the first version of step S04 because the highest return code for the job was not 0, so the dataset is not created, so step S05 cannot execute, and it causes the job to fail.