JCL and Direct SQL commands
Posted: Tue Oct 30, 2018 3:06 am
Hi, can you check SQL return code in JCL COND statements? I have step JOBX001 that does table updates and the following step JOBX002, to check for return code.
My goal is to check for SQL return code, so that I can execute a ROLLBACK or COMMIT depending on SQL return code, but I'm not getting the result I want. Somebody here knows how to do it?
My goal is to check for SQL return code, so that I can execute a ROLLBACK or COMMIT depending on SQL return code, but I'm not getting the result I want. Somebody here knows how to do it?
//JOBX001 EXEC DB2TTSO
//*
//DB2TTSO2.SYSTSPRT DD SYSOUT=*
//DB2TTSO2.SYSPRINT DD SYSOUT=*
//*
//DB2TTSO2.SYSIN DD DATA,DLM=$$
UPDATE PROD1.CUSTOMER_VWLOG
SET CUSTNBR = '0012354'
WHERE SQE_NBR = 11;
$$
//*
//*--------------------------------------------------------------------
//JOBX002 EXEC PGM=PNOTIFY,
// COND=(0,EQ,JOBX001.DB2TTSO2),
// PARM='1500 *** TABLE UPDATE FAILED ***'
//*--------------------------------------------------------------------
//*
//DB2TTSO2.SYSTSPRT DD SYSOUT=*
//DB2TTSO2.SYSPRINT DD SYSOUT=*
//*
//DB2TTSO2.SYSIN DD DATA,DLM=$$
UPDATE PROD1.CUSTOMER_VWLOG
SET CUSTNBR = '0012354'
WHERE SQE_NBR = 11;
$$
//*
//*--------------------------------------------------------------------
//JOBX002 EXEC PGM=PNOTIFY,
// COND=(0,EQ,JOBX001.DB2TTSO2),
// PARM='1500 *** TABLE UPDATE FAILED ***'
//*--------------------------------------------------------------------