Quantcast
Viewing all articles
Browse latest Browse all 8500

DB2 :: RE: JCL to Set Return code based on DB2 SQL query result

Author: Arun Raj
Posted: Tue Mar 14, 2017 8:41 pm (GMT 5.5)

vinu78 wrote:
if the extracted row count is > 1, I would like to set Return code as 0 else for all other cases, need to set RC as 4
Vinu,

Do you really need to issue a separate return-code when exactly 1 row is returned? Just trying to understand if we have 3 scenarios here.
Your original requirement seems to have only 2 conditions - i.e., a: rows > 1 b: rows = 1 or 0

If that is still the case, you could do something like this using ICETOOL to issue an RC=4 when input has 1 or no records, and RC=0 if you have records >1.
Code:
//STEP01   EXEC PGM=ICETOOL                 
//IN       DD DISP=SHR,DSN= (Input data set)
//TOOLMSG  DD SYSOUT=*                       
//DFSMSG   DD SYSOUT=*                       
//TOOLIN   DD *                             
 COUNT FROM(IN) RC4 LOWER(2)         

_________________
Arun
----------------------------------------------------------------------------------------------------
Love is like an hourglass, with the heart filling up as the brain empties. -Jules Renard


Viewing all articles
Browse latest Browse all 8500

Trending Articles