Skip to Content
Custom Search

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) 
/* 

Comments

Post new comment

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

Click the +1 button  below to share it with your friends and colleagues

 

Share this if you liked it!

 

Disclaimer



Who's online

There are currently 0 users and 39 guests online.
Dr. Radut | page