Page 2 of 2

Re: Submit job through rexx based on last RC of JCL step

PostPosted: Thu Apr 25, 2013 7:50 pm
by NicC
Why not just have a step at the end of your job that excutes if the rest of the job is OK. This step would invoke TSO and issue the submit command for the next job.

Re: Submit job through rexx based on last RC of JCL step

PostPosted: Fri Apr 26, 2013 12:54 am
by abhirocksf5
Thanks for your advise Mr Dick.

Obtain it and place it in a variable?

I did the same thing. I have stored the RCSTEP value trapped in STEPRC (rexx exec) and tried to use that variable in MAIN program,but still it is taking 'SPACES' as its value.
I am not able to pass the value of RCSTEP variable to MAIN program.

STEPRC EXEC
/* 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)))
RCODE = RCSTEP ---------------- i stored in variable RCODE
EXIT

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)"
.
.
.
"SUBMIT * END($$)"
/*********************************/
/*HERE I NEED THE JCL RETURN CODE*/
/*********************************/
IF RCODE = 0 THEN NOP ---- RCODE is having value as SPACES since value is not passed and acting as a new variable
ELSE LEAVE
END
A = B+1 ------------------------> 101
INPUT1 = G0||A||V00
SAY'NEW INPUT IS' INPUT1 ----------> G0101V00

Any kind of help is highly appreciated.!!!

Re: Submit job through rexx based on last RC of JCL step

PostPosted: Fri Apr 26, 2013 1:05 am
by Akatsukami
If STEPRC is an external subroutine, change the last line to exit rcstep; if it is internal, initialize rcode to zero before calling STEPRC (and either do not define it using the procedure statement, or expose rcode).

And for Kamisama's sake, put your JCL in a data set or a member of a PDS(E); embedding it in your script is a rookie mistake.

Re: Submit job through rexx based on last RC of JCL step

PostPosted: Sat Apr 27, 2013 1:27 am
by abhirocksf5
If STEPRC is an external subroutine, change the last line to exit rcstep


Thanks Akatsukam!!!!
it did not work..still RCSTEP is taking value as spaces. please refer the first post for full program details.
STEPRC is an externel EXEC called from last step of JCL.

Re: Submit job through rexx based on last RC of JCL step

PostPosted: Sat Apr 27, 2013 1:33 am
by dick scherrer
Hello,

You need to post the revised code (as Akatsukami suggested).

Re: Submit job through rexx based on last RC of JCL step

PostPosted: Sat Apr 27, 2013 5:01 am
by Pedro
You did not show the relationship between STEPRC and MAIN... that is, at what point does STEPRC run?

1. But judging by the reference to JSCB, JCT, SCT... my guess is that STEPRC is executing as a step (not shown) from within the batch job.
and
2. MAIN is submitting the batch job then looking for the job completion code.

You should know that the job submitter and the submitted job run asynchronously. They are in separate address spaces. They do not share program memory. You cannot save a value to a variable in one address space and then refer to the variable from a different address space.

Likekly, MAIN finished before the job even started. But you should not try to wait for the batch job to finish either.

Re: Submit job through rexx based on last RC of JCL step

PostPosted: Sat Apr 27, 2013 9:51 am
by enrico-sorichetti
So please share your logic (if any) rather than considering efficiency and poor design.


the TS does not give a sith about proper practices, just stubbornly wants to implement a flawed solution.
even if already told that the requirement is unreasonable.

there is no relation whatsoever between the so called MAIN and the STEPRC <things>
MAIN submits the JCL
STEPRC executes as part of the JCL some times later

time to lock the topic, it' going to nowhere land.