Page 1 of 1

To check VSAM File if its empty or not with zero ReturnCODE

PostPosted: Tue Jan 22, 2008 11:38 pm
by Shanti Priya Kolli
Hi all,

I need to code a JCL so that the First step checks a VSAM File . If its empty , the second step is skipped. If its having records then the next step should be executed.
In either case , the first step should return ZERO return code.
Please help me if this is possible.

Thanks
Shanti

Re: To check VSAM File if its empty or not with zero ReturnCODE

PostPosted: Wed Jan 23, 2008 12:25 am
by MrSpock
You can use:

//STEPXXXX EXEC PGM=ICETOOL                         
//TOOLMSG  DD   SYSOUT=*                             
//DFSMSG   DD   SYSOUT=*                             
//IN       DD   DSN=VSAM...
//TOOLIN   DD   DATA                                 
  COUNT FROM(IN) EMPTY                               
/*                                                   


or

//STEPXXXX EXEC PGM=ICETOOL                         
//TOOLMSG  DD   SYSOUT=*                             
//DFSMSG   DD   SYSOUT=*                             
//IN       DD   DSN=VSAM...
//TOOLIN   DD   DATA                                 
  COUNT FROM(IN) NOTEMPTY                               
/*                                                   


or

//STEPXXXX EXEC PGM=IDCAMS
//IN       DD   DSN=VSAM..
//SYSPRINT DD   SYSOUT=*
//SYSIN  DD *
  PRINT INFILE(IN) COUNT(1)
/*


However, I don't get this statement

In either case , the first step should return ZERO return code.


It's either going to have to give an RC=0 if it's empty, and a non-zero RC if it's not, or vice-versa. Both conditions can't result in the same RC.

Re: To check VSAM File if its empty or not with zero ReturnCODE

PostPosted: Wed Jan 23, 2008 2:43 pm
by arunprasad.k
Shanti,

Based on the return code of STEP01 only you can decide whether to run STEP02 or NOT.

You can NOT make a decision with same RC for both the cases.

Could you please clarify on why do you specifically want to have RC=0 for STEP01?

Arun.