Submit job through rexx based on last RC of JCL last step
Hi, I have written some piece of code and trying to submit that JCL multiple times through rexx. I have trapped the RC of each step of JCL somehow,but not able to use that RC in my rexx program. I can see the RC of each step in spool under SYSTPRT.
Can any one please help me out of these.
see the code below.
MAIN PROGRAM
/*Rexx program to ALLOCATE dataset*/
SAY" PROGRAM TO ALLOCATE DATASET AND INCREMENT VERSION"
INPUT1 ='G0100V00'
B = suBSTR(INPUT1,3,3)
SAY'SUBSTR' = B ---------------->100
DO 3 --------------------------------> JOB will run 3 times based on the condition of RC check below
QUEUE"//TCOM099A JOB (189),'ABHI',MSGCLASS = J,MSGLEVEL(1,1),
QUEUE"// PRTY=15,NOTIFY=TCOM099"
QUEUE"//STEP1 EXEC PGM = IEFBR14"
QUEUE"//DD1 DD DSN ="TCOM099.TEST.INPUT1",DISP=(NEW,CATLG,DELETE),"
QUEUE"// SPACE=(TRK,(5,10),RLSE),"
QUEUE"// DCB=(LRECL=80,BLKSIZE=800,RECFM=FB)"
QUEUE"/* */"
QUEUE"//LASTSTEP EXEC PGM=IRXJCL,PARM='STEPRC'" ----------> REXX MEMBER
QUEUE"//SYSEXEC DD DISP=SHR,DSN=TCOM099.REXX.PGMS"-----> REXX LIBRARY
QUEUE"//SYSTSPRT DD SYSOUT=*
QUEUE"//SYSTSIN DD DUMMY"
QUEUE"//"
QUEUE"$$"
"SUBMIT * END($$)"
/*********************************/
/*HERE I NEED THE JCL RETURN CODE*/
/*********************************/
IF RCSTEP = 0 THEN NOP ------- Since RCSTEP is not assigned with any value so by default RCSTEP =' ' and exiting from loop
ELSE LEAVE
END
A = B+1 ------------------------> 101
INPUT1 = G0||A||V00
SAY'NEW INPUT IS' INPUT1 ----------> G0101V00
END
EXIT
REXX program to capture Return code
/* REXX STEPRC */
/* GET THE STEP NAME AND RETURN CODE */
NUMERIC DIGITS(32) /* ENSURE MAX PRECISION */
TCB=STORAGE(D2X(540),4) /* PSATOLD IN PSA */
JSCB =STORAGE(D2X(C2D(TCB)+180),4) /* TCBJSCB IN TCB */
JCT = STORAGE(D2X(C2D(JSCB)+261),3) /* JSCBJCTA IN JSCB */
THIS_STEP_NO = X2D(C2X(STORAGE(D2X(C2D(JSCB)+228),1)))
/* THIS STEP NO. */
FSCT = STORAGE(D2X(C2D(JCT)+48),3) /* JCTSDKAD IN JCT */
/* IS FIRST SCT */
TEMP_SCT = FSCT
DO I = 1 TO (THIS_STEP_NO - 1)
STEP = STORAGE(D2X(C2D(TEMP_SCT)+68),8)
RCSTEP = X2D(C2X(STORAGE(D2X(C2D(TEMP_SCT)+24),2)))
/* SCTSEXEC IN SCT */
BYPASS = STORAGE(D2X(C2D(TEMP_SCT)+188),1)
IF X2D(C2X(BYPASS)) = 80 THEN /* CHECK IF STEP WAS NOT EXECUTED */
DO
RCSTEP = 'FLUSHED '
END
SAY 'STEP ==>' STEP ' RC ==>' RCSTEP
TEMP_SCT = STORAGE(D2X(C2D(TEMP_SCT)+36),3)
END
EXIT
Can any one please let me know how to use RC trapped here to my MAIN program.
Thank you !!!