Posted by Jim Walker on July 22, 2008 at 11:47:09:
In Reply to: Re: Snap output of a running stc posted by Doug Oliverio on July 21, 2008 at 08:53:06:
Here is a very simple CLIST. You specify the JOBNAME of a running task as a parm. The output is written to DDNAME as specified by the DDNAME parm. The default DDNAME is OUTPUT. Each time the clist is run, it saves an index pointer so that the next time you start snapping at the last line of the previous run.
Just copy the clist below to a SYSPROC library, run IJKEFT01 and point SYSPROC to this library. Don't forget to specify an OUTPUT DD statement to define your target data set.
PROC 1 JOBNAME DDNAME(OUTPUT) TEST
/* */
/* Clist to capture the LOG data set for a */
/* running task. Save a resume entry point */
/* so that on re-entry the capture can start */
/* at the previous end point. Output is saved */
/* in a DDNAME as specified by the DDNAME */
/* parameter. Default DDNAME is OUTPUT. */
/* */
CONTROL END(ENDO)
IF &TEST = TEST THEN CONTROL LIST CONLIST
IOF &JOBNAME RUNNING JOBLIST CLIST
NOFLUSH
1 VIEW /* Use old index if available */
IF &LASTCC EQ 0 THEN DO
LOCATE RESUME
ENDO
ELSE DO
1 SELECT /* Select the LOG data set */
ENDO
SD $DDNAME$(&DDNAME)
IF &LASTCC NE 0 THEN WRITE SD RETURN CODE &LASTCC
SNAP 999 PAGES
SNAPCLOS
DOWN MAX
DOWN
UP 1
DEFENTRY RESUME /* Define the re-entry point */
SAVEINDX /* Save the index for re-entry */
JUMP X /* Exit IOF */