Page 1 of 1

How to get the RC of JCL(submitted by REXX) in REXX

PostPosted: Wed Aug 24, 2011 11:38 am
by Y Harikumar
Hi All,

I have a requirement where I need to capture the RC of JCL in REXX.
Could you please someone help me???

I have written a REXX program and in this REXX program I am submitting a JCL using file tailoring process (skeleton).
Now, jcl is getting submitted successfully, but i am unable to find the RC of the submitted JCL in Main REXX program.
My main REXX program should continue only after the submitted JCL completes.

Now, How do I send the RC of JCL to the main REXX program?

Please advise.

Re: How to get the RC of JCL(submitted by REXX) in REXX

PostPosted: Wed Aug 24, 2011 12:28 pm
by dick scherrer
Hello,

My main REXX program should continue only after the submitted JCL completes.
Please advise.
Advise you to come up with a new direction. . .

Well managed systems will not permit this.

What business reason is there for a batch job to "send" an rc back to the process that submitted it?

Re: How to get the RC of JCL(submitted by REXX) in REXX

PostPosted: Wed Aug 24, 2011 1:33 pm
by Y Harikumar
Hi,
We are developing a REXX tool [EOS restoring tool] for the customer.
ok, now,
REXX program will search for a jobname in one of the PS file (with a particular date) and if found, I will submit the JCL using temp JCL using REXX.
Once the temp JCL completes, I should search for the same job name in another PS file ( with another date), then I should submit temp JCL second time.. and so.. on.. until the date is equals to TODATE ( which is capturing as input).

Hope I have given useful info to your query.

please help.
thank you....

Re: How to get the RC of JCL(submitted by REXX) in REXX

PostPosted: Wed Aug 24, 2011 2:55 pm
by NicC
Clear as mud...it almost sounds as though you want the rexx program to have the return code of the step that is executing the code. However, the step return code is not issued until the rexx program finishes and the step finishes

Re: How to get the RC of JCL(submitted by REXX) in REXX

PostPosted: Wed Aug 24, 2011 3:26 pm
by MrSpock
I'd suggest that you capture the step return-code(s) from within the job itself, write that to a common log file, then use that.

Otherwise you will. of course, have to write an interface into your JES output and retrieve those details from there.

Re: How to get the RC of JCL(submitted by REXX) in REXX

PostPosted: Wed Aug 24, 2011 6:27 pm
by mongan
The way I understand it is you will submit a job, so submit the job with conditional JCL to react to your return codes from the job. Then when the job completes successfully you invoke your rexx again (in batch). I do not know how else you plan on doing it, a rexx should not wait for a job to finish because you will be waisting resources.

Re: How to get the RC of JCL(submitted by REXX) in REXX

PostPosted: Thu Aug 25, 2011 11:44 am
by Y Harikumar
thank you.

Re: How to get the RC of JCL(submitted by REXX) in REXX

PostPosted: Sun Aug 28, 2011 2:17 pm
by expat
A restore job ................................ Maybe you should review the current strategy of backup / recovery which is (hopefullY already in place. rather than faffing about with REXX after REXX after REXX

Re: How to get the RC of JCL(submitted by REXX) in REXX

PostPosted: Mon Nov 07, 2011 11:38 am
by JPVRoff
We use similar examples of this code to get the return codes of all the steps in a submitted job and pick the baddest one. We use similar things written in COBOL. This is the code for the procedure to obtain the return code only (returns '1' if bad, '0' if good, OKRC is the highest permitted return code). We've used these to write simple job schedulers. Possibly it was this that the OP was lokking for?
GetHighStep:cvt=storage(10,4);ascb=storage(224,4)                     
ascb_jbni=c2x(storage(d2x(c2d(ascb)+172),4))                           
ascb_jbns=c2x(storage(d2x(c2d(ascb)+176),4))                           
assb=storage(d2x(c2d(ascb)+336),4);asxb=Storage(D2x(c2d(ascb)+108),4) 
acee=Storage(D2x(c2d(asxb)+200),4);jsab=storage(d2x(c2d(assb)+168),4) 
asid=storage(d2x(c2d(ascb)+36),2);psatold=storage(21C,4)               
jscb=storage(d2x(c2d(psatold)+180),4);jct=storage(d2x(c2d(jscb)+260),4)
sct=storage(d2x(c2d(jct)+48),3);pnt=0                                 
do forever;if sct=0 then exit 12;pnt=pnt+1                     
  sctansct=storage(d2x(c2d(sct)+36),3)                                 
  sctsname.pnt=storage(d2x(c2d(sct)+68),8)                             
  sctpgmnm.pnt=storage(d2x(c2d(sct)+124),8)                             
  sctabcnd.pnt=x2b(c2x(storage(d2x(c2d(sct)+176),1)))                   
  sctstend.pnt=x2b(c2x(storage(d2x(c2d(sct)+188),1)))                   
  if \substr(sctstend.pnt,1,1)then sctsexec.pnt=0                       
  else sctsexec.pnt=c2d(storage(d2x(c2d(sct)+24),2));sct=sctansct       
  if substr(sctstend.pnt,1,1)&\substr(sctstend.pnt,2,1) then leave;end 
OKRC=8;highRC=0;abend=0;step=                   
do while pnt>1;pnt=pnt-1;if substr(sctabcnd.pnt,6,1) then do           
    abend=1;step=strip(sctsname.pnt);end                           
    if sctsexec.pnt>highRC&\abend then do;highRC=sctsexec.pnt             
    step=strip(sctsname.pnt);end;end;
if abend then return="ABEND";else return=HighRC                       
sysid=storage(d2x(c2d(cvt)+340),4);jobid=storage(d2x(c2d(jsab)+20),8) 
user=Storage(d2x(c2d(acee)+21),7)                                     
if ascb_jbns=0 then jobname=storage(ascb_jbni,8)                       
else jobname=storage(ascb_jbns,8)                                     
if jobname='INIT' then jobname=storage(d2x(c2d(jsab)+28),8)           
say 'JOB:'jobname 'USER:'user 'JOBID:'jobid 'Step:'step 'HighRC:'return
if abend|highRC>OKRC then return 1;else return 0


The JCL gets invoked using this JCL:
//MESSAGE  EXEC PGM=IKJEFT01,DYNAMNBR=1635,COND=EVEN,
// PARM='ISPSTART CMD(%????????)'                   
//STEPLIB  DD   DSN=...............,DISP=SHR         
//SYSEXEC  DD   DSN=............,DISP=SHR           
//SYSTSPRT DD   SYSOUT=*                             
//SYSTSIN  DD   DUMMY