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

Capturing the joblog with filter as userid


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
balakrishna reddy.bala

New User


Joined: 15 Sep 2010
Posts: 17
Location: india

PostPosted: Tue Jun 14, 2011 1:25 pm
Reply with quote

Hi All,

I have a requirement where in which i need to capture the joblog in sdsf

I am trying to do it using rexx

The following are the scenarios which i need to takeup

Scenarios:
1) If the same job name was submitted by two different users, I have to take the backup of joblog which i have submitted
2) If there are two or three jobs in sdsf, I need to take backup of the latest job ran

Please find below the code which i used to get these details


Code:


ADDRESS TSO
"ALLOC F(ISFIN) TRACKS SPACE(1) REU" /* USED BY SDSF */
"ALLOC F(ISFOUT) NEW DELETE REU " , /* USED BY SDSF */
"CYLINDER SPACE(2,1) LRECL(133) RECFM(F,B,A) DSORG(PS)"
"ALLOC F(TEMPPRT) DA('"PDSNAME"("JOBNAME")')
        MOD SPACE (80 80) CYL DIR(10)"
JOBID = JOBNAME
STR = SUBSTR(JOBNAME,1,7)
QUEUE "ST"
QUEUE "PRE *" /* SDSF COMMANDS IN BATCH*/
QUEUE "OWNER " || VUSRID
QUEUE "FIND " JOBID
QUEUE "SORT JOBID D"
QUEUE "++S" /* BROWSE MSGUSR DATASET */
QUEUE "PRINT FILE TEMPPRT " /* PRINT TO TEMP DATASET */
QUEUE "PRINT 1 999999999"
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 */
 "FREE F(TEMPPRT)"
RETURN


When i run these commands using rexx , The logon procedure joblog ( TSO user id job) is getting backedup

Can anyone help me out in resolving it.

Thanks in advance

Balakrishna
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Tue Jun 14, 2011 2:05 pm
Reply with quote

Code:
QUEUE "++S" /* BROWSE MSGUSR DATASET */


The comment is not consistent with the command (unless your system puts the MSGUSR output at the start of the job). You should ++? to expand the job and then FIND the MSGUSR output.

Garry.
Back to top
View user's profile Send private message
balakrishna reddy.bala

New User


Joined: 15 Sep 2010
Posts: 17
Location: india

PostPosted: Tue Jun 14, 2011 4:10 pm
Reply with quote

Hi Garry,

Thanks for your responce

Please ignore the comments, I want to take the backup of whole job.

If we give '++?' it will expand the job as you said, But if we give directly '++S' it will open all the messages then i will print them.
Back to top
View user's profile Send private message
nevilh

Active User


Joined: 01 Sep 2006
Posts: 262

PostPosted: Tue Jun 14, 2011 4:51 pm
Reply with quote

The method you are using is not reliable. Jes has an installation defined number of job numbers available when these are used up jes starts at the lowest value again. If this happens your rexx will never select the correct job. To cater for this you will have to build extra logic into your rexx. Secondly if the job you are trying to backup has the same owner id as a tso user , the tso user will always be backed up as you do a "sort jobid d" and Txxxx is greater than Jxxxx
Back to top
View user's profile Send private message
balakrishna reddy.bala

New User


Joined: 15 Sep 2010
Posts: 17
Location: india

PostPosted: Tue Jun 14, 2011 5:07 pm
Reply with quote

Hi,

Is there anyway to get the latest job first and filter it based on user id

As you said 'Txxxxxxx' is greater than 'Jxxxxxxx', This is what exactly happening, Can you suggest me something to get the right job's joblog
Back to top
View user's profile Send private message
nevilh

Active User


Joined: 01 Sep 2006
Posts: 262

PostPosted: Wed Jun 15, 2011 1:33 pm
Reply with quote

Sorry I can't be much help a lot will depend on how your system is set up.
For example if you logoff does the output from your tso session stay in the spool or is it automatically deleted, if it stays in the spool to which queue does it go.These are questions only you can answer. You may however have more success if instead of using the ST command you go directly to the Output or Held queues as at least there you will only get a list of completed jobs and no active tasks will be shown. Good Luck
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Jun 15, 2011 2:26 pm
Reply with quote

You will have to resort to a different approach
using the full programmable REXX/SDSF interface

as described in the manuals for Your level of zOS starting here
www-03.ibm.com/systems/z/os/zos/bkserv/index.html

and the redbook here
www.redbooks.ibm.com/abstracts/sg247419.html?Open

something along the lines of


Code:
****** ***************************** Top of Data ******************************
000001 /*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000002 /*                                                                   */
000003 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000004 Trace  "O"
000005 Parse Source _sys _how _cmd .
000006 parse arg args
000007
000008 IsfRC = isfcalls("ON")
000009 if IsfRC ¬= 0 then do
000010     say "isfcalls RC" IsfRC
000011     exit
000012 end
000013
000014 isfprefix = "ENRICO*"
000015 isffilter = "queue = print"
000016 isfcols   = "jname jobid "
000017
000018 Address SDSF "isfexec st"
000019 if RC ¬= 0 then do
000020     say "isfexec  RC" RC
000021     exit
000022 end
000023
000024 do ij = 1 to jname.0
000025     say right(ij,2) jname.ij jobid.ij
000026 end
000027 call  isfcalls "OFF"
000028 exit
****** **************************** Bottom of Data ****************************


applying some sliding window to the jobid You will be able to determine the right job to process

the next snippet will build on the previous one and
display the all the ddnames for all the jobs

Code:
****** ***************************** Top of Data ******************************
000001 /*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000002 /*                                                                   */
000003 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000004 Trace  "O"
000005 Parse Source _sys _how _cmd .
000006 parse arg args
000007
000008 IsfRC = isfcalls("ON")
000009 if IsfRC ¬= 0 then do
000010     say "isfcalls RC" IsfRC
000011     exit
000012 end
000013
000014 isfprefix = "ENRICO*"
000015 isffilter = "queue = print"
000016 isfcols   = "jname jobid "
000017
000018 Address SDSF "isfexec st"
000019 if RC ¬= 0 then do
000020     say "isfexec  RC" RC
000021     exit
000022 end
000023
000024 do jnum = 1 to jname.0
000025     say right(jnum,2) jname.jnum jobid.jnum
000026     jopts  = "(PREFIX J)"
000027     Address SDSF "ISFACT ST TOKEN('"token.jnum"') PARM(NP ?) " jopts
000028     if RC ¬= 0 then do
000029        say "isfact   RC" RC
000030        exit
000031     end
000032    do idd = 1 to jddname.0
000033       say right(jnum,2) jname.1 jobid.1 right(idd,2) jddname.idd
000034    end
000035
000036 end
000037 call  isfcalls "OFF"
000038 exit
****** **************************** Bottom of Data ****************************



as a further expansion the next snippet will do the above
plus it will read and display the first three datasets for each job

Code:
****** ***************************** Top of Data ******************************
000001 /*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000002 /*                                                                   */
000003 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000004 Trace  "O"
000005 Parse Source _sys _how _cmd .
000006 parse arg args
000007
000008 IsfRC = isfcalls("ON")
000009 if IsfRC ¬= 0 then do
000010     say "isfcalls RC" IsfRC
000011     exit
000012 end
000013
000014 isfprefix = "ENRICO*"
000015 isffilter = "queue = print"
000016 isfcols   = "jname jobid "
000017
000018 Address SDSF "isfexec st"
000019 if RC ¬= 0 then do
000020     say "isfexec  RC" RC
000021     exit
000022 end
000023
000024 do jnum = 1 to jname.0
000025     say right(jnum,2) jname.jnum jobid.jnum
000026     jopts  = "(PREFIX J)"
000027     Address SDSF "ISFACT ST TOKEN('"token.jnum"') PARM(NP ?) " jopts
000028     if RC ¬= 0 then do
000029        say "isfact   RC" RC
000030        exit
000031     end
==CHG>    do jdd = 1 to jddname.0
==CHG>       say right(jnum,2) jname.1 jobid.1 right(jdd,2) jddname.jdd
000034    end
000035
==CHG>    do jdd = 1 to 3
000037        Address SDSF "ISFACT ST TOKEN('"jtoken.jdd"') PARM(NP SA) "
000038        "EXECIO * DISKR " isfddname.1 " ( OPEN FINIS STEM SPOOL. "
000039        do i = 1 to spool.0
000040            say spool.i
000041        end
000042    end
000043 end
000044
000045 call  isfcalls "OFF"
000046
000047 exit
****** **************************** Bottom of Data ****************************



why use obsolete methods when better ones are available ?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jun 15, 2011 2:30 pm
Reply with quote

Have you got any date/time that you can use? Much better for getting the "latest" of something. What if I submit two jobs, the first one held, the second one not, same name. One runs. A week later I release the other, which has the lower Jobid. Then I run another, but the Jobids have "cycled" and this has the lowest Jobid of all three. Etc.
Back to top
View user's profile Send private message
balakrishna reddy.bala

New User


Joined: 15 Sep 2010
Posts: 17
Location: india

PostPosted: Mon Jul 04, 2011 1:11 pm
Reply with quote

Hi,

I have to filter as per the date of run which ever is recently submitted and then if submitted on the same date then sort based on jobid and take backup of the least one of it in a pds.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Jul 04, 2011 1:14 pm
Reply with quote

Quote:
I have to filter as per the date of run which ever is recently submitted and then if submitted on the same date then sort based on jobid and take backup of the least one of it in a pds.

clear as mud icon_cool.gif

if You want good answers You will have to ask clear questions

any reason to sort on jobid ?
what difference does it make if You just store something somewhere?
it is not that You browse it!
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jul 04, 2011 1:17 pm
Reply with quote

our jobids roll about every two days.

that means one day the second job to run could be of a higher jobid
or it could be lower.

basing anything on jobid without some type of date/time qualification,
is asking for a problem.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jul 04, 2011 7:01 pm
Reply with quote

With date and time available, all your problems go away, as far as the data is concerned anyway.

Without date and time you've got nothing but tortuous idiotic code to look forward to, and then it won't reliably give you the correct answer.

It's taken you two weeks to move to seeing that you need the date, pick it up a bit now and get the time.

Then you can get your data, simply, in the exact order that it was executed, irrespective of anything else (holds, jobid cycling, whatever).

At the same time, try to get everything else you need in one shot. Then you have file with all your data, whicih you can usefully sequence/select to your heart's content.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Jul 04, 2011 7:30 pm
Reply with quote

see here for a tutorial on on how to use the REXX SDSF smart interface

publib.boulder.ibm.com/infocenter/ieduasst/stgv1r0/index.jsp?topic=/com.ibm.iea.zos/zos/1.9/Simplification/zOSV1R9_Simplification_SDSFREXX/player.html
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

 


Similar Topics
Topic Forum Replies
No new posts Capturing Job Execution Information All Other Mainframe Topics 3
No new posts Rexx log capturing CLIST & REXX 15
No new posts Help to Filter File Manager Copybook ... DFSORT/ICETOOL 14
No new posts Capturing COBOL job and program names... All Other Mainframe Topics 2
No new posts Capturing logs from spool dd JCL & VSAM 6
Search our Forums:

Back to Top