Previous Topic: Using CA Ideal Commands in BatchNext Topic: Output Services


Batch Job Stream in an z/OS Environment

The following is a sample CA Ideal batch job stream in the z/OS environment:

//DEMO1 JOB . . .
//BATCH EXEC IDLBATCH
//IDEAL.EMPRPT DD SYSOUT=A
//IDEAL.SYSIN DD *
SIGNON PERSON userid PASSWORD password
.
.
.
SELECT SYSTEM CTL
EXEC USRPROF
SET OUTPUT COPIES 2
.
.
.
COMPILE PROGRAM DEMO1 VERSION 2
CATALOG DATAVIEW EMPY VERSION 1
RUN DEMO1 VERSION 2
.
.
.
OFF
/*

In this example:

The following job stream uses the IF, ELSE, ENDIF, and SET commands.

//DEMO2 JOB ...
...
SIGNON PERSON xxx PASSWORD
SET RUN $RC KEEP
RUN PGM1 PROD
IF $RETURN‑CODE EQ 0
   RUN PGM2 PROD
ELSE
   RUN ERRPGM PROD
   SET $RETURN‑CODE EQ 8
ENDIF
SEL SYS ABC
IF $RETURN‑CODE EQ 0
   RUN MAINTABC PROD
ELSE
   SET $RETURN‑CODE EQ 0
   SEL SYS XYZ
   RUN MAINTXYZ PROD
ENDIF
SET RUN $RC ZERO
RUN RPT1 PROD
RUN RPT2 PROD
OFF
...

In the above example, the SET RUN $RC KEEP is entered in the job stream before the first batch run. All subsequent programs that are run receive the return code value that was previously set. The value of the return code that was in effect before the RUN is therefore available for testing or changing in the RUN. Whenever you enter SET $RETURN‑CODE EQ 0, the return code is set back to zero. The SET RUN $RC ZERO option sets the return code back to zero at the start of each following RUN, which ensures that the RPT2 program executes regardless of the success or failure of any of the previous RUN commands.

Note: $RC is an abbreviation for $RETURN‑CODE. You can use either name. For more information, see the Programming Reference Guide.