View previous topic :: View next topic
|
Author |
Message |
chinna
New User
Joined: 04 Oct 2005 Posts: 5 Location: Hyderabad
|
|
|
|
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 |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
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 |
|
|
amitava Warnings : 1 Active User
Joined: 30 Oct 2005 Posts: 186 Location: India
|
|
|
|
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 |
|
|
Sathishk
New User
Joined: 16 Feb 2006 Posts: 8
|
|
|
|
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 |
|
|
amitava Warnings : 1 Active User
Joined: 30 Oct 2005 Posts: 186 Location: India
|
|
|
|
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 |
|
|
martin9
Active User
Joined: 01 Mar 2006 Posts: 290 Location: Basel, Switzerland
|
|
|
|
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 |
|
|
tarunsharma1981
New User
Joined: 18 Jul 2006 Posts: 1
|
|
|
|
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 |
|
|
Huzefa
New User
Joined: 05 Dec 2006 Posts: 83 Location: Bangalore
|
|
|
|
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 |
|
|
Steve Coalbran
New User
Joined: 01 Feb 2007 Posts: 89 Location: Stockholm, Sweden
|
|
|
|
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 |
|
|
Steve Coalbran
New User
Joined: 01 Feb 2007 Posts: 89 Location: Stockholm, Sweden
|
|
|
|
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 |
|
|
Huzefa
New User
Joined: 05 Dec 2006 Posts: 83 Location: Bangalore
|
|
|
|
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 |
|
|
thilakvs Warnings : 1 New User
Joined: 07 Aug 2007 Posts: 27 Location: chennai
|
|
|
|
by using this can i get CPU time from spool |
|
Back to top |
|
|
kavya123 Warnings : 1 New User
Joined: 11 Jul 2007 Posts: 34 Location: hyderabad
|
|
|
|
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 |
|
|
thilakvs Warnings : 1 New User
Joined: 07 Aug 2007 Posts: 27 Location: chennai
|
|
|
|
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 |
|
Back to top |
|
|
kavya123 Warnings : 1 New User
Joined: 11 Jul 2007 Posts: 34 Location: hyderabad
|
|
|
|
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 |
|
|
thilakvs Warnings : 1 New User
Joined: 07 Aug 2007 Posts: 27 Location: chennai
|
|
|
|
Kavya,
Thanks a lot..but i m getting MCTIME NOT FOUND error..
how can i clear it.. |
|
Back to top |
|
|
kavya123 Warnings : 1 New User
Joined: 11 Jul 2007 Posts: 34 Location: hyderabad
|
|
|
|
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 |
|
|
kavya123 Warnings : 1 New User
Joined: 11 Jul 2007 Posts: 34 Location: hyderabad
|
|
|
|
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 |
|
|
kavya123 Warnings : 1 New User
Joined: 11 Jul 2007 Posts: 34 Location: hyderabad
|
|
|
|
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 |
|
|
Ajay Baghel
Active User
Joined: 25 Apr 2007 Posts: 206 Location: Bangalore
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
Back to top |
|
|
Ajay Baghel
Active User
Joined: 25 Apr 2007 Posts: 206 Location: Bangalore
|
|
|
|
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 |
|
|
Ajay Baghel
Active User
Joined: 25 Apr 2007 Posts: 206 Location: Bangalore
|
|
|
|
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 |
|
|
kavya123 Warnings : 1 New User
Joined: 11 Jul 2007 Posts: 34 Location: hyderabad
|
|
|
|
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 |
|
|
Ashwin_mudikon
New User
Joined: 03 Apr 2007 Posts: 32 Location: Chennai
|
|
|
|
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 |
|
|
|