GEN, CA GEN, CoolGEN batch job related best practice
If a batch step due to its logic doesn’t write even a single
record to the output file created in the same step, and a subsequent step has a
read from this file. The read fails with an abend.
Best
Practice:
The
abend occurs because the EOF marker is not set if the file is not opened and
closed for output. A dummy step is introduced in between these 2 steps, which
will write the EOF marker if the file is empty. This is achieved as follows:
…
//STEP01 PGM=IKJEFT01
//FILE01 DD DSN=SBBT02.NEW.FILE,DISP=(,CATLG),…
…
//SYSTSIN DD *
EXECDSN
progname db2system
/*
//STEP03 PGM=IKJEFT01
//FILE01 DD DSN=SBBT02.NEW.FILE,DISP=SHR
…
//SYSTSIN DD *
EXECDSN
progname db2system
/*
Instead
add the following step in between the two steps:
…
//STEP01 PGM=IKJEFT01
//FILE01 DD DSN=SBBT02.NEW.FILE,DISP=(,CATLG),…
…
//SYSTSIN DD *
EXECDSN
progname db2system
/*
//STEP02 PGM=IKJEFT01
//SYSPROC DD DSN=SYS2.COOLGEN.CLIST,DISP=SHR
//FILE01 DD DSN=SBBT02.NEW.FILE,DISP=SHR
//SYSTSIN DD *
EMPTYFLE
/*
//STEP03 PGM=IKJEFT01
//FILE01 DD DSN=SBBT02.NEW.FILE,DISP=SHR
…
//SYSTSIN DD *
EXECDSN
progname db2system
/*
The logic in the REXX program would
contain logic like this:
/* Rexx */
“NEWSTACK”
“EXECIO * DISKR FILE01 (FINIS”
Queue “”
“EXECIO * DISKW FILE01 (FINIS”
“DELSTACK”
Exit
No comments:
Post a Comment