Submit job through rexx based on last RC of JCL step



IBM's Command List programming language & Restructured Extended Executor

Submit job through rexx based on last RC of JCL step

Postby abhirocksf5 » Wed Apr 24, 2013 11:53 pm

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 !!!
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 MrSpock » Thu Apr 25, 2013 12:09 am

Sure.

Use that code "STEPRC" in the last step of your job. It will retrieve the job and step details from the control blocks of that job. Write the results to a dataset.

Then, modify your first REXX exec to look for that dataset. Once the job has finished and that dataset is cataloged, you can open it, read the contents, and take whatever actions you wish to as a result.
User avatar
MrSpock
Global moderator
 
Posts: 809
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times

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

Postby abhirocksf5 » Thu Apr 25, 2013 12:15 am

ThankS MrSpock!!
WIthout writing to dataset , can't I directly use the RCSTEP value in my MAIN program??
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 enrico-sorichetti » Thu Apr 25, 2013 12:30 am

*********************************/
/*HERE I NEED THE JCL RETURN CODE*/
/*********************************/


unfortunately not always You can have what You want.
the submitted job runs asynchronously from the submitter
and there will be no communication between the two...

what You are trying to do is to write a RYO scheduling system
and You will get little sympathy and very little help in doing it

there is no reason to keep a job hanging around waiting for somebody to finish

the only way to implement such poor requirement is to do everything
in the same job

or better wrap the <real step> inside a rexx wrapper

but You might be better off by telling the initial requirement instead of
asking how to implement a poor solution for whatever the requirement could be

and anyway the a iefbr14 step will always end with a 0 return code

but if You need to allocate the next three generations why not simply use

//DD1 DD DISP=(NEW,...),DSN=GDGBASE(+1),
//...

//DD2 DD DISP=(NEW,...),DSN=GDGBASE(+2),
//...

//DD3 DD DISP=(NEW,...),DSN=GDGBASE(+3),
//...

much simpler, no need to bother the return codes.
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: 3002
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

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

Postby abhirocksf5 » Thu Apr 25, 2013 12:49 am

Thanks for your advise enrico-sorichetti!!
The above program is just a sample snippet of code to understand the requirement.
The actual program for which I am looking for help has many steps including IDCAMS ,IKJEFT01 and SORT steps.
I know its a poor design ,submitting job through REXX holds resources for long time,but then also I want to impliment this since i am using this in development region.

So please share your logic (if any) rather than considering efficiency and poor design.
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 Pedro » Thu Apr 25, 2013 1:41 am

submitting job through REXX holds resources for long time


I do not think submitting the job is a problem. But frequently, you see questions in these forums about a rexx programwaiting for the job to end. It is the waiting that is the problem.
Pedro Vera
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 dick scherrer » Thu Apr 25, 2013 1:42 am

Hello and welcome to the forum,

What is to happen when this is promoted to Production? A well-managed system would not allow what you propose to be used . . .

It Would be done using the scheduling system.

Is there some reason you cannot or will not run this in one long "string"? It could be run inline or each process could submit the next on successful completion.

We do not at all encourage home-grown scheduling as many of us have seen entire systems "hurt" by people attempting to do this. Also, almost every mainframe now has one scheculing package or another.
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 steve-myers » Thu Apr 25, 2013 5:05 am

The BIG problem with your Rexx gyrations is IBM can, and does, alter the contents of the SWA that your Rexx code is using. What do you do then?

What is wrong with something like this -

//ASTEP EXEC PGM=xxx
... DD statements for the STEP ...
//OK EXEC PGM=IEBGENER,COND=(0,NE,ASTEP)
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD -- Data set containing JOB to run when the RC in ASTEP is 0 --
//SYSUT2 DD SYSOUT=(A,INTRDR)
//SYSIN DD DUMMY

This technique, perhaps with a different SYSUT2 DD statement in the IEBGENER step, would work almost as long as there was a HASP or JES2 system available.

As others have pointed out, you do not want to create a RYO ("Roll Your Own") production job scheduling system. Essentially all production sites are using some sort of ISP developed system that has been available almost as long as my sample JCL. Your site is paying the ISP big bucks to maintain and support the system. USE IT.

I spent several unhappy years maintaining a RYO combination security / tape management system. There were a number of good ideas in this system, but there were a lot of bad ideas, too.
  • Data set security was loosely based on the original RACF idea of what are now called discrete profiles, which ultimately failed.
  • Data set security prevented the used of indexed VTOCs, SMS data set management, and the use of DFSMS/HSM type systems. PDSE was not available while I worked on the system, but it would have precluded PDSE, too. I always thought I could support indexed VTOC, but I never got the chance to work on it. An HSM type system would be RYO.
  • There was nothing like OPERATIONS in the security system.
  • The tape management component did not support multiple systems sharing the tape management catalog.
  • Passwords in the security system were a joke.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

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

Postby abhirocksf5 » Thu Apr 25, 2013 6:14 pm

What is to happen when this is promoted to Production?


Thanks Mr dick scherrer !!!!
I have told already that I am not going to use this in production. The tool for which I am writing code is just for internel purpose. Also there are not many jobs,a few jobs only I wanaa submit. We have schedular available but I dont want to use for this. I am not going to use this tool for more than a month,since i need this at my work , thats why trying to code it out.

On my first post , I have given the sample program snippet. It is almost done . I have trapped the step RC in spool from Control blocks with the help of STORAGE() ,only thing required is to recieve the RC step value in MAIN program.

Is there any way to get the RC value directly to MAIN program without writing to dataset and read that file again.
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 » Thu Apr 25, 2013 7:33 pm

Hello,

Yes, you mentioned it was not for prodeuction, but i wish i had $ for every process i've seen that was for "only a short term use" and somehow has been running for years . . .

Also there are not many jobs,a few jobs only I wanaa submit. We have schedular available but I dont want to use for this.
What a developer "wants" is neither a technical nor business justification. Especially when there are alternatives available. There is no issue with submitting the jobs, only the way you are trying to do this having your code holding resources unnecessarily.

Is there any way to get the RC value directly to MAIN program without writing to dataset and read that file again.
Obtain it and place it in a variable?
Hope this helps,
d.sch.

These users thanked the author dick scherrer for the post:
abhirocksf5 (Fri Apr 26, 2013 12:42 am)
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Next

Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post