As mentioned, LISTC will test for whether a file exists;  ICETOOL provides a 
method to test if a file is empty.  

>From "Smart DFSORT tricks" 
>(ftp.software.ibm.com/storage/dfsort/mvs/sorttrck.pdf)

For example, in the following ICETOOL job, the EMPTY operand of COUNT is used 
to stop STEP2 from being executed if the IN data set is empty. ICETOOL sets 
RC=8 (because the RC8 operand is specified) if the IN data set is empty, or 
RC=0 if the IN data set is not empty. ICETOOL only reads one record to 
determine if the data set is empty or not empty, regardless of how many records 
there are in the data set.

//STEP1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...
//TOOLIN DD *
* SET RC=8 IF THE 'IN' DATA SET IS EMPTY, OR
* SET RC=0 IF THE 'IN' DATA SET IS NOT EMPTY
COUNT FROM(IN) EMPTY RC8
/*
// IF STEP1.RC = 0 THEN
//*** STEP2 WILL RUN IF 'IN' IS NOT EMPTY
//*** STEP2 WILL NOT RUN IF 'IN' IS EMPTY
//STEP2 EXEC ...
...
// ENDIF


HTH,
Greg Shirey
Ben E. Keith Company 


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf Of 
Hilario G.
Sent: Thursday, July 14, 2011 7:40 AM
To: [email protected]
Subject: How to control in an JCL that a file is empty or not exist ?

Hello folks,

I have several batch processes that contain empty files or files that do not 
exist. 

I need to control the execution of certain programs based on the existence of 
these files (including files created empty).

I try to used IDCAMS but didn't work in my tests. 

Thank you very much everyone. 

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to