/* REXX */ /* */ /* AUTHOR: Mark Zelden November 1995 */ /* */ /* Trace ?r */ /*************************************************************/ /* Since REXX can not read spanned records, the SMF file */ /* needs to be re-formatted from RECFM=VBS to RECFM=VB */ /* using the following sample JCL. The extract step is */ /* optional but can be used to limit the amount of data */ /* passed to the REXX program. */ /* */ /* */ /* //MYJOB JOB (ACCT),CLASS=M,MSGCLASS=H */ /* //EXT30 EXEC PGM=IFASMFDP */ /* //SYSPRINT DD SYSOUT=* */ /* //DUMPIN DD DISP=SHR,DSN=TECH.SYSA.SMFDAILY(-0) */ /* //*DUMPIN DD DISP=SHR,DSN=SYS1.MAN1 */*/ /* //DUMPOUT DD UNIT=SYSDA, */ /* // SPACE=(CYL,(30,30),RLSE), */ /* // DISP=(,PASS,DELETE), */ /* // DSN=&&SMF30 */ /* //SYSIN DD * */ /* INDD(DUMPIN,OPTIONS(DUMP)) */ /* OUTDD(DUMPOUT,TYPE(30)) */ /* /* */*/ /* //REBLK EXEC PGM=IDCAMS */ /* //SYSPRINT DD SYSOUT=* */ /* //SYSUDUMP DD SYSOUT=* */ /* //IN DD DSN=&&SMF30,DISP=(OLD,DELETE) */ /* //OUT DD DSN=hlq.RXSMF30.INPUT,DISP=(,CATLG), */ /* // UNIT=SYSALLDA,SPACE=(CYL,(15,15),RLSE), */ /* // DCB=(RECFM=VB,BLKSIZE=32760) */ /* //SYSIN DD * */ /* REPRO INFILE(IN) OUTFILE(OUT) */ /* /* */*/ /* // */ /*************************************************************/ /* SAMPLE EXECUTION JCL: */ /* */ /* //MYJOB JOB (ACCT),CLASS=M,MSGCLASS=H */ /* //JS010 EXEC PGM=IRXJCL,PARM='RXSMF30' */ /* //SYSTSIN DD DUMMY */ /* //SYSTSPRT DD SYSOUT=* */ /* //SYSEXEC DD DSN=REXX.EXEC.LIBRARY,DISP=SHR */ /* //SMF DD DSN=hlq.RXSMF30.INPUT,DISP=SHR */ /* //RPT DD SYSOUT=*, */ /* // DCB=(LRECL=133,BLKSIZE=3990,RECFM=FBA) */ /*************************************************************/ /* Initialize counters and run date. */ /*************************************************************/ RECNUM = 1 /* current record number */ PAGENUM = ' 1' /* page number count */ MAXLINES= 55 /* max lines per page */ TOTAL = 0 /* count of o/p records */ TOTSCRM = 0 /* tot scr tape mnts */ TOTIPM = 0 /* tot input tape mnts */ TOTMNTS = 0 /* total tape mounts */ DATEA = Date('W') /* day of week */ DATEB = Date('M') /* month */ DATEC = Substr(Date('N'),1,2) /* day of month */ DATED = Substr(Date('N'),8,4) /* year */ DATERUN = DATEA', 'DATEB' 'DATEC', 'DATED Upper DATERUN /*************************************************************/ /* Begin reading smf file */ /*************************************************************/ do forever "EXECIO 1 DISKR SMF" RECNUM if RECNUM = 1 then if rc <> 0 then exit 12 /* SMF not allocated or i/o error */ if rc <> 0 then leave /* no more records - exit */ RECNUM = RECNUM + 1 parse pull INREC /*********************************************************************/ RECTYPE = Substr(INREC,2,1) /* smf record type */ if C2d(RECTYPE) <> 30 then iterate /* chk for type(30) */ SUBTYPE = Substr(INREC,19,2) /* smf record subtype */ if C2d(SUBTYPE) <> 4 then iterate /* chk for subtype(4) */ IDENTOFF = Substr(INREC,29,4) /* offset to identification sect*/ IDENTOFF = C2d(IDENTOFF) - 3 /* cvrt to dec & adj for rdw */ COMPOFF = Substr(INREC,45,4) /* offset to completion section */ COMPOFF = C2d(COMPOFF) - 3 /* cvrt to dec & adj for rdw */ ETIME = Substr(INREC,3,4) /* run time in hex */ ETIME = C2d(ETIME) /* convert to decimal */ ETIME = Left(ETIME,5) /* seconds since midnight */ HOURS = Trunc(ETIME/3600) /* hours since midnight */ HOURS = Right(HOURS,2,'0') /* ensure 2 digit hour */ SECTOT = Trunc(ETIME-(HOURS*3600)) /* seconds since midnight */ MINS = Trunc(SECTOT/60) /* minutes past the hour */ MINS = Right(MINS,2,'0') /* ensure 2 digit minutes */ SECS = SECTOT-(MINS*60) /* seconds past the minute */ SECS = Right(SECS,2,'0') /* ensure 2 digit seconds */ TIME = HOURS||':'||MINS||':'||SECS /* time in HH:MM:SS format */ EDATE = Substr(INREC,7,4) /* run date in packed dec */ EDATE = C2x(EDATE) /* convert to character */ EDATE = Left(EDATE,7) /* chop off packed sign "F" */ EDATE = Right(EDATE,5) /* chop off leading zeros */ JOBNAME = Substr(INREC,IDENTOFF,8) /* jobname */ PROGNAME = Substr(INREC,IDENTOFF+8,8) /* program name */ STEPNAME = Substr(INREC,IDENTOFF+16,8) /* step name */ JESID = Substr(INREC,IDENTOFF+32,8) /* JES job identifier */ /*IF JESIDSV = JESID then JOBNAME = ''*/ /* same as last job? */ /* Else JESIDSV = JESID */ /* no, don't clear jobname */ CLS = Substr(INREC,IDENTOFF+42,1) /* job class (jobs only) */ STEPIND = Substr(INREC,COMPOFF+2,1) /* step term indicator */ CHKIND7 = C2d(Bitand(STEPIND,'01'x)) /* chk for x '01' (bit 7) */ if CHKIND7 >= 1 then RTCD = 'FLUSH' /* bit on - step flushed */ else do /* bit off -step not flushed*/ CHKIND6 = C2d(Bitand(STEPIND,'02'x)) /* check for x'02' (bit 6) */ if CHKIND6 >= 2 then do /* bit on - step abended */ CODEIND = Substr(INREC,COMPOFF,1) /* code indicator */ CHKCODE1 = C2d(Bitand(CODEIND,'80'x)) /* check high order bit */ if CHKCODE1 >= 128 then do /* bit on - user abend */ RTCD = Substr(INREC,COMPOFF,2) /* user abend code */ RTCD = C2d(RTCD) -32768 /* convert to decimal */ RTCD = Right(RTCD,4,'0') /* pad with zeros */ RTCD = 'U'||RTCD /* abend is UNNNN */ end else do RTCD = Substr(INREC,COMPOFF,2) /* system abend code */ RTCD = C2x(RTCD) /* convert to character */ RTCD = Right(RTCD,3,'0') /* pad with zeros */ RTCD = 'S'||RTCD /* abend is SNNN */ end end else do /* bit off - normal end of step */ RTCD = Substr(INREC,COMPOFF,2) /* step completion code */ RTCD = C2d(RTCD) /* convert to decimal */ if RTCD >9999 then nop else RTCD = Right(RTCD,4,'0') /* pad with zeros - RC = NNNN */ end end /*******************************************************************/ /* Start of filter records section */ /*******************************************************************/ /* */ /* Add code here to select or exclude records based on SID, */ /* JESID, JOBNAME, STEPNAME, PROGNAME, CLS or RTCD. */ /* */ /* EXAMPLES: */ /* */ /* if PROGNAME <> 'SORT' then iterate */ /* if RTCD = '0000' | RTCD = 'FLUSH' then iterate */ /* if RTCD <> 'S0C1' & RTCD <> 'U0020' then iterate */ /* if JOBNAME <> 'OPSMFDMP' | PROGNAME <>'SMFDUMP' then iterate */ /* */ /*******************************************************************/ /* End of filter records section */ /*******************************************************************/ NUMOPR = Substr(INREC,91,2) /* number of operator sections */ NUMOPR = C2d(NUMOPR) /* cvrt to dec */ If NUMOPR <> 0 then do OPROFF = Substr(INREC,85,4) /* offset to operator section */ OPROFF = C2d(OPROFF) - 3 /* cvrt to dec & adj for rdw */ NTAPMNTS = Substr(INREC,OPROFF+8,4) /* non-specific tape mnts */ NTAPMNTS = C2d(NTAPMNTS) /* make printable */ TOTSCRM = TOTSCRM + NTAPMNTS /* add number to total */ STAPMNTS = Substr(INREC,OPROFF+12,4) /* specific tape mnts */ STAPMNTS = C2d(STAPMNTS) /* make printable */ TOTIPM = TOTIPM + STAPMNTS /* add number to total */ End if TOTAL = 0 then call PUT_HEADING /* write page heading */ if LINECNT = MAXLINES then call PUT_HEADING call PUT_REC /* write output record */ end /* Do forever */ /******************************************/ /* Done with processing - write totals */ /******************************************/ RECNUM = Right(RECNUM-1,7,'0') TOTAL = Right(TOTAL,7,'0') TOTSCRM = Right(TOTSCRM,7,'0') TOTIPM = Right(TOTIPM,7,'0') TOTMNTS = Right(TOTSCRM+TOTIPM,7,'0') HEAD1 = '1'DATERUN||' '||COMPANY||' ', ' PAGE 'PAGENUM HEAD2 = '0 ', ' SMF JOB ACCOUNTING REPORT - TOTALS' TOT1 = ' ' TOT2 = ' 'RECNUM' RECORDS WERE READ' TOT3 = ' 'TOTAL' RECORDS WERE SELECTED FOR OUTPUT' TOT4 = ' ' TOT5 = ' 'TOTSCRM' SCRATCH TAPE MOUNTS' TOT6 = ' 'TOTIPM' INPUT TAPE MOUNTS' TOT7 = ' 'TOTMNTS' TOTAL TAPE MOUNTS' queue HEAD1 queue HEAD2 queue TOT1 queue TOT1 queue TOT1 queue TOT2 queue TOT3 queue TOT4 queue TOT5 queue TOT6 queue TOT7 "EXECIO * DISKW RPT" /******************************************/ /* close files and exit */ /******************************************/ queue '' "EXECIO * DISKW RPT (FINIS" "EXECIO 0 DISKR SMF (FINIS" Exit 0 /******************************************/ /* page heading sub-routine */ /******************************************/ PUT_HEADING: COMPANY = 'M A R K Z E L D E N A B C C O M P A N Y, I N C.' HEAD1 = '1'DATERUN||' '||COMPANY||' ', ' PAGE 'PAGENUM HEAD2 = '0 ', ' SMF JOB ACCOUNTING REPORT' HEAD3 = '0 ', ' JOB STEP PROGRAM JES JOB', ' COMP SYS END END SCR I/P' HEAD4 = ' ', ' NAME NAME NAME IDENT CLS', ' CODE ID DATE TIME MNT MNT' HEAD5 = ' ' queue HEAD1 queue HEAD2 queue HEAD3 queue HEAD4 queue HEAD5 "EXECIO * DISKW RPT" LINECNT = 7 /* The "0" ANSI chars above - skip a line, counts as 2 */ PAGENUM = PAGENUM + 1 PAGENUM = Right(PAGENUM,3,' ') return /******************************************/ /* write output record sub-routine */ /******************************************/ PUT_REC: SID = Substr(INREC,11,4) OUTREC = '' OUTREC = Overlay(JOBNAME,OUTREC,17) OUTREC = Overlay(STEPNAME,OUTREC,28) OUTREC = Overlay(PROGNAME,OUTREC,39) OUTREC = Overlay(JESID,OUTREC,50) OUTREC = Overlay(CLS,OUTREC,62) OUTREC = Overlay(RTCD,OUTREC,67) OUTREC = Overlay(SID,OUTREC,75) OUTREC = Overlay(EDATE,OUTREC,82) OUTREC = Overlay(TIME,OUTREC,90) OUTREC = Overlay(NTAPMNTS,OUTREC,101) OUTREC = Overlay(STAPMNTS,OUTREC,106) queue OUTREC "EXECIO * DISKW RPT" TOTAL = TOTAL + 1 LINECNT = LINECNT + 1 return