View previous topic :: View next topic
|
Author |
Message |
baldi
New User
Joined: 16 Jun 2005 Posts: 13 Location: Amsterdam
|
|
|
|
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 |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
|
|
Do you need the Return Code of single step or about the end of Job? |
|
Back to top |
|
|
baldi
New User
Joined: 16 Jun 2005 Posts: 13 Location: Amsterdam
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
kcprem
New User
Joined: 30 Jun 2005 Posts: 18
|
|
|
|
Hi SuperK,
Can you please tell me how to add this code with the existing job?
Thanks,
Prem |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Code: |
//LASTSTEP EXEC PGM=IRXJCL,PARM='GETRC'
//SYSEXEC DD DISP=SHR,DSN=YOUR.REXX.PARMLIB
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DUMMY
|
|
|
Back to top |
|
|
kcprem
New User
Joined: 30 Jun 2005 Posts: 18
|
|
|
|
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 |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
|
|
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 |
|
|
kcprem
New User
Joined: 30 Jun 2005 Posts: 18
|
|
|
|
Hi MGIndaco,
Thanks for your reply/help. Now it's working fine.
Regards,
Prem |
|
Back to top |
|
|
subbaraorv
New User
Joined: 09 May 2005 Posts: 2
|
|
|
|
Really a good one ............. |
|
Back to top |
|
|
Unique
New User
Joined: 10 Jul 2007 Posts: 24 Location: Blore
|
|
|
|
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 |
|
|
feellikeneo
New User
Joined: 19 Mar 2007 Posts: 73 Location: Chennai
|
|
|
|
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 |
|
|
hermit_reloaded
New User
Joined: 23 Apr 2007 Posts: 26 Location: India
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
kabyab
New User
Joined: 31 Aug 2005 Posts: 34 Location: Pune, India
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Because the code posted is untested by the poster. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
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 |
|
|
kabyab
New User
Joined: 31 Aug 2005 Posts: 34 Location: Pune, India
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2594 Location: Silicon Valley
|
|
|
|
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 |
|
|
MikeHunter
New User
Joined: 02 Aug 2006 Posts: 2
|
|
|
|
What about:
Code: |
/* REXX GETMAXRC */
/* 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
MAXRC = 0
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
IF RCSTEP > MAXRC THEN MAXRC = RCSTEP
TEMP_SCT = STORAGE(D2X(C2D(TEMP_SCT)+36),3)
END
SAY 'MAXRC ==>' MAXRC
EXIT
RETURN
|
|
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
nice try Mike
The topic has been resurrected after
Code: |
... 3 year(s) - (months difference / 12 )
... 4 year(s) - (difference )
... 42 months
... 1273 days
... 30570 hours
... 1834203 minutes
... 110052180 seconds |
but... the guinnes is still this one
www.ibmmainframes.com/viewtopic.php?t=146&highlight=guinness |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
I wonder, Mike had been here since 2006 and original discussion started mid 2005 and the latest post is in 2012 - something does not match up here...
PS.: Don't read Sherlock Holmes while going to sleep... |
|
Back to top |
|
|
|