/* REXX */ /* */ /* AUTHOR: Mark Zelden */ /* */ /* Trace ?r */ /*********************************************************************/ /* EXEC: SDSF@DR */ /* */ /* FUNCTION: To take all the output in the spool at DR and copy it */ /* to data sets via SDSF "PRINT" command. */ /* */ /*********************************************************************/ /* EXECUTION SYNTAX: */ /* SDSF@DR volser jobname_mask hlq storclas */ /* */ /* No parms are required but in order to use the 2nd parm, */ /* the first one must be specified. In order to use the 3rd */ /* parm, the first and second ones must be specified, and so on. */ /* */ /* DEFAULTS: */ /* SDSF@DR DRWRK1 * TECH (no storclas used) */ /* */ /* EXAMPLES: */ /* */ /* SDSF@DR */ /* (O/P to DRWRK1, select all jobs, HLQ of TECH no STORCLAS) */ /* */ /* SDSF@DR DRWRK2 */ /* (O/P to DRWRK2) */ /* */ /* SDSF@DR DRWRK1 MYJOBS* */ /* (O/P to DRWRK2, only select "MYJOBS*") */ /* */ /* SDSF@DR DRWRK1 MYJOBS* SYSDR */ /* (O/P to DRWRK2, select "MYJOBS*", HLQ of SYSDR) */ /* */ /* SDSF@DR DRWRK1 MYJOBS* SYSDR NONSMS */ /* (O/P to DRWRK1, select "MYJOB*", HLQ of SYSDR, STORCLAS=NONSMS) */ /* */ /* */ /* Sample JCL to execute in batch: */ /* */ /* //MYJOB JOB (ACCT),CLASS=A,... */ /* //S1 EXEC PGM=IRXJCL,PARM='SDSF@DR' */ /* //*S1 EXEC PGM=IRXJCL,PARM='SDSF@DR DRWRK2' */*/ /* //*S1 EXEC PGM=IRXJCL,PARM='SDSF@DR DRWRK1 MYJOBS*' */*/ /* //*S1 EXEC PGM=IRXJCL,PARM='SDSF@DR DRWRK1 MYJOBS* SYSDR' */*/ /* //*S1 EXEC PGM=IRXJCL,PARM='SDSF@DR DRWRK1 MYJOBS* SYSDR NONSMS'*/*/ /* //SYSTSIN DD DUMMY */ /* //SYSTSPRT DD SYSOUT=* */ /* //SYSEXEC DD DSN=pds.with.this.exec,DISP=SHR */ /* */ /* */ /* Output data set names will be in the format of: */ /* hlq.DR.smfid.jobname.JOBnnnnn.Yyyyy.Dnnn */ /* hlq.DR.smfid.jobname.STCnnnnn.Yyyyy.Dnnn */ /* */ /* Example: */ /* TECH.DR.SYSA.SYSLOG.STC00002.Y2019.D240 */ /* */ /*********************************************************************/ /* Updates: */ /* */ /* 10/12/2018: Check for "*BOTTOM OF DATA REACHED*" as a normal */ /* message from XDC and not display it as an error. */ /* */ /* 08/28/2019: Change the "ST" panel invocation from */ /* Address SDSF "ISFEXEC ST (DELAYED ALTERNATE)" */ /* to */ /* Address SDSF "ISFEXEC ST (DELAYED)" */ /* in case no alternate panel is defined. By */ /* default both primary and alternate fields are */ /* merged if an alternate exists anyway. */ /* */ /*********************************************************************/ Arg outvol isfprefix hlq storclas . /**********************************************/ /* House keeping */ /**********************************************/ If outvol = '' then isfprtvolser = 'DRWRK1' /* dflt output volume */ If isfprefix = '' then isfprefix = '*' /* jobs to process */ If hlq = '' then hlq = 'TECH' /* o/p dsns HLQ */ If storclas = '' then nop /* o/p dsns STORCLAS */ smfid = MVSVAR('SYSSMFID') /* SMFID */ tot_failed = 0 /* total # of jobs that failed and can't be printed */ /**********************************************/ /* Start of main code */ /**********************************************/ Say 'SDSF@DR processing parameters used for this run:' Say ' Output volume =' outvol If isfprefix = '*' then , Say ' Jobs to process = (all jobs will be processed)' Else , Say ' Jobs to process =' isfprefix Say ' HLQ of output data sets =' hlq If storclas = '' then , Say ' SMS STORCLAS = (none specified)' Else , Say ' SMS STORCLAS =' storclas Say ' ' /* blank line to make more readable */ rc=isfcalls('ON') /*************************/ /* Access the ST display */ /*************************/ isfsort = 'JNAME A JOBID A' /* sort / process in jobname order */ Address SDSF "ISFEXEC ST (DELAYED)" /* ST command */ Drop jname. /* get rid of results from first time */ Address SDSF "ISFEXEC ST (DELAYED)" /* may not catch the */ /* batch job running this if not issued a 2nd time */ lrc=rc call msgrtn if lrc<>0 then exit 20 /**********************************************************/ /* 1st loop to display all jobs returned via "ST" command */ /**********************************************************/ Say 'The following' jname.0 'jobs were returned from the "ST"' , 'command and will be processed:' do dis_jobs=1 to jname.0 Say ' ' Left(jname.dis_jobs,8) ' ' jobid.dis_jobs end Say ' ' Say ' ' Say ' ' /**********************************************************/ /* 2nd loop to print all jobs returned via "ST" command */ /**********************************************************/ Say 'Processing jobs ...' Say ' ' do ix=1 to jname.0 call Setup_print_vars Say 'Attempting to print output to DSN=' || , Strip(Translate(isfprtdsname,"","'")) /* remove quotes */ /******************************************/ /* Issue the XDC action against the job */ /******************************************/ Address SDSF "ISFACT ST TOKEN('"TOKEN.ix"') PARM(NP XDC)" lrc=rc call msgrtn /* if lrc<>0 then exit 20 */ end /* end do ix=1 */ rc=isfcalls('OFF') Say ' ' Say ' ' Say ' ' Say '***********************************' Say ' Program totals' Say ' ' Say ' Total JOBs processed =' jname.0 Say ' Total JOBs printed =' jname.0 - tot_failed Say ' Total JOBs failed =' tot_failed Say '***********************************' exit 0 /**********************************************/ /* End of main code */ /**********************************************/ /*============================================*/ /* S U B R O U T I N E S */ /*============================================*/ /*************************************/ /* Subroutine to list error messages */ /*************************************/ msgrtn: procedure expose isfmsg isfmsg2. tot_failed jname. jobid. ix /************************************************/ /* The isfmsg variable contains a short message */ /************************************************/ if isfmsg = '' | Strip(isfmsg) = 'PRINT CLOSED' , | Strip(isfmsg) = '*BOTTOM OF DATA REACHED*' , then nop /* normal messages from print */ else do Say ' ** Error processing' jname.ix jobid.ix Say ' **' isfmsg tot_failed = tot_failed + 1 /* add 1 to failed total */ /****************************************************/ /* The isfmsg2 stem contains additional descriptive */ /* error messages */ /****************************************************/ /* do ix=1 to isfmsg2.0 Say "isfmsg2."ix "is:" isfmsg2.ix end */ end return /**********************************************************************/ /* Setup required vars for printing */ /**********************************************************************/ Setup_print_vars: isfprtblksize = '0' /* default 3120 */ isfprtdisp = 'NEW' /***********************************************************/ /* Output data set names will be in the format of: */ /* hlq.DR.smfid.jobname.JOBnnnnn.Yyyyy.Dnnn */ /* hlq.DR.smfid.jobname.STCnnnnn.Yyyyy.Dnnn */ /* Example: */ /* TECH.DR.SYSA.SYSLOG.STC00002.Y2010.D088 */ /***********************************************************/ isfprtdsname = "'"hlq".DR."smfid"."jname.ix"."jobid.ix"." || , "Y"substr(dater.ix,1,4)".D"substr(dater.ix,6,3)"'" isfprtlrecl = '255' /* default 240 */ isfprtprimary = '4500' /* default 500 */ isfprtrecfm = 'VBA' /* default VBA */ isfprtsecondary = '4500' /* default 500 */ isfprtspacetype = 'TRKS' /* default BLKS */ isfprtmember = '' /* isfprtdirblks = '' */ /* isfprtdataclas = '' */ isfprtunit = 'SYSALLDA' isfprtvolser = outvol /* passed via ARG or dflt set at top */ isfprtstorclas = storclas /* passed via ARG or dflt set at top */ return