Submit job through rexx based on last RC of JCL step



IBM's Command List programming language & Restructured Extended Executor

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

Postby NicC » Thu Apr 25, 2013 7:50 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic

These users thanked the author NicC for the post:
abhirocksf5 (Fri Apr 26, 2013 12:39 am)
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

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

Postby abhirocksf5 » Fri Apr 26, 2013 12:54 am

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.!!!
Thank you !
User avatar
abhirocksf5
 
Posts: 7
Joined: Wed Apr 24, 2013 10:24 pm
Location: India
Has thanked: 3 times
Been thanked: 0 time

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

Postby Akatsukami » Fri Apr 26, 2013 1:05 am

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.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

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

Postby abhirocksf5 » Sat Apr 27, 2013 1:27 am

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.
Thank you !
User avatar
abhirocksf5
 
Posts: 7
Joined: Wed Apr 24, 2013 10:24 pm
Location: India
Has thanked: 3 times
Been thanked: 0 time

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

Postby dick scherrer » Sat Apr 27, 2013 1:33 am

Hello,

You need to post the revised code (as Akatsukami suggested).
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

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

Postby Pedro » Sat Apr 27, 2013 5:01 am

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.
Pedro Vera

These users thanked the author Pedro for the post:
abhirocksf5 (Sun Apr 28, 2013 12:02 am)
User avatar
Pedro
 
Posts: 686
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times

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

Postby enrico-sorichetti » Sat Apr 27, 2013 9:51 am

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.
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3006
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 165 times

Previous

Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post