Check for empty file
Check for empty file
There may be scenarios where you wish to check if a file is empty or not
one example for such situation is you are sending a report to client if there
are transactions processed and if the file is empty then you do not wish to send the
mail.
The following JCL using IDCAMS can be used to check if a file is empty or not
Returns CC of 0 - if file has records
and
Returns CC of 4 if the file is empty.
//STEP001 EXEC PGM=IDCAMS//SYSPRINT DD SYSOUT=*//INPUT DD DSN=FILE.TO.CHECK,// DISP=SHR//SYSIN DD *PRINT INFILE(INPUT) CHARACTER COUNT(1)/*