IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Checking the SPOOL for no of jobs using REXX


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
chinna

New User


Joined: 04 Oct 2005
Posts: 5
Location: Hyderabad

PostPosted: Thu Mar 02, 2006 12:19 am
Reply with quote

Hi Group,....

I have requirement to check the SPOOl of all the team members to see how many jobs are present in their spool. For any member, if the no.of jobs exceed by a given number (say30), I need to send a email to that particular team member asking to delete unnecessary jobs in order to save space.

Now I am planning to automate the above process using REXX. I know how to send emails using rexx. But I was wondering how can I check the SPOOL of other members using REXX. All the jobs of a particular team member starts with his mainframe id. I am wondering if the SPOOL info is stored in any PS, so that I can get the info from it. If yes, plz tell me the name of that PS.

If any of you have any different approach for my requirement, please let me know, I would be greately thankful!!!

Regards,
Praveen.
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Thu Mar 02, 2006 12:53 am
Reply with quote

Hi -

What you need is SDSF in batch from within REXX. Please search this forum (and the "neighbour" forum) for examples I had posted in the past.

O.
Back to top
View user's profile Send private message
amitava
Warnings : 1

Active User


Joined: 30 Oct 2005
Posts: 186
Location: India

PostPosted: Thu Mar 02, 2006 9:12 am
Reply with quote

Hi Chinna,
I am sending u a sample code for monitoring the spool for a job - ISDXI42M.

Code:

/* rexx */
address tso
"alloc f(isfin) tracks space(1) reu"            /* used by sdsf     */
"alloc f(isfout) new delete reu " ,             /* used by sdsf     */
"tracks space(100,100) lrecl(133) recfm(f,b,a) dsorg(ps)"
"alloc f(tempprt) da('<DSN>') shr"

jobid = 'isdxi42m'

queue "pre isdxi42*"                       /* sdsf commands in batch*/
queue "st"
/*queue "filter jobid eq "jobid*/
queue "find " jobid
queue "++?"                                /* open output of job    */
queue "find NDMCMDS"
queue "++s"                                /* browse msgusr dataset */
queue "print file tempprt "                /* print to temp dataset */
queue "print 1 999999"
queue "print close"
queue "end"
queue "exit"
"execio" queued()" diskw isfin (finis"     /* input to sdsf batch   */

address ispexec "select pgm(isfafd) parm('++25,80')"/* invoke sdsf */
exit
Back to top
View user's profile Send private message
Sathishk

New User


Joined: 16 Feb 2006
Posts: 8

PostPosted: Mon Mar 06, 2006 7:04 pm
Reply with quote

Hi Amit,

How can i know the return code of the job in rexx itself?

i.e

My requirement is I am submitting a job from rexx & based on its completion code (RC) I have to display a output file name created in that job. How this can be achieved?


Thanks

Sathish
Back to top
View user's profile Send private message
amitava
Warnings : 1

Active User


Joined: 30 Oct 2005
Posts: 186
Location: India

PostPosted: Tue Mar 07, 2006 9:47 am
Reply with quote

Hey Sathisk,
Whatever the code I have already sent in this post will do that thing.
However I am sending you the code for checking the return code. Ok! Just run the following REXX routine and then add the logic in your REXX routine to read the DS - AAAA.BBBB.CCCC(Here) and find out the return code.
Code:

/* rexx */
address tso
"alloc f(isfin) tracks space(1) reu"            /* used by sdsf     */
"alloc f(isfout) new delete reu " ,             /* used by sdsf     */
"tracks space(100,100) lrecl(133) recfm(f,b,a) dsorg(ps)"
"alloc f(tempprt) da('[i]AAAA.BBBB.CCCC[/i]') shr"

jobid = 'isdxi42m'

queue "pre isdxi42*"                       /* sdsf commands in batch*/
queue "st"
/*queue "filter jobid eq "jobid*/
queue "print file tempprt "                /* print to temp dataset */
queue "print 1 999999"
queue "print close"
queue "end"
queue "exit"
"execio" queued()" diskw isfin (finis"     /* input to sdsf batch   */

address ispexec "select pgm(isfafd) parm('++25,80')"/* invoke sdsf */
exit


Now add the logic what I have mentioned earlier.
Back to top
View user's profile Send private message
martin9

Active User


Joined: 01 Mar 2006
Posts: 290
Location: Basel, Switzerland

PostPosted: Thu Mar 09, 2006 8:56 pm
Reply with quote

hy sathisk,
the above example is a very good one...
just change the filter command to filter
the OWNER parameter, because the job's name
can be of different name...

martin9

note: you can use any sdsf command, as you are used to do
yourself in online. sdsf batch is a simulated onlien session...
Back to top
View user's profile Send private message
tarunsharma1981

New User


Joined: 18 Jul 2006
Posts: 1

PostPosted: Fri Dec 08, 2006 8:57 pm
Reply with quote

Hi Everybody,

i also have a similar requirement in CMS, i want a way to check the return codes of steps in a job using REXX. Its more like running a rexx code to know whether a job ran fine or had any unacceptable returncode on a step.

Any help will be highly appreciated.
Back to top
View user's profile Send private message
Huzefa

New User


Joined: 05 Dec 2006
Posts: 83
Location: Bangalore

PostPosted: Thu Feb 08, 2007 7:14 pm
Reply with quote

Hi all
I just don't want to save the spool output in the file, but insead put it in a stem.

How can I do that
Back to top
View user's profile Send private message
Steve Coalbran

New User


Joined: 01 Feb 2007
Posts: 89
Location: Stockholm, Sweden

PostPosted: Mon Feb 12, 2007 1:05 am
Reply with quote

Sounds like EXECIO might be what you're looking for ?!
Code:

"EXECIO * DISKR" filename "(STEM" yourstem" FINIS"

(and tarunsharma1981 EXECIO comes from CMS ?!)
Back to top
View user's profile Send private message
Steve Coalbran

New User


Joined: 01 Feb 2007
Posts: 89
Location: Stockholm, Sweden

PostPosted: Mon Feb 12, 2007 1:19 am
Reply with quote

of course I suspect SDSF doesn't run under CMS? (Les K?! are you on this forum - what does this function in VM/CMS ?)
Back to top
View user's profile Send private message
Huzefa

New User


Joined: 05 Dec 2006
Posts: 83
Location: Bangalore

PostPosted: Mon Apr 30, 2007 5:09 pm
Reply with quote

Hi All
I tried with the below code to get the spool details for a particular jobname or jobid but None of the output got listed. Could anyone tell me why

/* REXX */
ADDRESS TSO
"ALLOC F(ISFIN) TRACKS SPACE(1) REU" /* USED BY SDSF */
"ALLOC F(ISFOUT) NEW DELETE REU " , /* USED BY SDSF */
"TRACKS SPACE(100,100) LRECL(133) RECFM(F,B,A) DSORG(PS)"
"ALLOC F(TEMPPRT) DA('NBDY8ZO.TEMP.JOB2') SHR"
JOBID = "JOB04056"
QUEUE "PRE NBDLBWU*" /* SDSF COMMANDS IN BATCH*/
QUEUE "ST"
QUEUE "FILTER JOBNAME " JOBID
QUEUE "PRINT FILE TEMPPRT" /* PRINT TO TEMP DATASET */
QUEUE "PRINT 1 999999"
QUEUE "PRINT CLOSE"
QUEUE "END"
QUEUE "EXIT"
"EXECIO" QUEUED()" DISKW ISFIN (FINIS" /* INPUT TO SDSF BATCH */
ADDRESS ISPEXEC "SELECT PGM(ISFAFD) PARM('++25,80')"/* INVOKE SDSF */
EXIT
Back to top
View user's profile Send private message
thilakvs
Warnings : 1

New User


Joined: 07 Aug 2007
Posts: 27
Location: chennai

PostPosted: Wed Mar 12, 2008 4:09 pm
Reply with quote

by using this can i get CPU time from spool
Back to top
View user's profile Send private message
kavya123
Warnings : 1

New User


Joined: 11 Jul 2007
Posts: 34
Location: hyderabad

PostPosted: Thu Mar 13, 2008 10:41 am
Reply with quote

Thilakvs,

By using the above code i am not able to get CPU time...

Could you please help.
I am getting the tempory dataset as an empty file.
Back to top
View user's profile Send private message
thilakvs
Warnings : 1

New User


Joined: 07 Aug 2007
Posts: 27
Location: chennai

PostPosted: Thu Mar 13, 2008 11:57 am
Reply with quote

Kavya,

I m also trying the same requirement..if i got the results i let u know..mean while if u got the result..let me know icon_wink.gif
Back to top
View user's profile Send private message
kavya123
Warnings : 1

New User


Joined: 11 Jul 2007
Posts: 34
Location: hyderabad

PostPosted: Thu Mar 13, 2008 4:34 pm
Reply with quote

Thilakvs,

For the below code pass JOBNAME JOBID as arguments.
also replace 'U153134.TEMP' with your own flat file(PS).
I have used this in two places in my code.

The 1st one is rexx exec and the next code is macro.
copy both of them in to different members and try.


Code:
ADDRESS TSO                                                     
ARG JOBNAME JOBID                                               
"ALLOC F(ISFIN) TRACKS SPACE(1) REU" /* USED BY SDSF */         
"ALLOC F(ISFOUT) NEW DELETE REU " , /* USED BY SDSF */         
"TRACKS SPACE(100,100) LRECL(133) RECFM(F,B,A) DSORG(PS)"       
"ALLOC F(TEMPPRT) DA('U153134.TEMP') SHR"
QUEUE "SET CONFIRM OFF"                                         
QUEUE "OWNER *"                                                 
QUEUE "PREFIX *"                                               
QUEUE "ST"                                                     
QUEUE "SELECT "JOBNAME JOBID                                   
QUEUE "AFD REFRESH"                                             
QUEUE "FIND "JOBNAME                                           
QUEUE "++?"                                                     
QUEUE "FIND JESYSMSG"                                           
QUEUE "++S"                                                     
QUEUE "PRINT FILE TEMPPRT"                                     
QUEUE "PRINT"                                                         
QUEUE "PRINT CLOSE"                                                   
QUEUE "END"                                                           
QUEUE " "                                                             
"EXECIO" QUEUED()" DISKW ISFIN (FINIS" /* INPUT TO SDSF BATCH */       
ADDRESS ISPEXEC "SELECT PGM(ISFAFD) PARM('++25,80')"/* INVOKE SDSF */ 
ADDRESS TSO "FREE F(ISFIN,ISFOUT,TEMPPRT)"                             
ADDRESS ISPEXEC "EDIT DATASET('U153134.TEMP') MACRO(MCTIME)"           
EXIT                                         



Macro:
to display CPU time.

Code:
ADDRESS ISREDIT             
"ISREDIT MACRO"             
"(D) = DATASET"             
"CURSOR = 1 1"             
"FIND IEF376I WORD LAST"   
"(R,C) = CURSOR"           
/*SAY R C*/                 
"(STR) = LINE .ZCSR"       
/*SAY STR*/                 
P1 = POS('CPU',STR)         
/*SAY 'P1=' P1*/           
STR = SUBSTR(STR,P1,20)     
SAY STR                     
"END"
Back to top
View user's profile Send private message
thilakvs
Warnings : 1

New User


Joined: 07 Aug 2007
Posts: 27
Location: chennai

PostPosted: Fri Mar 14, 2008 12:33 pm
Reply with quote

Kavya,

Thanks a lot..but i m getting MCTIME NOT FOUND error.. icon_redface.gif

how can i clear it..
Back to top
View user's profile Send private message
kavya123
Warnings : 1

New User


Joined: 11 Jul 2007
Posts: 34
Location: hyderabad

PostPosted: Fri Mar 14, 2008 12:44 pm
Reply with quote

Hi Thilakvs

I used IEF376I word in the macro which will be the last statement in JESYSMSG and it will give the CPU time as follows.

Code:
IEF376I  JOB/MAPCOMP$/STOP  2008071.1837 CPU    0MIN 00.53SEC SRB    0MIN 00.00SEC


Check your JESYSMSG for IEF376I in the spool and then try it again.


Kavya
Back to top
View user's profile Send private message
kavya123
Warnings : 1

New User


Joined: 11 Jul 2007
Posts: 34
Location: hyderabad

PostPosted: Fri Mar 14, 2008 12:49 pm
Reply with quote

Hi Thilakvs,

Sorry for the confusion made by me...

MCTIME is the Macro(name which i have passed in the rexx exec to call macro)
So you please copy it in a member and save it as MCTIME.

The macro code was already provided to you.
Back to top
View user's profile Send private message
kavya123
Warnings : 1

New User


Joined: 11 Jul 2007
Posts: 34
Location: hyderabad

PostPosted: Thu Mar 20, 2008 10:08 am
Reply with quote

Hi Thilakvs,
You can also use this code to find the CPU time
but as i already said 'U153134.TEMP' should be replaced by your own flat file.
It will be created at the begining and deleted automatically at the end.


Code:
ADDRESS TSO                                                 
ARG JOBNAME JOBID                                           
"ALLOC F(ISFIN) TRACKS SPACE(1) REU" /* USED BY SDSF */     
"ALLOC F(ISFOUT) NEW DELETE REU " , /* USED BY SDSF */     
"TRACKS SPACE(100,100) LRECL(133) RECFM(F,B,A) DSORG(PS)"
"ALLOC DSN('U153134.TEMP') NEW SPACE(10 5) CYLINDERS   
   BLKSIZE(800) LRECL(80) RECFM(F B)"                     
"ALLOC F(TEMPPRT) DA('U153134.TEMP') SHR"                   
QUEUE "SET CONFIRM OFF"                                     
QUEUE "OWNER *"                                             
QUEUE "PREFIX *"                                           
QUEUE "ST"                                                 
QUEUE "SELECT "JOBNAME JOBID                               
QUEUE "AFD REFRESH"                                         
QUEUE "FIND "JOBNAME                                       
QUEUE "++?"                                                 
QUEUE "FIND JESYSMSG"                                       
QUEUE "++S"                                                 
QUEUE "PRINT FILE TEMPPRT"                                 
QUEUE "PRINT"                                               
QUEUE "PRINT CLOSE"
QUEUE "END"                                                           
QUEUE " "                                                             
"EXECIO" QUEUED()" DISKW ISFIN (FINIS" /* INPUT TO SDSF BATCH */     
ADDRESS ISPEXEC "SELECT PGM(ISFAFD) PARM('++25,80')"/* INVOKE SDSF */
ADDRESS TSO "FREE F(ISFIN,ISFOUT,TEMPPRT)"                           
"ALLOC F(INPDD) DA('U153134.TEMP') SHR"                               
X=OUTTRAP("SUB.")                                                     
"EXECIO * DISKR INPDD (STEM SUB. FINIS"                               
X=OUTTRAP("OFF")                                                     
P=SUB.0                                                               
P1 = POS('CPU',SUB.P)                                                 
IF P1 = 0 THEN SAY 'UNABLE TO FIND CPU TIME IN JESYSMSG IN SPOOL'     
ELSE DO                                                               
STR = SUBSTR(SUB.P,P1,20)                                             
SAY STR                                                               
END                                                                   
"FREE DD(INPDD)" 
"DELETE "U153134.TEMP""                                                   
EXIT           
Back to top
View user's profile Send private message
Ajay Baghel

Active User


Joined: 25 Apr 2007
Posts: 206
Location: Bangalore

PostPosted: Mon Apr 07, 2008 6:46 pm
Reply with quote

Hi,

When i execute the below rexx code, i am getting the error:

IKJ56701I Missing dataset name
IKJ56701I Missing name of dataset to be allocated.
IRX0555E The input or output file ISFIN is not allocated. It can not be opened for I/O.
IRX067OE EXECIO error while trying to GET or PUT a record.

Code:

/********************** rexx ****************************/
ARG JOBNAME JOBID
ADDRESS TSO                                                     
"ALLOC F(ISFIN) TRACKS SPACE(1) REU" /* USED BY SDSF */         
"ALLOC F(ISFOUT) NEW DELETE REU " , /* USED BY SDSF */         
"TRACKS SPACE(100,100) LRECL(133) RECFM(F,B,A) DSORG(PS)"       
"ALLOC F(TEMPPRT) DA('U153134.TEMP') SHR"
QUEUE "SET CONFIRM OFF"                                         
QUEUE "OWNER *"                                                 
QUEUE "PREFIX *"                                               
QUEUE "ST"                                                     
QUEUE "SELECT "JOBNAME JOBID                                   
QUEUE "AFD REFRESH"                                             
QUEUE "FIND "JOBNAME                                           
QUEUE "++?"                                                     
QUEUE "FIND JESYSMSG"                                           
QUEUE "++S"                                                     
QUEUE "PRINT FILE TEMPPRT"                                     
QUEUE "PRINT"                                                         
QUEUE "PRINT CLOSE"                                                   
QUEUE "END"                                                           
QUEUE " "                                                             
"EXECIO" QUEUED()" DISKW ISFIN (FINIS" /* INPUT TO SDSF BATCH */       
ADDRESS ISPEXEC "SELECT PGM(ISFAFD) PARM('++25,80')"/* INVOKE SDSF */ 
ADDRESS TSO "FREE F(ISFIN,ISFOUT,TEMPPRT)"                             
EXIT 


So, I changed the code to replace:
"ALLOC F(ISFIN) TRACKS SPACE(1) REU" /* USED BY SDSF */
by
"ALLOC F(ISFIN) NEW DELETE REU " , /* USED BY SDSF */
"TRACKS SPACE(2) LRECL(133) RECFM(F,B,A) DSORG(PS)"

I don't know the DCB parameters for ISFIN dataset, but i assumed that
they will be same as ISFOUT's. But, now i am getting the below errors:

IEC020I 001-4,9AB,AAPQ,ISFIN,,VIO
IEC020I SYS08098.T074634.RA000.9AB.R0187344
IEC020I DCB=EROPT=ABE or an invalid code AND/OR no synad exit specified.

ISF012I SDSF abend system 001 at 00da5b4e in module ISFIO Offset Unknown

Is it a system error (with respect to address of error handling routing not being resolved) ? How can the error be resolved ?


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

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon Apr 07, 2008 7:16 pm
Reply with quote

Take a look at http://www.ibmmainframes.com/viewtopic.php?t=20505

For CPU time I would suggest SMF records, which your performance and capacity people should already have the details that you might need.
Back to top
View user's profile Send private message
Ajay Baghel

Active User


Joined: 25 Apr 2007
Posts: 206
Location: Bangalore

PostPosted: Mon Apr 07, 2008 10:20 pm
Reply with quote

Sorry for putting you all in confusion:

I had by mistake added SHR to the line:
"
Quote:
ALLOC F(ISFIN) TRACKS SPACE(1) SHR REU" /* USED BY SDSF */


That was causing the error:
IKJ56701I Missing dataset name
IKJ56701I Missing name of dataset to be allocated.
IRX0555E The input or output file ISFIN is not allocated. It can not be opened for I/O.
IRX067OE EXECIO error while trying to GET or PUT a record.


Now my code looks like this:
********************** rexx ****************************/
ARG JOBNAME JOBID
ADDRESS TSO
"ALLOC F(ISFIN) TRACKS SPACE(1) REU" /* USED BY SDSF */
"ALLOC F(ISFOUT) NEW DELETE REU " , /* USED BY SDSF */
"TRACKS SPACE(100,100) LRECL(133) RECFM(F,B,A) DSORG(PS)"
"ALLOC F(TEMPPRT) DA('U153134.TEMP') SHR"
QUEUE "SET CONFIRM OFF"
QUEUE "OWNER MDS9AB"
QUEUE "ST"
QUEUE "SELECT "JOBNAME JOBID
QUEUE "FIND "JOBNAME
QUEUE "++?"
QUEUE "FIND JESYSMSG"
QUEUE "++S"
QUEUE "PRINT FILE TEMPPRT"
QUEUE "PRINT"
QUEUE "PRINT CLOSE"
QUEUE "END"
QUEUE " "
"EXECIO" QUEUED()" DISKW ISFIN (FINIS" /* INPUT TO SDSF BATCH */
ADDRESS ISPEXEC "SELECT PGM(ISFAFD) PARM('++25,80')"/* INVOKE SDSF */
ADDRESS TSO "FREE F(ISFIN,ISFOUT,TEMPPRT)"
EXIT


But now the problem is when I have more than 1 jobs with same jobname but different jobid, it is always picking up first job with same jobname. It seems like filter or Select for Jobid is not working . Though it works well when i do it manually online.

eg:
MDS9ABTT JOB123454
MDS9ABTT JOB123463
MDS9ABTT JOB123474

When i execute my exec with arguents 'MDS9ABTT JOB123463',
it is putting JESYSMSG of MDS9ABTT JOB123454 into print dataset.

It works well when there is only one job with a jobname.

I tried replacing:
QUEUE "SELECT "JOBNAME JOBID
with

QUEUE "filter JOBNAME eq " JOBNAME " JobID eq " JOBID"

But, still it is picking first job only.

Thanks,
Ajay
Back to top
View user's profile Send private message
Ajay Baghel

Active User


Joined: 25 Apr 2007
Posts: 206
Location: Bangalore

PostPosted: Tue Apr 08, 2008 8:38 pm
Reply with quote

Hi Friends,

Quote:
But now the problem is when I have more than 1 jobs with same jobname but different jobid, it is always picking up first job with same jobname.
It seems like filter or Select for Jobid is not working . Though it works well when i do it manually online.

eg:
MDS9ABTT JOB123454
MDS9ABTT JOB123463
MDS9ABTT JOB123474

When i execute my exec with arguents 'MDS9ABTT JOB123463',
it is putting JESYSMSG of MDS9ABTT JOB123454 into print dataset.

It works well when there is only one job with a jobname.

I tried replacing:
QUEUE "SELECT "JOBNAME JOBID
with

QUEUE "filter JOBNAME eq " JOBNAME " JobID eq " JOBID"

But, still it is picking first job only.

Thanks,
Ajay
Back to top
View user's profile Send private message
kavya123
Warnings : 1

New User


Joined: 11 Jul 2007
Posts: 34
Location: hyderabad

PostPosted: Wed Apr 09, 2008 4:34 pm
Reply with quote

Hi,

see i have included a delete statement at the end so that after reading the CPU time the PS created was deleted and after you use it second time for other jobname and job id new lines will be printed in the same PS.

Code:
"DELETE "U153134.TEMP""



MAy be you are getting the same value because it is displaying the same value from the PS always when ever you run the macro.

Once check the PS wether changes are reflected if you give a new jobname and jobid.
Back to top
View user's profile Send private message
Ashwin_mudikon

New User


Joined: 03 Apr 2007
Posts: 32
Location: Chennai

PostPosted: Wed Apr 09, 2008 6:05 pm
Reply with quote

Chinna,

Use outtrap funtion with the "STATUS" command. You will get the status of all the jobs in the stem that u ve given in the outtrap. stem.0 will be the no of jobs.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Execute secondary panel of sdsf with ... CLIST & REXX 1
Search our Forums:

Back to Top