Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions endevor/Field-Developed-Programs/Miscellaneous-items/Logging.jcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//*-------------------------------------------------------------------*
//*---- Include this step in a job to capture job outputs ------------*
//*-------------------------------------------------------------------*
//LOGRESLT EXEC PGM=IKJEFT1B,
// PARM='LOGGING' &SYSJOBNM
//SYSTSIN DD DUMMY
//LOGGING DD DSN=&SYSUID..LOGGING.&SYSJOBNM..&SYSJOBID,
// DISP=(MOD,CATLG,KEEP),
// UNIT=3390,SPACE=(CYL,(1,05)),
// DCB=(RECFM=FBA,LRECL=133,BLKSIZE=0)
//SYSEXEC DD DISP=SHR,DSN=Your.CLSTREXX
//SHOWME DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//*==================================================================*
137 changes: 137 additions & 0 deletions endevor/Field-Developed-Programs/Miscellaneous-items/Logging.rex
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
/* REXX */
Arg debug
trace O
JobName = MVSVAR('SYMDEF',JOBNAME ) /*Returns JOBNAME */
/**********************************************************************
*
* Capture outputs for the active job
*
* SDSF RGEN Generated EXEC
*
* Operation =
*
* - Access primary panel DA
* - Invoke browse
*
**********************************************************************/
rc=isfcalls('ON')
if debug<>"" then /* If debug mode */
verbose="VERBOSE" /* .. use SDSF verbose mode */
else
verbose=""
/*----------------------------------------------*/
/* Configure environment with special variables */
/*----------------------------------------------*/
isfprefix='*' /* Corresponds to PREFIX command */
isfprefix=JobName
isfowner=USERID()'*' /* Corresponds to OWNER command */
isfsysname='' /* Corresponds to SYSNAME command */
isfdest=' ' || , /* Dest name 1 */
' ' || , /* Dest name 2 */
' ' || , /* Dest name 3 */
' ' /* Dest name 4 */
/* Access the DA panel */
Address SDSF "ISFEXEC 'DA' (" verbose ")"
lrc=rc
call msgrtn "ISFEXEC 'DA'" /* List messages */
if lrc<>0 then /* If command failed */
do
Say "** ISFEXEC failed with rc="lrc"."
exit 20
end
call colsrtn isfrows "." sdsfocols /* List all rows and columns */
isflinelim = 1000
/*--------------------*/
/* Loop for all lines */
/*--------------------*/
do until isfstartlinetoken=''
/*--------------------------------------------------------------*/
/* Issue ISFBROWSE for the row identified by the token variable */
/*--------------------------------------------------------------*/
Address SDSF "ISFBROWSE 'DA' TOKEN('"TOKEN.1"') (" verbose ")"
lrc=rc
call msgrtn "ISFBROWSE" /* List messages associated with request */
if lrc<>0 then /* If request failed */
do
Say "** ISFBROWSE failed with rc="lrc"."
Exit 20
end
isfstartlinetoken=isfnextlinetoken /* Set up for next request */
/*---------------------*/
/* List returned lines */
/*---------------------*/
"EXECIO * DISKW LOGGING (Stem isfline. finis"
/*
do lineix=1 to isfline.0 /* Loop for all lines returned */
say isfline.lineix
end
*/
end
rc=isfcalls('OFF')
Exit 0
/**********************************************************************
*
* NAME =
* msgrtn
*
* FUNCTION =
* List all messages in the isfmsg and isfmsg2. variables
*
* INPUT =
* req - Request being processed
*
* EXPOSED VARIABLES =
* isfmsg - Short message
* isfmsg2. - Numbered messages
*
* OUTPUT =
* Messages written to terminal
*
**********************************************************************/
msgrtn: Procedure expose isfmsg isfmsg2.
Arg req
/*---------------------------*/
/* Process numbered messages */
/*---------------------------*/
Say "** Numbered messages associated with" req "follow ..."
do ix=1 to isfmsg2.0
Say isfmsg2.ix
end
if isfmsg<>"" then /* If short message present */
do
Say "** Short message associated with the request is:" isfmsg
end
return
/**********************************************************************
*
* NAME =
* colsrtn
*
* FUNCTION =
* List all rows and their column values
*
* INPUT =
* numrows - number of rows to process
* pfx - column variable prefix or "." if none
* ocols - word delimited column names to process
*
* EXPOSED VARIABLES =
* None
*
* OUTPUT =
* Responses written to terminal
*
**********************************************************************/
colsrtn:
Arg numrows pfx ocols
Say "Number of rows to process: " numrows
do rowix=1 to numrows /* Loop for all rows */
Say "Now processing row" rowix "..."
do colix=1 to words(ocols) /* Loop for all columns */
if pfx="." then /* If no prefix */
pfx=""
varname=pfx||word(ocols,colix)||'.'||rowix
Say " Column" varname '=' value(varname)
end /* For all columns */
end /* For all rows */
return
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* REXX */
/* Capture outputs produced by the active job, and write them */
/* to the LOGGING ddname */
Trace O
delstack
MyJobName = MVSVAR('SYMDEF',JOBNAME ) /*Returns JOBNAME */

rc = ejesrexx('initapi')
queue "status;sreset;jname myjob" MyJobName";DA"
queue "showcols jobname jobid records"
queue ""
address ejes "execapi (prefix JOB_" /* Invoke HOLD */

do jobrow=1 to JOB_Lines
address ejes "execapi 0 'locate" jobrow "' (prefix JOB_"
say "Processing " JOB_JobName"("JOB_JobId")"
dsn = JOB_JobName"."JOB_JobId".workfile"
address ejes "execapi 0 ':ed' (prefix EX_"
if EX_FunName = "EXTRACT" then,
do
address ejes "execapi 0 ':<"dsn"><><><><><><><><CYL><10><10><*>'"
if word(EJES_Msg.1,1) = "EJES162" then,
do
rc=bpxwdyn("alloc dd(wkf)",
"da("sysvar(syspref)"."dsn") old reuse")
"execio * diskr" wkf "(stem" spool. "open finis)"
"execio * diskw" LOGGING "(stem" spool.
rc=bpxwdyn("free dd(wkf)")
say "Read " spool.0 "records from job"
"delete" dsn
end
end
end /* jobrow */
ejesrc = ejesrexx('termapi')
exit

18 changes: 18 additions & 0 deletions endevor/Field-Developed-Programs/Miscellaneous-items/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,24 @@ Returns the Job Accounting code for the job currently running. Example call:

The routine is useful if your job submits another job, and needs to keep the accounting code the same for both jobs.

## LOGGING

You can capture outputs for a running job by including a step like this one in the JCL.


/// IF (RC > 08) THEN
//LOGRESLT EXEC PGM=IKJEFT1B,PARM='LOGGING'
//SYSTSIN DD DUMMY
//LOGGING DD DSN=&SYSUID..LOGGING.&SYSJOBNM..&SYSJOBID,
// DISP=(MOD,CATLG,KEEP),
// UNIT=3390,SPACE=(CYL,(1,05)),
// DCB=(RECFM=FBA,LRECL=133,BLKSIZE=0)
//SYSEXEC DD DISP=SHR,DSN=Your.Rexxlib
//SYSTSPRT DD SYSOUT=*
// ENDIF

You can log the outputs, scan them, email them, or do whatever you need to do.

## WTO#MSG


Expand Down
Loading