Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Can we get the return code of a job in some variable
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
baldi

New User


Joined: 16 Jun 2005
Posts: 13
Location: Amsterdam

PostPosted: Fri Jun 24, 2005 4:26 pm    Post subject: Can we get the return code of a job in some variable
Reply with quote

Can we get the return code of a job in some variable, some how!! Using Cobol or REXX?? Actually I am in process of automating Compilation process for mass jobs, and want to store their respective return codes in some file!!
Any suggestion will be welcome.
Back to top
View user's profile Send private message

MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Fri Jun 24, 2005 9:17 pm    Post subject:
Reply with quote

Do you need the Return Code of single step or about the end of Job?
Back to top
View user's profile Send private message
baldi

New User


Joined: 16 Jun 2005
Posts: 13
Location: Amsterdam

PostPosted: Sat Jun 25, 2005 10:52 am    Post subject: Re: Can we get the return code of a job in some variable
Reply with quote

For whole of the job,, the final RC,that is shown to the NOTIFY=whtever terminal. I want to capture it and store it in some variable for all the jobs and then print a report of them in the end.

POSSIBLE??
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Mon Jun 27, 2005 5:36 pm    Post subject: Re: Can we get the return code of a job in some variable
Reply with quote

I use this exec to log the return-codes for each step of the job. It runs as the very last step:
Code:

/* REXX GETRC                        */                   
/* 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                                                                 

Please note that this code is from public-domain freeware, so I take no credit for the content.
Back to top
View user's profile Send private message
kcprem

New User


Joined: 30 Jun 2005
Posts: 18

PostPosted: Wed Jul 06, 2005 5:27 am    Post subject: Re: Can we get the return code of a job in some variable
Reply with quote

Hi SuperK,

Can you please tell me how to add this code with the existing job?

Thanks,
Prem
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Wed Jul 06, 2005 3:46 pm    Post subject: Re: Can we get the return code of a job in some variable
Reply with quote

Code:

//LASTSTEP EXEC PGM=IRXJCL,PARM='GETRC'
//SYSEXEC  DD   DISP=SHR,DSN=YOUR.REXX.PARMLIB
//SYSTSPRT DD   SYSOUT=*
//SYSTSIN  DD   DUMMY
Back to top
View user's profile Send private message
kcprem

New User


Joined: 30 Jun 2005
Posts: 18

PostPosted: Wed Jul 06, 2005 7:36 pm    Post subject: Re: Can we get the return code of a job in some variable
Reply with quote

Hi SuperK,

After adding laststep in jcl, I am getting the following error. Can you please check and let me know the problem.

JOB09894 +IRX0408E Exec member name must not be specified when exec load DD refers to a sequential data set.
JOB09894 +IRX0110I The REXX exec cannot be interpreted.
JOB09894 +IRX0112I The REXX exec cannot be loaded.
JOB09894 -RCKCHKSP LASTSTEP 20 8 .00 .00 .0 99

Thanks,
Prem
Back to top
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Wed Jul 06, 2005 8:42 pm    Post subject:
Reply with quote

This error happen when you define a sequential dataset in SYSEXEC. You must put the Super(k) code in a member of partitioned with lrecl=80 and in jcl specify only the name of partitioned. The name of the member is indicated in PARM='membername'.
I hope in this help
Back to top
View user's profile Send private message
kcprem

New User


Joined: 30 Jun 2005
Posts: 18

PostPosted: Thu Jul 07, 2005 12:25 am    Post subject: Re: Can we get the return code of a job in some variable
Reply with quote

Hi MGIndaco,

Thanks for your reply/help. Now it's working fine.

Regards,
Prem
Back to top
View user's profile Send private message
subbaraorv

New User


Joined: 09 May 2005
Posts: 2

PostPosted: Thu Jul 14, 2005 1:27 pm    Post subject: Re: Can we get the return code of a job in some variable
Reply with quote

Really a good one .............
Back to top
View user's profile Send private message
Unique

New User


Joined: 10 Jul 2007
Posts: 24
Location: Blore

PostPosted: Thu Jul 19, 2007 10:18 am    Post subject: Re: Can we get the return code of a job in some variable
Reply with quote

The above exec give RC for each step.Anyway to directly get the MAXCC of the job thru the same exec . I apologize if this question sounds silly as i am very new to REXX.
Back to top
View user's profile Send private message
feellikeneo

New User


Joined: 19 Mar 2007
Posts: 73
Location: Chennai

PostPosted: Mon Sep 03, 2007 5:35 pm    Post subject:
Reply with quote

Code:
/* REXX GETRC                        */                                 
/* 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                                                         
ArrIdx = 1                                                             
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                             
  Array1.Idx = RCSTEP                                           
  Idx = Idx + 1                                               
  TEMP_SCT = Storage(D2X(C2D(TEMP_SCT)+36),3)                       
End                                                                 
                                                                   
IdxMax = (Idx - 1)                                           
MaxCode = Array1.1                                               
Do Idx = 2 to ArrIdxMax                                         
   If Array1.Idx > MaxCode Then                               
      do                                                           
        MaxCode = Array1.Idx                                 
      End                                                           
End                                                                 
Say 'Max Return Code is ' MaxCode                               
Exit                                                               
Return


try this one
Back to top
View user's profile Send private message
hermit_reloaded

New User


Joined: 23 Apr 2007
Posts: 26
Location: India

PostPosted: Thu Jan 24, 2008 9:12 am    Post subject: Reply to: Can we get the return code of a job in some variab
Reply with quote

Hi,

Can anybody tell me what is the logic behind above program......
or can direct me to website where i can find more information
(really new to REXX)
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Jan 24, 2008 9:24 am    Post subject:
Reply with quote

Hello,

The "above program" is pretty well commented.

One thing that would make it more difficult for someone who is learning is that the code references some of the system control blocks (an entirely different set of knowledge).

I'd suggest you run the code with TRACE and watch what happens.
Back to top
View user's profile Send private message
kabyab

New User


Joined: 31 Aug 2005
Posts: 34
Location: Pune, India

PostPosted: Tue Aug 26, 2008 4:34 pm    Post subject:
Reply with quote

Has anyone tried with the code provided by feellikeneo ?
I got a Max-RC 3657 while executing with that.

This is what I got in SYSTSPRT LASTSTEP :

Code:

******************** TOP OF DATA ***********************
STEP ==> SEARCH    RC ==> 1                                       
    24 +++  Idx = Idx + 1                                         
IRX0041I Error running GETRC, line 24: Bad arithmetic conversion 
******************* BOTTOM OF DATA ********************


The JCL I am running is:

Code:

//SRCHFORE JOB (SRCH,FO),'SERC',REGION=8M,CLASS=C,
//     MSGCLASS=A,NOTIFY=&SYSUID                   
//SEARCH  EXEC PGM=ISRSUPC,                       
//            PARM=(SRCHCMP,                       
//            'ANYC')                             
//NEWDD  DD DSN=KB8796.BASI.SRC,                 
//          DISP=SHR                               
//OUTDD  DD DSN=KB8796.SRCH.REXX1,             
//          DISP=(NEW,CATLG),UNIT=SYSDA,           
//          SPACE=(0,(50,100),RLSE),               
//          DCB=(BLKSIZE=0)                       
//SYSIN  DD *                                     
SRCHFOR  'B2CCT'                                   
/*                                                 
//LASTSTEP EXEC PGM=IRXJCL,PARM='GETRC'           
//SYSEXEC  DD   DISP=SHR,DSN=KB8796.REXX.SOURCE
//SYSTSPRT DD   SYSOUT=*                           
//SYSTSIN  DD   DUMMY                             


The code what superk has mentioned is working fine.
But I was looking forward to finding out the MAXCC (RC for the Job) and not RC for each step in the JCL.

Thanks
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Aug 26, 2008 4:48 pm    Post subject:
Reply with quote

Because the code posted is untested by the poster.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Aug 26, 2008 5:21 pm    Post subject:
Reply with quote

How can the last step in a job return the max cc for the job since the job hasn't finished yet?
Back to top
View user's profile Send private message
kabyab

New User


Joined: 31 Aug 2005
Posts: 34
Location: Pune, India

PostPosted: Tue Aug 26, 2008 5:29 pm    Post subject:
Reply with quote

After the job is finished is it possible for us to capture the MAXCC through REXX? If it is possible, then how can we do that? any code snippet or any guidance is most welcome.

Thanks
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Aug 26, 2008 5:56 pm    Post subject:
Reply with quote

Craq Giegerich wrote:
How can the last step in a job return the max cc for the job since the job hasn't finished yet?

Because it is the last step in the job it can get the previous RC's

The posted code will give you exactly what you need, but you will need to work on it to fix the errors
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Tue Aug 26, 2008 9:45 pm    Post subject: Reply to: Can we get the return code of a job in some variab
Reply with quote

SuperK's example examines all return codes. You should be able to modify to examine all and also save the highest return code.

That is, you should be able to... feellikeneo tried, but was not able to modify successfully. Idx is not initialized. Looks like feellikeneo got confused between usage of ArrIdx and Idx. Also confused between ArrIdxMax and IdxMax
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts PL/I code tuning/Performance improvement Virendra Shambharkar PL/I & Assembler 4 Mon Dec 05, 2016 11:57 am
No new posts What is the code in CLIST to enable t... jackzhang75 CLIST & REXX 1 Fri Dec 02, 2016 3:02 am
No new posts IDEAL - Code Retrieval yugendran CA Products 0 Fri Nov 25, 2016 3:27 pm
No new posts DFHWS2LS return value divated CICS 4 Mon Nov 07, 2016 5:44 pm
This topic is locked: you cannot edit posts or make replies. Need to code a Rexx PGM sundaram.naveen CLIST & REXX 18 Thu Oct 06, 2016 6:45 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us