I believe your original email said:
>>A job step wants to use the Rexx SDSF interface to read SYSOUT from a
>>previous step.
>>
>>Question: How can the job get its own job ID (e.g. JOB12345)?
>>SYSVARS? MVSVARS? Other? (I'd prefer not to chase control
>>blocks.)
This strongly suggests batch... Whether you are using the USS API's or not.
If your requirements were different, you should have stated so.
Notwithstanding, here is an example of using the SDSF/REXX API to read the
JOBLOG. The same logic can be used to select the job with a '?' to split
out the SYSOUT's then select the desired SYSOUT and read that. Sample
pseudo-logic below.
This is a Return Code checker so a job can check its own return codes in a
step towards the end of the job and provide a summary report and/or do
something. This is useful in jobs with a large number of steps where
non-zero return codes are expected (like mass recompiles/reassembles), but
it is a reasonable (and small) example of using the SDSF/REXX interface to
navigate SYSOUT's. I have never tried to run this under the Shell...
If you want to try this EXEC for the purpose it was designed for, it depends
on return codes existing in the JOBLOG (like the sample MVS exit provides).
However, the eyecatchers for this version are LOCAL eyecatchers... You will
need to find your own eyecatchers to help position the job in the JOBLOG.
/*********************************************************************/
/* REXX */
/*********************************************************************/
/* Purpose: Return Code Checker */
/*-------------------------------------------------------------------*/
/* Syntax: RCCHECK */
/*-------------------------------------------------------------------*/
/* Parms: N/A - N/A */
/* */
/*********************************************************************/
/* Change Log */
/* */
/* Author Date Reason */
/* -------- --------- ----------------------------------------- */
/* R. Zenuk Aug 2010 Initial Creation */
/* */
/*********************************************************************/
/* Set Exit Code, the number of bad steps and the current jobname */
/*********************************************************************/
EXITRC = 0
stepcount = 0
jobname = mvsvar('SYMDEF','JOBNAME')
/*********************************************************************/
/* Invoke SDSF DA */
/*********************************************************************/
if isfcalls('ON') <> 0 then exit 99
address SDSF "ISFEXEC DA"
call isferror 'ISFEXEC'
/*********************************************************************/
/* Find the current jobname */
/*********************************************************************/
do i=1 to isfrows
if jname.i = jobname then
do
/*********************************************************************/
/* Write the report heading */
/*********************************************************************/
say
say 'Steps with non-zero return codes in job' jobname jobid.i
say
/*********************************************************************/
/* Select the jobname and allocate all the output sysout datasets */
/*********************************************************************/
address SDSF "ISFACT DA TOKEN('"token.i"') PARM(NP SA)"
call isferror 'ISFACT'
/*********************************************************************/
/* Read the JOBLOG */
/*********************************************************************/
address TSO "EXECIO * DISKR" isfddname.1 "(STEM JOBLOG. FINIS"
/*********************************************************************/
/* Parse out the STEP and RC */
/*********************************************************************/
do l=1 to joblog.0
steploc = pos('#STEPNAME',joblog.l)
if steploc <> 0 then
steppos = steploc + 1
rcloc = pos(' RC ',joblog.l)
if rcloc <> 0 then
rcpos = rcloc + 1
/*********************************************************************/
/* Find the lines with the step results */
/*********************************************************************/
if left(word(joblog.l,3),1) = '#' &,
word(joblog.l,3) <> '#CHARLES' &,
word(joblog.l,3) <> '#STEPNAME' then
do
/*********************************************************************/
/* Find the non-zero steps */
/*********************************************************************/
if substr(joblog.l,rcpos,2) <> '00' then
do
/*********************************************************************/
/* Log and count */
/*********************************************************************/
say substr(joblog.l,steppos,8),
substr(joblog.l,rcpos,2)
stepcount = stepcount + 1
EXITRC = 20
end
end
end
end
end
/*********************************************************************/
/* Summarize the bad steps */
/*********************************************************************/
say
say stepcount 'steps with non-zero return codes'
say
call isfcalls 'OFF'
exit EXITRC
/*********************************************************************/
/* SDSF error conditions */
/*********************************************************************/
isferror: arg sdfscall
select
/*********************************************************************/
/* Ignorable conditions */
/*********************************************************************/
when isfmsg = '' then return
when isfmsg = 'DATA SET ALLOCATED' then return
/*********************************************************************/
/* Real errors - always RC=16 */
/*********************************************************************/
otherwise
do
say isfmsg
say
do e=1 to isfmsg2.0
say sdsfcall right(e,2)':' isfmsg2.e
end
exit 16
end
end
To select a specific SYSOUT (starting from SDSF DA)...
Address SDSF "ISFEXEC DA"
Loop and find yourself by mvsvar('SYMDEF','JOBNAME')
Select the job and displays its SYSOUT's
Address SDSF "ISFACT DA TOKEN('"token.r"') PARM(NP ?) (PREFIX $"
Loop and find you desired SYSOUT
Select the SYSOUT
Address SDSF "ISFACT DA TOKEN('"$token.s"') PARM(NP SA)"
EXECIO the SYSOUT
Continue with normal REXX activities from there.
EndLoop
EndLoop
I use a technique like this to find all our CICS regions, select 4 of the
SYSOUT's of interest and analyze their contents for alerting and automation
purposes... Unfortunately, that EXEC is very long and has lots of site
specific logic...
Rob
-----Original Message-----
From: TSO REXX Discussion List [mailto:
TSO-...@VM.MARIST.EDU] On Behalf Of
Paul Gilmartin