From 02c0a11ae0c031de6a9f534e339a5b773e85c3e2 Mon Sep 17 00:00:00 2001 From: Joseph Walther Date: Thu, 30 Jul 2026 13:32:10 -0500 Subject: [PATCH 1/3] Job-Logging --- .../Miscellaneous-items/Logging.jcl | 15 ++ .../Miscellaneous-items/Logging.rex | 137 ++++++++++++++++++ 2 files changed, 152 insertions(+) create mode 100644 endevor/Field-Developed-Programs/Miscellaneous-items/Logging.jcl create mode 100644 endevor/Field-Developed-Programs/Miscellaneous-items/Logging.rex diff --git a/endevor/Field-Developed-Programs/Miscellaneous-items/Logging.jcl b/endevor/Field-Developed-Programs/Miscellaneous-items/Logging.jcl new file mode 100644 index 0000000..535455f --- /dev/null +++ b/endevor/Field-Developed-Programs/Miscellaneous-items/Logging.jcl @@ -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=* +//*==================================================================* \ No newline at end of file diff --git a/endevor/Field-Developed-Programs/Miscellaneous-items/Logging.rex b/endevor/Field-Developed-Programs/Miscellaneous-items/Logging.rex new file mode 100644 index 0000000..02b12f8 --- /dev/null +++ b/endevor/Field-Developed-Programs/Miscellaneous-items/Logging.rex @@ -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 From e6135d3fdc1c8a78bfbd86daff1f79a54d75fb9c Mon Sep 17 00:00:00 2001 From: Joseph Walther Date: Thu, 30 Jul 2026 18:47:41 -0500 Subject: [PATCH 2/3] Create Logging.rex EFES version.txt --- .../Logging.rex EFES version.txt | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 endevor/Field-Developed-Programs/Miscellaneous-items/Logging.rex EFES version.txt diff --git a/endevor/Field-Developed-Programs/Miscellaneous-items/Logging.rex EFES version.txt b/endevor/Field-Developed-Programs/Miscellaneous-items/Logging.rex EFES version.txt new file mode 100644 index 0000000..2902fda --- /dev/null +++ b/endevor/Field-Developed-Programs/Miscellaneous-items/Logging.rex EFES version.txt @@ -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"><><><><><><><><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 + \ No newline at end of file From 9180f005e72551191b1209b9842dd0f19fe09d82 Mon Sep 17 00:00:00 2001 From: Joseph Walther Date: Mon, 3 Aug 2026 08:46:35 -0500 Subject: [PATCH 3/3] Update README.md --- .../Miscellaneous-items/README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/endevor/Field-Developed-Programs/Miscellaneous-items/README.md b/endevor/Field-Developed-Programs/Miscellaneous-items/README.md index ea1bbe8..8dc37d1 100644 --- a/endevor/Field-Developed-Programs/Miscellaneous-items/README.md +++ b/endevor/Field-Developed-Programs/Miscellaneous-items/README.md @@ -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