As an alternative, you can use ICETOOL, if you have it, to test for an empty 
data set.  

The text below is from IBM's Smart DFSORT Tricks:  

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 Micheal Butz
Sent: Wednesday, March 05, 2014 5:22 PM
To: [email protected]
Subject: IDCAMS if-else

I have 2 files and would lime to see
If one or both or none exist

I am using IDCAMS if-else sequence
With a command of print for this

However I am always coming up with a cc of 0 in the jcl for this step 

E.G.
Let's say filea is empty so is fileb
  Print indataset(filea) count (1)
If lastcc ne 0 then do
    Print indataset(fileb) count (1)
   If lastcc = 0 then set lastcc = 8
  Else
    Set lastcc = 0
End
Else do
 Print indataset(fileb) count(1)
  If lastcc ne 0 then
   Set lastcc = 4
End

I always cone up with a 0 for the IDCAMS job step when it should be in the case 
of 2 empty file 8 Sent from my iPhone

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to