Saturday, April 12, 2014

How to check whether a file is empty through JCL?



IDCAMS utility can be used to check whether a file is empty or not. “Print” and COUNT (1) will set the return code = 04 if file is empty.


//EMPTYCK     EXEC PGM=IDCAMS
//SYSPRINT      DD SYSOUT=*
//FILE1             DD DSN=TEST.ABA01.EXTRACT.SUB1,DISP=SHR
//SYSUDUMP DD SYSOUT=*
//SYSIN            DD *
PRINT INFILE (FILE1) - DUMP COUNT (1)
IF LASTCC NE 0 THEN SET MAXCC=3
/*

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home