This is a SDSF/REXX clist that extracts sysout datasets with names S0000* on 
the ST queue and archives them to datatsets.
It can be adapted to extract datasets with other criteria.

/* REXX */
TRACE e
/*ISFTRACE="ON" */
/*ISFTRMASK="ALL" */
PROFILE NOPREFIX
rc=isfcalls('ON')
PARSE ARG p1 p2 p3
IF p1     ="" THEN DO
ISFPREFIX = 'CICS*'
END
ELSE
DO
ISFPREFIX = p1
END
IF p2 ="" THEN DO
HLQ       = 'XCICSR.'
END
ELSE
DO
HLQ       = p2||'.'
END
IF p3     ="" THEN DO
ISFPRTVOLSER = 'W1STG1'
END
ELSE
DO
ISFPRTVOLSER = 'W1STG1'
END
ISFOWNER  = '*'
ISFFILTER = 'QUEUE PRINT'
CICSJOBN = ISFPREFIX
ASTPO = POS('*',CICSJOBN)
if ASTPO ^= 0 then
do
ASTPO = ASTPO - 1
CICSJOBN = SUBSTR(CICSJOBN,1,ASTPO)
end
/* Access the ST panel. A TOKEN variable is */
/* created for each row which is subsequently */
/* needed to perform actions */
Address SDSF "ISFEXEC ST"
lrc=rc
call msgrtn
/* Find a job starting with CICSjobn and list data sets */
/* rexx */
numrows=isfrows
if isfrows<=0 then exit
six = 1
setix:
if six > numrows then signal endit
do ix=six to numrows /* Loop for all rows returned */
if pos(CICSJOBN,JNAME.ix) = 1 then /* If this is desired row */
do
/* Issue the ? action character for the job */
/* identified by the token variable. Note */
/* the token must be enclosed in single quotes */
/* Use the prefix option to ensure unique */
/* variables are created, beginning with JDS_ */
Address SDSF "ISFACT ST TOKEN('"TOKEN.ix"') PARM(NP ?)",
"("prefix JDS_
if JDS_DDNAME.0 = 0 then exit
lrc=rc
if lrc<>0 then
exit 20
startjx = 2
jf = 0
IF JDS_DDNAME.0 =1 then signal SETJL1
/***if 2 jesmsglgs use 2nd  */
do jf = 2     to JDS_DDNAME.0 /* loop for all rows returned */
IF SUBSTR(JDS_DDNAME.jf,1,4) = 'JESM' then signal GETJLINF
end
SETJL1:
startjx = 1
GETJLINF:
do jx=startjx to JDS_DDNAME.0 /* loop for all rows returned */
IF SUBSTR(JDS_DDNAME.jx,1,4) = 'JESM' then signal GOTJESM
end
signal nextjob
lrc=rc
call msgrtn
if lrc<>0 then do
exit 20
GOTJESM:
sjx    = jx  /*save position of current ddname entry */
Address SDSF "ISFACT ST TOKEN('"JDS_TOKEN.jx"') PARM(NP SA)"
lc = rc
k = isfddname.0
/*******READ 3RD   RECORD TO GET STARTED TASK NUMBER  */
 "EXECIO 1  DISKR " isfddname.k 3 " (STEM STCREC. "
 lrc = rc
 If lrc ^= 0 THEN SIGNAL NOSTC
 PARSE VAR STCREC.1  S1 STRNUM S3
 STRNUM = STRIP(STRNUM)
 STCNUM = SUBSTR(STRNUM,1,8)
/*******READ 4TH   RECORD TO GET JOBNAME              */
 "EXECIO 1  DISKR " isfddname.k 4 " (STEM STCREC. "
 PARSE VAR STCREC.1  X1 X2 X3 JN XX
 JN = STRIP(JN)
 "EXECIO 0  DISKR " isfddname.k  " (finis        "
 sjx = sjx+1
 signal setjx
setjx:
IF sjx >  JDS_DDNAME.0 then signal nextjob
do jx=sjx to JDS_DDNAME.0 /* loop for all rows returned */
IF SUBSTR(JDS_DDNAME.jx,1,4) = 'S000' then signal GOTSTAT
end
signal NOSTAT
NOSTC:
EXIT
NOSTAT:
six =six+1
signal setix
EXIT
GOTSTAT:
Address SDSF "ISFACT ST TOKEN('"JDS_TOKEN.jx"') PARM(NP SA)",
"("prefix SDS_
lc = rc
k = isfddname.0
STATIN = isfddname.k
STATDS = isfdsname.k
/*******READ FIRST RECORD TO GET INFO TO WRITE OUTPUT DATAST  */
 "EXECIO *  DISKR " isfddname.k " (STEM REC. "
 lrc = rc
 If lrc ^= 0 THEN SIGNAL noapp
 PARSE VAR REC.1  A  A2 A3 A4 A5 JN A7 JD A9 JT A6
 IF SUBSTR(A,1,4) = '1App' THEN SIGNAL GOTAPP
noapp:
 EXIT
GOTAPP:
 JDATE= ".D"||SUBSTR(JD,1,2)||SUBSTR(JD,4,2)||SUBSTR(JD,9,2)
 JTIME= ".T"||SUBSTR(JT,1,2)||SUBSTR(JT,4,2)||SUBSTR(JT,7,2)
 STPNUM = "."||STCNUM
 "FREE FILE(STATOUT)"
 /*OUTDS = "XCICS."||JN||JDATE||STPNUM||JTIME */
 OUTDS =  HLQ||JN||JDATE||STPNUM||JTIME
/*if SYSDSN(OUTDS) ^= 'OK' */
/* THEN SIGNAL NEWDS */
 "FREE FILE(XXX)  "
 "ALLOC FILE(XXX) DSNAME("OUTDS") SHR  "
 IF RC ^= 0 THEN SIGNAL NEWDS
 SIGNAL MOREDS
 NEWDS:
 /*"DELETE  "OUTDS"  " */
 /*LLOC FILE(STATOUT) DSNAME("OUTDS") NEW CATALOG  DSORG(PS) */
/*PACE(10 5) TRACKS RECFM(F B A) BLKSIZE(14300) LRECL(143) VOL(XCICS1)*/
 ISFPRTDDNAME='STATOUT'
 ISFPRTDSNAME= "'"OUTDS"'"
 ISFPRTDEST='NEW'
 ISFPRTRECFM = 'FB'
 ISFPRTLRECL = '143'
 ISFPRTBLKSIZE= '14300'
 /*ISFPRTVOLSER= 'XCICS1' */
 ISFPRTSPACETYPE = 'BLKS'
 ISFPRTPRIMARY = '1000'
 ISFPRTSECONDARY = '0500'
 ISFPRTUNIT = 'SYSDA'
 ISFPRTDISP = 'NEW'
Address SDSF "ISFACT ST TOKEN('"JDS_TOKEN.jx"') PARM(NP XDC)"
lrc = rc
if lrc = 0 then signal MOREDS
call msgrtn
MOREDS:
/****look for more STAT (S00*) DATASETS  **************/
sjx =sjx+1
signal setjx
/*CALL msgrtn */
endit:
 EXIT
nextjob:
/***process more jobs with the same jobname  **********/
six = six+1
sjx = 2
signal setix
exit
/* Subroutine to list error messages */
msgrtn: procedure expose isfmsg isfmsg2.
/* The isfmsg variable contains a short message */
if isfmsg<>"" then
Say "isfmsg is:" isfmsg
/* The isfmsg2 stem contains additional descriptive */
/* error messages */
do ix=1 to isfmsg2.0
Say "isfmsg2."ix "is:" isfmsg2.ix
end
return

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Gibney, Dave
Sent: Tuesday, May 08, 2018 3:55 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: [TSO-REXX] Sdsf rexx

Phoenix has superb support, they should be able to point you to the right 
places in their manuals.

It's usually takes a few additional tricks with the runtime JCL of STCs if you 
want to siphon off JESMSGLG and/or JESYSMSG

> -----Original Message-----
> From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU]
> On Behalf Of Jake Anderson
> Sent: Tuesday, May 08, 2018 12:51 PM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: Fwd: [TSO-REXX] Sdsf rexx
>
> Cross posted
>
> Lizette,
>
> We are using EJES. I think it has its own rexx interface.
>
> So finding a way to know the destination based on first character of a
> Jobname.
>
>
> ---------- Forwarded message ----------
> From: Lizette Koehler <stars...@mindspring.com>
> Date: Wed, May 9, 2018 at 12:20 AM
> Subject: Re: [TSO-REXX] Sdsf rexx
> To: tso-r...@vm.marist.edu
>
>
> What level of z/OS are you running?
>
> If z/OS V2.3 then SDSF has a REXX Wizard (I think)  It should help you build
> what you want
>
> If you google JES2DISK by John McKown then that will be a good basis to work
> with.
>
>
> Lizette
>
>
> > -----Original Message-----
> > From: TSO REXX Discussion List <tso-r...@vm.marist.edu> On Behalf Of
> > Jake Anderson
> > Sent: Tuesday, May 08, 2018 11:41 AM
> > To: tso-r...@vm.marist.edu
> > Subject: [TSO-REXX] Sdsf rexx
> >
> > Hi
> >
> > Is it possible to use rexx to check Jobname based on the destination
> where it
> > is printed ?
> >
> > I am trying to take a list of Jobname with its first character as $
> > and
> its
> > destination.
> >
> > Any working code that I can try ? Basically I want to know the
> destination of
> > each jobname starting with $.
> >
> > Jake
> >
>
> ----------------------------------------------------------------------
> For TSO-REXX subscribe / signoff / archive access instructions, send email to
> lists...@vm.marist.edu with the message: INFO TSO-REXX
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions, send email to
> lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

________________________________

This e-mail, including any attachments, may be confidential, privileged or 
otherwise legally protected. It is intended only for the addressee. If you 
received this e-mail in error or from someone who was not authorized to send it 
to you, do not disseminate, copy or otherwise use this e-mail or its 
attachments. Please notify the sender immediately by reply e-mail and delete 
the e-mail from your system.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to