View previous topic :: View next topic
|
Author |
Message |
kabyab
New User
Joined: 31 Aug 2005 Posts: 34 Location: Pune, India
|
|
|
|
I am trying to write a REXX code where I will be able to submit 240 JCLs one after another and I will also capture their return codes (of JCL and not individual STEPS) and write them to a sequential file something like this: I need to capture the MAXCC for each job after the job is over.
JCL0001 SUCCESSFUL RC=0
JCL0002 SUCCESSFUL RC=0
JCL0003 SUCCESSFUL RC=4
JCL0004 SUCCESSFUL RC=0
JCL0005 SUCCESSFUL RC=0
JCL0006 FAILED RC=8
JCL0007 SUCCESSFUL RC=0
JCL0008 FAILED RC=12
.
.
JCL0240 SUCCESSFUL RC=0
I need to do this because in case any Job fails then I can get a statistics of the details and then pick up only the jobs that have failed and re-submit them.
I have checked the code that superk has provide as a reply in one of the forums. But it only writes the STEP completion codes in the SDSF logs but my requirement is to get the MAX CC for each of the jobs in a sequential dataset.
Code provided by superk is as below:
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
|
I tried to modify this code to suit my needs but ended up getting a big grand MAXCC 3659
I searched through some older posts which looked similar to my needs but still didn't find a proper answer to my query. May be I have not referred to the correct posts.
I would appreciate if someone can help in this. I hope I am clear with my query, in case not, please let me know I will clarify.
Thanks |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Did you make just a minor change to the code, i.e.:
Code: |
/* REXX GETRC */
/* GET THE STEP NAME AND RETURN CODE */
...
SAY 'STEP ==>' STEP ' RC ==>' RCSTEP
IF RCSTEP > MAXCC THEN MAXCC = RCSTEP
TEMP_SCT = STORAGE(D2X(C2D(TEMP_SCT)+36),3)
END
SAY 'MAXCC ==>' MAXCC
EXIT
|
|
|
Back to top |
|
|
kabyab
New User
Joined: 31 Aug 2005 Posts: 34 Location: Pune, India
|
|
|
|
Thanks Kevin, that was a great help.
I tried out your changes and now I can get the MAX CC.
Actually I made a few changes trying to get the STEP RC into a sequential dataset, hoping that similarly I could get the MAX CC as well. But it had abended.
I didn't try out the option pointed out by you as I was totally confused with the code above. Could not quite understand how the code was progressing in the first place. I am trying to find out more on System Control Blocks, at least that would clear off some doubts regarding the above code segment. I am looking for any study material that is easy to understand, for someone learning REXX for the first time.
By the way is it possible for us to get the output into a sequential file as given in my example above? Possibly in the same REXX code given above?
Thanks. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
This is different approach...
1. set the job card to NOTIFY=someusr pick a userid that is not logged on or used infrequently. Maybe even set up a dummy userid for this purpose.
2. jobs will run and when they finish, they will send a 1 line message to 'someusr'.
3. Assuming user level broadcast datasets are enabled, all of those messages are saved to 'someusr.BRODCAST.LIST'. (not sure if naming convention is local or not).
4. Just examine the dataset to capture job completion messages. Or you can submit a batch TSO job that issues LISTBC NOTICES command. The LISTBC command should work regardless if user broadcast datasets are used. |
|
Back to top |
|
|
kabyab
New User
Joined: 31 Aug 2005 Posts: 34 Location: Pune, India
|
|
|
|
Thanks Pedro. I have implemented your approach and now I am able to record the job MAXCC in a BRODCAST dataset.
For the time being I have asked one of my colleagues not to use her userid till the jobs are over and we can copy her BRODCAST dataset under my id. But I cannot ask her to do the same thing everytime because we do not have any extra user ids to use. Also I do not have access to create dummy userids
Hence I would still like to explore more on how to use the LISTBC NOTICES command as suggested by you. I am searching out in google but if you could provide me with a code snippet on how to use the command, it would be of great help.
Thanks. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Your colleague can logon but issue PROFILE NOINTERCOM command. Messages sent by jobs finishing are queued in the broadcast dataset instead of displayed on the screen.
LISTBC is like any other TSO command. It is documented in the TSO Command Reference Manual. See the manuals here:
www-03.ibm.com/systems/z/os/zos/bkserv/r10pdf/
Your colleague has to issue the LISTBC command. My system has a 'welcome' message when I first logon. Everyone gets them. Those are NOTICES and are separate from the messages sent to an individual. If you issue LISTBC NONOTICES, you only get job termination messages.
There is nothing special about LISTBC:
Code: |
Address TSO
"LISTBC NONOTICES" |
You can write an exec that uses OUTTRAP that captures the messages. Or you can just submit a batch TSO job that issues LISTBC command. The output will got to SYSTSPRT dd file. |
|
Back to top |
|
|
|