KB Article #177148

Missing Return Code - RC is not set for CFTUTIL batches and does permit next step automation

Problem

When using CFTUTIL from batch, it appears that when error is reported in QPRINT the RC is not set and does not permit next step automation.

It makes automated warns for a transfer request in error difficult.

Error detail is only available in QPRINT from where a better batches automation can be complicated.

From a user script that do:

CALL PGM(CFTPGM1/CFTUTIL_CD) PARM(&CD &CD_PARMS)

in QPRINT, in case of error, we can see error details while the program output without a RC accordingly.

Resolution

This is a script issue.

It must be adapted to catch the CFTUTIL return code.


Example:

CALL PGM(CFTPGM1/CFTUTIL) PARM(&CD &CD_PARMS) /* call to CFTUTIL */
CALL QUSRJOBI (&INFOJOB &LEN 'JOBI0600' '* ' ' ') /* get job info*/
CHGVAR &RETCOD_CAR %SST(&INFOJOB 109 4)
CHGVAR &RETCOD_DEC %BINARY(&RETCOD_CAR)
CHGVAR &RETCOD_CAR VALUE(&RETCOD_DEC) /*&RETCOD_CAR contains the return code*/
IF COND(&RETCOD_DEC *NE 0) THEN(DO) /*IF CFTUTIL RETURN CODE IS DIFFERENT THAN 0 IT MEANS THERE WERE AN ERROR*/
SNDMSG MSG('ERROR ') TOUSR(USER) /*THIS LINE CAN BE REPLACED BY THE WANTED ACTION IN CASE OF AN ERROR*/
ENDDO