Jake,
Find below a rexx exec, ispf panel (optional), and ISPF help panel that should be all you need to capture and index SDSF output. If you execute RDTSVSDF with parms the panel is not necessary.
The help is display by TSO RDTSVSDF ?
Hth,
Russ
//********************** REXX EXEC *************************
EXEC:
/* Rexx - RDTSVSDF - copy job output from SDSF to a PDS */
/* */
/* This exec will capture and index the job listings from SDSF and */
/* store them in a library. The job capture is controlled by */
/* input arguments. The arguments can control: */
/* Job Prefix */
/* Job Owner */
/* Job Id */
/* Queue (DA, H, ST) */
/* Output Dataset name. The dataset can either be pre-allocated */
/* or will be allocated */
/* */
/* Duplicate job names cannot be saved. If you receive the */
/* error message you may want to use a different ODSN. */
/* */
/*-------------------------------------------------------------------*/
/* Args: */
/* Job Prefix */
/* Job Owner */
/* Job JobId */
/* Job Queue */
/* Output PDS where SDSF output is captured */
/* */
/* If RDTSVSDF is called without any args a panel will display */
/* where your options can be set. */
/*-------------------------------------------------------------------*/
MsgStat = MSG("OFF")
arg inparms
Call Set_Defaults
Call Parse_Args
Call Verify_Options
Call Alloc_Output
Call Copy_Queue
Call Free_Output
Call Display_Finish_Message
Exit
Free_Output: NOP
/*-------------------------------------------------------------------*/
/* Free the output DS allocation. */
/*-------------------------------------------------------------------*/
Address TSO "FREE FI(SDSFOUT)"
Return
Alloc_Output: NOP
/*-------------------------------------------------------------------*/
/* Allocate the output dataset if it does not already exist. */
/* If the dataset does not exist it will be allocated as a PDSE */
/*-------------------------------------------------------------------*/
ODSN = "'"strip(ODSN,"B","'")"'" /* remove quotes from a quoted DS */
/* and put our own quotes on */
If SYSDSN(ODSN) /= "OK" then do
ALine1 = "CYL SPACE(1 5) NEW CATALOG DSORG(PO)"
ALine2 = "LRECL(255) RECFM(F B) DSNTYPE(LIBRARY)"
End
Else do /* alloc existing as SHR */
Call Validate_Existing_DS /* make user DS matches required */
ALine1 = ""
ALine2 = "SHR"
End
address tso "ALLOC DD(SDSFOUT) DS("ODSN")",
ALine1,
ALine2
Call Allocate_Index
return
Verify_Options: NOP
/*-------------------------------------------------------------------*/
/* Verify that all options have been set and that PREFIX and */
/* OWNER and not both *. If both are * the entire SDSF queue will */
/* be copied. */
/*-------------------------------------------------------------------*/
Call Validate_JPrefix
Call Validate_JJobId
Return
Validate_JPrefix:
/*-------------------------------------------------------------------*/
/* Validate the JPrefix field */
/*-------------------------------------------------------------------*/
if (jprefix = ' ' & jowner = ' '),
| (jprefix = ' ' & jowner = '*'),
| (jprefix = '*' & jowner = ' '),
| (jprefix = '*' & jowner = '*') then do
say "Both the NAME and TYPE fields cannot be blank"
say "NAME contains PREFIX and TYPE contains OWNER"
say "one or both of these must be used"
Exit 8
End
Return
Validate_JJobId:
/*-------------------------------------------------------------------*/
/* Validate the JobId field */
/*-------------------------------------------------------------------*/
If JJobid /= "" then do
ValidJID = "TSU JOB STC"
If (wordpos(substr(JJOBID,1,3),ValidJID) = 0),
| (length(JJOBID) /= 8),
| (datatype(substr(JJOBID,4,5)) /= "NUM") then do
Say "Invalid JJOBID= specified"
Say "The JJOBID= must start with TSU or JOB or STC and "
Say "be 8 characters in length and the last 5 characters"
Say "must be numeric"
Exit 8
End
End
Return
Validate_Existing_DS:
/*-------------------------------------------------------------------*/
/* If the user is using an existing dataset make sure it is a PDS */
/* or PDSE and the LRECL = 255. */
/*-------------------------------------------------------------------*/
if (LISTDSI(ODSN) > 4) then do
Say "Error alloacting the ODSN "odsn
Say "LISTDSI SYSREASON = "SYSREASON
Exit 8
End
If (SYSDSORG <> "PO"),
| (SYSLRECL <> 255) then do
Say "SYSDSORG must be PO"
Say "SYSLRECL must be 255"
Say ODSN" has an LRECL of "SYSLRECL" and a DSORG of "SYSDSORG
Exit 8
End
Return
Allocate_Index:
/*-------------------------------------------------------------------*/
/* Allocate the index member which is stored in the output DS. */
/* If an INDEX member already exists read it and populate INDEX. */
/* Else set INDEX.0 = 0 */
/*-------------------------------------------------------------------*/
read_index = 1
Indmem = "'"strip(odsn,"B","'")"(INDEX)'"
If SYSDSN(Indmem) /= "OK" then read_index = 0
address TSO "alloc fi(outindex) ds("indmem") shr"
if read_index = 1 then
address TSO "EXECIO * DISKR outindex (STEM index. FINIS)"
Else
index.0 = 0
IF DEBUG = "Y" then say "INDEX.0 = "index.0
Return
Populate_Old_Index: NOP
/*-------------------------------------------------------------------*/
/* If the output dataset already existed we need to append the new */
/* listings to the existying list. */
/*-------------------------------------------------------------------*/
address TSO "EXECIO * DISKR outindex (STEM index. FINIS)"
Return
Set_Defaults: NOP
DEBUG = " "
JPREFIX = "*"
JOWNER = "*"
JQUEUE = "ST"
JJOBID = " "
SDATE = " "
EDATE = " "
DATEN = "9999.999"
STIME = " "
ETIME = " "
TIMEN = "99:99:99"
MSGS = "ON"
/*
SDATE = Substr(DATE("S"),1,4)"."Substr(DATE("J"),3,3)
EDATE = Substr(DATE("S"),1,4)"."Substr(DATE("J"),3,3)
STIME = TIME()
ETIME = TIME()
*/
DQUAL = substr(DATE("S"),3,6)
ODSN = "'"userid()".SDSFOUT.D"DQUAL".T"TIME(M)"'"
Return
Parse_Args: NOP
/*-------------------------------------------------------------------*/
/* Parse the incoming args: */
/* OutputDSN - DSN where you want the output saved */
/* Job Prefix - Job Name Prefix to save */
/* Job Owner - Job Owner to save */
/* JobId - JobId (JOB09456 or TSU00234) */
/* Start Date - Filter selection by Start Date */
/* Stop Date - Filter selections by Ending Date */
/* Start Time - Filter selection by Start Time */
/* Stop Time - Filter selections by Ending Time */
/*-------------------------------------------------------------------*/
If inparms = "?" then do
Call Display_Help
Exit 0
End
If inparms = " " then do
Call Display_Panel
Call Format_Panel_Vars
USEPARM = TRANSLATE(SPACE(USEPRE USEOWN USEDSN USEQ),',',' ')
End
validprm = "JPREFIX= JOWNER= SDATE= EDATE= STIME= ETIME= ODSN=",
"JQUEUE= JJOBID= DEBUG= JTRACE= MSGS="
say inparms
Do Forever
parse var inparms chkparm '=' parmval ',' rest
interpret chkparm "='"parmval"'"
if index(validprm,chkparm) = 0 then,
Call rcexit 8 'Invalid parm supplied. Parms: 'chkparm,
'is not a valid parm. VALID PARMS: 'VALIDPRM
if rest = "" then leave
inparms = rest
End /* end, DO FOREVER */
Return
Display_Panel:
/*-------------------------------------------------------------------*/
/* Display the input panel */
/* Default the Prefix to userid */
/* Default the Owner to blank */
/*-------------------------------------------------------------------*/
JPREFIX = userid()||'*'
JOWNER = ''
address ISPEXEC "ADDPOP"
address ISPEXEC "DISPLAY PANEL(RDTSVSDF)"
DispRC = RC
address ISPEXEC "REMPOP"
If DispRC >= 8 then do
Say 'SDSF output not saved, You issued END.'
exit 8
End
Return
Format_Panel_Vars:
/*-------------------------------------------------------------------*/
/* Format the input panel fields into a valid inparms */
/*-------------------------------------------------------------------*/
usepre = ''
useown = ''
usedsn = ''
useQ = ''
useJID = ''
Call Validate_JPrefix
Call Validate_JJobId
if JPREFIX /= '' then usepre = strip('JPREFIX='JPREFIX)
if JOWNER /= '' then useown = strip('JOWNER='JOWNER)
if ODSN /= '' then usedsn = strip('ODSN='ODSN)
if JQUEUE /= '' then useQ = strip('JQUEUE='JQUEUE)
if JJOBID /= '' then useJ = strip('JQUEUE='JJOBID)
/* space will reduce the 4 word to only 1 space between and the */
/* translate will change the space to a , so we end up with */
/* commas between each word. */
inparms = translate(space(usepre useown usedsn useQ useJID),',',' ')
Return
Display_Finish_Message: NOP
/*-------------------------------------------------------------------*/
/* Display the output dataset and other important info. */
/*-------------------------------------------------------------------*/
Say ""
Say "Your output is saved in "odsn
Say "Using parms; Prefix: "Jprefix", Owner:" Jowner", Queue: "JQueue
Say ""
Return
Display_Help:
Say ""
Say "RDTSVSDF Help"
Say ""
Say "Call RDTSVSDF JPREFIX=MYJOB*,JQUEUE=H"
Say "Call RDTSVSDF JOWNER=MYJOB,JQUEUE=ST"
Say "Call RDTSVSDF JOWNER=MYJOB,JQUEUE=ST,ODSN=MYJOB.SDSF.TEST"
Say ""
Say "If ODSN= is not specified the output dataset will be"
Say "like: userid().SDSFOUT.D120927.T866"
Say ""
Say "The output dataset will have an INDEX member that describes"
Say "each of the members saved."
Say ""
Say "The output dataset name will be displayed at exit"
Say ""
Return
Copy_Queue: NOP
/*-------------------------------------------------------------------*/
/* Use ISF (SDSF) to copy the requested output to the output DS */
/* An index member is also created containing a list of all */
/* members written to the library. */
/*-------------------------------------------------------------------*/
ISFrc = isfcalls("ON")
ISFPREFIX = JPREFIX
ISFOWNER = JOWNER
address SDSF "isfexec "JQUEUE" (delayed"
ISFPRTDSNAME = ODSN
ISFPRTDISP = "SHR"
do i = 1 to isfrows
ISFPRTMEMBER = jobid.i
prtmem = "'"strip(odsn,"B","'")"("ISFPRTMEMBER")'"
/* User has additionally filtered by JOBID */
If JJOBID /= "",
& JJOBID /= JOBID.I then iterate
If SDATE /= "" then do
If DATEN.i < SDATE then Iterate
If STIME /= "" then do
If TIMEN.i < STIME then Iterate
End
End
If EDATE /= "" then do
If DATEN.i > EDATE then Iterate
If ETIME /= "" then do
If TIMEN.i > ETIME then Iterate
End
End
/* If the same JOBID has already been saved say so and skip */
If SYSDSN(prtmem) = "OK" then do
Say ISFPRTMEMBER" already exists, not saving"
iterate
End
say "Adding: " ISFPRTMEMBER
Call Capture_Index_Detail
address sdsf "isfact "JQUEUE" token('"token.i"') PARM(NP XDC)"
if DEBUG = "Y" then say isfmsg
end
ISFrc = isfcalls("OFF")
Call Create_Index /* write the INDEX member */
Return
Capture_Index_Detail:
/*-------------------------------------------------------------------*/
/* As each output listing is saved into ODSN build an index record */
/* describing what the output is. This will be saved in the INDEX */
/* member of ODSN. */
/*-------------------------------------------------------------------*/
If INDEX.0 = 0 then Call Create_IndexHDR
cnt = index.0 + 1
index.0 = cnt
index.cnt = left(JNAME.I,8," "),
left(JOBID.I,8," "),
left(PNAME.I,25," "),
left(OWNERID.I,8," "),
left(RETCODE.I,10," "),
left(DATER.I,12," "),
left(TIMER.I,12," ")
Return
Create_IndexHDR: NOP
/*-------------------------------------------------------------------*/
/* Write a HDR line to the index member. This header places column */
/* headers as the first line in the Index member. */
/*-------------------------------------------------------------------*/
index.0 = 1
Index.1 = left("JobName",8," "),
left("JOBID",8," "),
left("PgmName",25," "),
left("OWNER",8," "),
left("RC",10," "),
left("DATE",12," "),
left("TIME",12," ")
Return
Create_Index: NOP
/*-------------------------------------------------------------------*/
/* Create the Index member in the ODSN. The index will help you */
/* identify what each member in the PDS is. */
/* The index is create by writing the INDEX. compound variable */
/* to the INDEX member of the library. */
/*-------------------------------------------------------------------*/
address TSO "EXECIO * DISKW outindex (STEM index. FINIS)"
address TSO "free fi(outindex)"
return
//************************ PANEL ****************************
)Attr Default() /* x'01' x'02' x'03' */
AB TYPE(AB ) /* Action Bar */
AC TYPE(ABSL ) GE(ON) /* Action Bar Separator line */
03 TYPE(NEF ) PADC(USER) CAPS(ON) /* CMD prompt Entry Field */
_ TYPE(NEF ) PAD('_') CAPS(ON) /* Normal Entry Underline */
% TYPE(ET ) /* % Text Intens High */
05 TYPE(PT ) /* Panel Title */
06 TYPE(LEF ) /* List Entry Field */
07 TYPE(LI ) /* List Output field */
º TYPE(OUTPUT) COLOR(RED) INTENS(HIGH) /* like LI except red */
+ TYPE(NT ) /* Normal Text */
` TYPE(FP ) /* Field Prompt Text */
| TYPE(CH ) /* Column/Group Header */
^ TYPE(DT ) /* Descriptive Text */
{ TYPE(INPUT ) pas(on) skip(off) /* Point and Shoot input */
} TYPE(TEXT) skip(on) color(turq) /* Text looks like { */
08 TYPE(OUTPUT) COLOR(RED) INTENS(HIGH) /* Warning Text */
09 TYPE(WASL ) /* Work area separater line */
)body window(60,15) expand(\\) outline(BOX)
Ú-\-\- Capture SDSF Output Ú-\-\- +
+
+Command ===>_ZCMD +
+
+|Either Prefix or Owner (or both) is Required +
+|Press 'Enter' to process +
+ +
+ OutDSN:_ODSN +
+ Prefix:_JPREFIX + (MYJOBA* or MYJOBAB)
+ Owner: _JOWNER + (MYUSER)
+ Queue: _JQUEUE+ (DA, H, ST)
+ JobId: _JJOBID + (JOB05692)
+ Resrv: _JDATE + (Reserved for future use)
+ Resrv: _JTIME + (Reserved for future use)
+
)INIT
.CURSOR = ZCMD
.HELP = RDTSVSDH
)END
//************************* help panel **********************
)Panel Keylist(ISRHELP ISR)
)Attr Default(`}~)
` TYPE(TEXT) INTENS(HIGH)
} TYPE(TEXT) INTENS(LOW) COLOR(GREEN)
~ TYPE(INPUT) COLOR(TURQ) CAPS(ON) JUST(LEFT)
^ TYPE(TEXT) INTENS(LOW) COLOR(BLUE)
! TYPE(TEXT) INTENS(LOW) COLOR(TURQ)
º TYPE(PS)
{ AREA(SCRL) EXTEND(ON)
)Body Expand (\\)
!-\-\- ADM Help - Save and Index SDSF Listings -\-\-}
}Option ===>~ZCMD
`RIGHT}to scroll down;`LEFT}to scroll up;`END}to return
{SAREA1 {
)Area SAREA1
}
`Index and save output from the SDSF queue to my dataset.
}
}!RDTSVSDF}will capture and index the job listings from SDSF and
} store them in a library. The job capture is controlled by
} input arguments. The arguments can control:
}
} Job Prefix
} Job Owner
} Job Id
} Queue (DA, H, ST)
} Output Dataset name. The dataset can either be pre-allocated
} or will be allocated if it does not exist.
}
} If ODSN= is not specified the output dataset will be similar to
} userid().SDSFOUT.D120927.T866
}
}
} Duplicate job names cannot be saved. If you receive the
} error message you may want to use a different ODSN.
}
}______________________________________________________________________
}______________________________________________________________________
}
} Input parms:
}
} JPREFIX= Prefix a
} JQUEUE= Queue a
} JOWNER= Owner Id a
} JJOBID= Job Id (JOB02507 or TSU02234) a
} ODSN= Output dataset name a
}______________________________________________________________________
}______________________________________________________________________
}
} If RDTSVSDF is called without any args a panel will display
} where your options can be set.
}
}______________________________________________________________________
}______________________________________________________________________
}
} Examples:
}
} Display the RDTSVSDF input panel so I can make selections
}
} TSO RDTSVSDF
}
} Save all Jobs from the Held Queue with the Prefix DVRLL* into a new
} dataset. The dataset name will be displayed when the command ends.
}
} TSO RDTSVSDF JPREFIX=DVRLL*,JQUEUE=H
}
} Save all Jobs from the Status Queue with the Prefix DVRLL* into a new
} dataset. The dataset name will be displayed when the command ends.
}
} TSO RDTSVSDF JOWNER=DVRLL,JQUEUE=ST
}
} Save all Jobs from the Status Queue Where the Owner Id = DVRLL and
} save them in dataset DVRLL.SDSF.TEST
}
} TSO RDTSVSDF JOWNER=DVRLL,JQUEUE=ST,ODSN=DVRLL.SDSF.TEST
}
}______________________________________________________________________
}______________________________________________________________________
}
} The output dataset will have an INDEX member that describes
} each of the members saved.
}
} The output dataset name will be displayed at exit
} the
)Proc
)End
-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On Behalf Of Jake Anderson
Sent: Wednesday, April 27, 2016 10:38 AM
To: TSO-***@VM.MARIST.EDU
Subject: Rexx to Copy all the Job output
Hello,
I am looking for a help on sample REXX exec which can copy all the Job submitted by particular Owner to a Dataset ?
Does anyone has a similar Exec running and willing to Share the Logic ?
Regards,
Jake
----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions, send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX