Page 1 of 1

How to skip icetool operations based on RC

PostPosted: Tue Dec 27, 2011 12:51 pm
by Eswarbabu
Hi,

Do we have the facility to use conditional statements in ICETOOL?

(say) IF 'RC of my icetool operation is zero' then
perform a set of icetool operations
else
terminate (do not process the rest of icetool operations)
endif

My concern is, i have to check whether a dataset is empty (used: count operator) and if it is not empty, proceed with the next set of icetool operations, else, terminate the program.

Re: How to skip icetool operations based on RC

PostPosted: Tue Dec 27, 2011 1:45 pm
by BillyBoyo
If the purpose of the COUNT is to determine that the file is empty, why don't you put it in a seperate step and the use the RC to conditionally execute the other commands in the original step without the COUNT?

Re: How to skip icetool operations based on RC

PostPosted: Tue Dec 27, 2011 2:14 pm
by Eswarbabu
@BillyBoyo

Thanks for your response. The screenshot which is provided here has only one count operation But in our code, we have 4 to 5 datasets which are to be validated against the empty check.

My requirement is, can we employ a conditional statement when satisified should perform a couple of Icetool operations.

Re: How to skip icetool operations based on RC

PostPosted: Tue Dec 27, 2011 2:21 pm
by BillyBoyo
How do you want the thing to operate? All files must have data? Put four or five steps. Some files can be empty? Explain the criteria please.

Re: How to skip icetool operations based on RC

PostPosted: Tue Dec 27, 2011 2:32 pm
by Eswarbabu
@BillyBoyo

I get 5 datasets. Yes, 1 or more datasets can be empty. I have to validate each and every dataset before performing a set of icetool operations.

Even i thought about employing five different steps. But, i just want to know, if there is any way to reduce the processing by handling it in the icetool code itself.

Thanks :)

Re: How to skip icetool operations based on RC

PostPosted: Tue Dec 27, 2011 11:33 pm
by skolusu
Eswarbabu,

You need to use the MODE operator to Stop or continue processing operators after a return code of 8 , 12 or 16. Count operator returns a returns code 12 for an empty file. So the subsequent operators will not executed.

try this example. This will bypass the last copy operation as the file is empty

//STEP0100 EXEC PGM=ICETOOL     
//TOOLMSG  DD SYSOUT=*           
//DFSMSG   DD SYSOUT=*           
//IN       DD *                 
//OUT      DD SYSOUT=*           
//TOOLIN   DD *                 
  MODE STOP                     
  COUNT FROM(IN) EMPTY           
  COPY  FROM(IN) TO(OUT)         
//*


Now add a record to input file and re-run the same job and you will notice that the last copy operator gets executed.

//STEP0100 EXEC PGM=ICETOOL         
//TOOLMSG  DD SYSOUT=*               
//DFSMSG   DD SYSOUT=*               
//IN       DD *                     
ABC                                 
//OUT      DD SYSOUT=*               
//TOOLIN   DD *                     
  MODE STOP                         
  COUNT FROM(IN) EMPTY               
  COPY  FROM(IN) TO(OUT)             
//*