Go to Home Page
Questions?
Call 1-800-572-5517
 
  Go to Home Page  
  See all products
  See price schedules
  See manuals, tutorials, articles
  Download a free 30-day trial
  See user testimonials
  About Pacific Systems Group
 
 
SMF Tools
  See SMF Record Layouts
  See Sample SMF Reports
  Learn How to Export SMF Data
  Download Free SMF Reporting Software (30 days)
 
One of the greatest SMF record parsing programming languages I've ever seen. Chief, Large Systems Services Branch, NIH
  Choose Spectrum Writer to add 4GL to your product
  Report Writer Speedup Tips Article
Spectrum SMF Writer - Low-Cost 4GL Report Writer for SMF Files.

Sample DFSORT Statistics Report from SMF 16 and 30 Records

It's easy to report on SMF data!
 

SMF Spectrum Writer
We have a low-cost 4GL report writer especially for SMF files. It's called Spectrum SMF Writer.

Spectrum SMF Writer handles the difficult SMF record parsing for you automatically. You just specify which fields you want to see.

Spectrum SMF Writer also converts the arcane date and time fields and reformats them into an attractive report.

Plus Spectrum SMF Writer even exports SMF data as comma delimited files to use on your PC.
 
Try It FREE Now!


The sample SMF report below was created with Spectrum SMF Writer, the low-cost 4GL SMF report writer.

In this report, we want to show DFSORT statistics (from SMF 16 records), but only for sorts that were invoked from a program. (There is a bit in the SMF 16 record that identifies sorts invoked by a program.) We also want to include the invoking program's name in the report.

The difficulty with this report is that the program name is not included in the SMF 16 record. To get the program name in our report, we must find an SMF 30 step termination record for the same job step that produced the SMF 16 DFSORT statistics record. The SMF 30 record will include the name of the program.

That is a bit of a stretch for Spectrum SMF Writer. It is mostly intended to process one record at a time. Using data from two different records at the same takes a little extra effort. However, this example shows how you can accomplish this by using two Spectrum SMF Writer steps.

The first step selects two types of records. All SMF 16 records with the "program" bit on. And all SMF 30 subtype 4 (step termination records). For each record, we build a Job ID field. This field will be unique for each job in the SMF file. We then sort our "report" on this JOBID field. That sorts the SMF 16 and SMF 30 records for the same job together. Our secondary sort is on SMF record type (descending). That ensures that for jobs with both a 16 and a 30 record, the 30 record will come first. Now, instead of printing a report in this step, we actually output these sorted SMF records intact. We write these selected and sorted SMF records out to a temporary dataset.

Now we run the second Spectrum SMF Writer step. It reads the sorted SMF 16 and 30 records from our temporary dataset. We are only going to select the SMF 16 records for our report. (We know that any SMF 16 record in this file has the "program" bit on, since we tested for that in the first step.) For each SMF 16 record, we will write one line to our report.

However, we still need to obtain the name of the program that invoked the sort. That program name will be in the matching SMF 30 record that was read just before the corresponding SMF 16 record. So we need a way to save that program name from the SMF 30 records as they are read (and then excluded from the report). We save the program name in a field named SAVE_PGMNAME so that it remains available when we read the matching SMF 16 record that follows. We can then use this saved program name along with all of the SMF 16 record's fields to print our report line.

The special RETAIN parm of the COMPUTE statement is what enables us to save this program name from the SMF 30 record as it passes by.

As each SMF record is read, a vaslue is assigned to the SAVE_PGMNAME compute field. When the record is type 30, we assign the value of that SMF 30 record's program name field (SMF30PGM). (However, we do not include this SMF 30 record in the report.) When the record is not 30 (meaning that it must be type 16), we do not assign a new value to the compute field. Instead, we "retain" the value that it was assigned for the previous 30 record (as long as the jobid's match.) Then we include this SMF 16 record in our report. And now we also have the retained program name (from the previous type 30 record) available to include in the report line, along with all of the fields from the SMF 16 record.

All of this with just a few lines of code!
Why not install a Spectrum SMF Writer trial right now and start making your own SMF reports!

These Spectrum SMF Writer Statements:

//*=================================================================
//* THIS STEP WRITES JUST THE 16 AND 30-4 RECORDS, IN SORTED ORDER  
//*=================================================================
//STEP1 EXEC PGM=SPECTSMF,REGION=4M                                 
//STEPLIB  DD DSN=PACSYS01.SPECTSMF.LOADLIB,DISP=SHR               
//SWCOPY   DD DSN=PACSYS01.SPECTSMF.COPYLIB,DISP=SHR COPY LIBRARY  
//SWLIST DD SYSOUT=* CONTROL LISTING                                
//SWOUTPUT DD DSN=&&TEMPSMF,DISP=(,PASS),UNIT=SYSDA,                
//            SPACE=(CYL,(20,20),RLSE),                             
//            DCB=(RECFM=VB,LRECL=32752,BLKSIZE=32760)              
//SYSOUT DD SYSOUT=* SORT CONTROL LISTING                           
//SMFIN    DD DSN=IBMUSER.MYSMF01.DATA,DISP=SHR                     
//SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,(5,1))                          
//SORTWK02 DD UNIT=SYSDA,SPACE=(CYL,(5,1))                          
//SORTWK03 DD UNIT=SYSDA,SPACE=(CYL,(5,1))                          
//SYSIN DD * CONTROL STATEMENTS                                     
OPTION:     MAINFRAME               /* OUTPUT IS A MAINFRAME FILE */

*====================================================================  
* DEFINE ONE FILE WHICH HAS THE FIELDS FROM BOTH COPYBOOKS.	
*====================================================================  
FILE:       SMFIN LRECL(32767) DDNAME(SMFIN) KEEPRDW                
COPY:       REC30                                                   
COPY:       REC16                                                   

INPUT:      SMFIN                                                   
FIELD:      RECORD COL(1) LEN(32000)
*                                                                   
*====================================================================  
* MAKE A UNIQUE JOBID FIELD, USING JOBNAME, READER TIMESTAMP, STEPNUM
*====================================================================  
COMPUTE:    JOBID   =           /* MAKE UNIQUE, CHAR-FORMAT JOBID */   
            WHEN(SMF30RTY = 30)                                        
                ASSIGN(SMF30JBN                                        
                + #FORMAT(SMF30RSD, YYYY-MM-DD)                        
                + #FORMAT(SMF30RST, HH-MM-SS)                          
                + #FORMAT(SMF30STN, PIC'999') )                        
            WHEN(SMF16RTY = 16)                                        
                ASSIGN(SMF16_ICEJOBNM                                  
                + #FORMAT(SMF16_ICERDS, YYYY-MM-DD)                    
                + #FORMAT(SMF16_ICERST, HH-MM-SS)                      
                + #FORMAT(SMF16_ICESTN, PIC'999') )   
                 
*====================================================================  
* EXTRACT JUST THE "PROGRAM" BIT FROM A FLAG FIELD
*====================================================================  
COMPUTE:    PGMBIT = #SUBSTR(#FORMAT(SMF16_ICEFLBYT,BITS),6,1)         
*                                                                      
*====================================================================  
* INCLUDE ALL 30-4 RECORDS, AND 16 RECORD WITH THE PROGRAM BIT ON
*====================================================================  
INCLUDEIF:  (SMF30RTY=30 AND SMF30STP = 4)   /* SMF 30 STEP TERM RECS */
             OR (SMF16RTY=16 AND PGMBIT='1') /* SMF 16 W/ PGM BIT */   
*                                                                      
*====================================================================  
* OUTPUT IS JUST THE WHOLE RECORD (AS MUCH OF IT AS WE NEED)
*====================================================================  
COLUMNS:    RECORD      /* COPY THE WHOLE 30 OR 16 RECORD */           
*                                                                      
*====================================================================  
* SORT SO THAT THE 16 AND 30 RECS FOR THE SAME JOB/STEP ARE TOGETHER.  
* WE WANT THE 30 RECORD TO COME BEFORE ITS MATCHING 16 RECORD.         
*====================================================================  
SORT:       JOBID SMF30RTY(DESC)                                       
*                                                                      
//*=================================================================
//* READ FILE OF SORTED, 30 AND 16 RECORDS. PRINT REPORT                
//*=================================================================
//STEP2 EXEC PGM=SPECTSMF,REGION=4M                                 
//STEPLIB  DD DSN=PACSYS01.SPECTSMF.LOADLIB,DISP=SHR               
//SWCOPY   DD DSN=PACSYS01.SPECTSMF.COPYLIB,DISP=SHR COPY LIBRARY  
//SWLIST DD SYSOUT=* CONTROL LISTING                                
//SWOUTPUT DD SYSOUT=* REPORT                                       
//SYSOUT DD SYSOUT=* SORT CONTROL LISTING                           
//SMFIN    DD DSN=&&TEMPSMF,DISP=(SHR,PASS)                         
//SYSIN DD * CONTROL STATEMENTS                                     
OPTION:     NOGRANDTOTALS DATEDELIM('-')                            

FILE:       SMFIN LRECL(32767) DDNAME(SMFIN) KEEPRDW                
COPY:       REC30                                                   
COPY:       REC16                                                   

INPUT:      SMFIN                                                   
                                                                   
COMPUTE:    JOBID   =           /* MAKE UNIQUE, CHAR-FORMAT JOBID */
            WHEN(SMF30RTY = 30)                                     
            ASSIGN(SMF30JBN                                         
            + #FORMAT(SMF30RSD, YYYY-MM-DD)                         
            + #FORMAT(SMF30RST, HH-MM-SS)                           
            + #FORMAT(SMF30STN, PIC'999') )                         
            WHEN(SMF16RTY = 16)                                     
            ASSIGN(SMF16_ICEJOBNM                                   
            + #FORMAT(SMF16_ICERDS, YYYY-MM-DD)                     
            + #FORMAT(SMF16_ICERST, HH-MM-SS)                       
            + #FORMAT(SMF16_ICESTN, PIC'999') )                     
*                                                                   
*=================================================================  
* THESE COMPUTE STMTS SAVE THE JOBID AND PGMNAME FROM SMF 30 RECS   
* AS THEY ARE READ. BUT WE DON'T INCLUDE THE 30 REC IN THE REPORT.  
*=================================================================  
COMPUTE: SAVE_JOBID30 =
          WHEN(SMF30RTY=30 AND SMF30STP=4) ASSIGN(JOBID)             
          ELSE RETAIN  /* IF NOT 30 RECORD, RETAIN OLD VALUE */ 
                 
COMPUTE: SAVE_PGMNAME =
          WHEN(SMF30RTY=30 AND SMF30STP=4) ASSIGN(SMF30PGM)          
          ELSE RETAIN  /* IF NOT 30 RECORD, RETAIN OLD VALUE */                   
*                                                                   
*=================================================================  
* WE INCLUDE ONLY SMF 16 RECS IN THE REPORT. BUT WE HAVE SAVED      
* THE JOBID AND PGMNAME FROM ITS MATCHING 30 REC (IF IT APPEARED    
* JUST BEFORE THIS 16 RECORD, LIKE IT SHOULD.)                       
*=================================================================  
INCLUDEIF:  SMF16RTY=16   /* WE KNOW THE PROGRAM BIT IS ON */        
            AND JOBID = SAVE_JOBID30  /*INCL 16 IF FOUND MATCHING 30*/
*                                                                    
*=================================================================   
* NOW WE CAN PRINT THE REPORT USING ALL FIELDS IN SMF 16, PLUS THE   
* PGMNAME THAT WE SAVED FROM THE PREVIOUS (MATCHING) 30 REC.         
*=================================================================   
COMPUTE:    E15BIT = #SUBSTR(#FORMAT(SMF16_ICEIOTYP,BITS),1,1)       
COMPUTE:    E32BIT = #SUBSTR(#FORMAT(SMF16_ICEIOTYP,BITS),2,1)       
COMPUTE:    E35BIT = #SUBSTR(#FORMAT(SMF16_ICEIOTYP,BITS),3,1)       
COMPUTE:    PGMBIT = #SUBSTR(#FORMAT(SMF16_ICEFLBYT,BITS),6,1)       
*                                                                    
COLUMNS:    SMF16SID('SYSTEM|ID')                      
            SMF16RTY('SMF|REC|TYPE' 4)                 
            SMF16_ICERDS('READER|START|DATE')          
            SMF16_ICERST('READER|START|TIME')            
            SMF16_ICEIOTYP(BITS)                       
            E15BIT                                     
            E32BIT                                     
            E35BIT                                     
            SMF16_ICEFLBYT(BITS)                       
            PGMBIT                                     
            SMF16_ICEJOBNM('JOBNAME')                  
            SAVE_PGMNAME('INVOKING|PROGRAM')           
                                                                        
************************************************************************
* REPORT TITLES                                                        *
*(SLASHES SEPARATE THE LEFT (EMPTY HERE), CENTER AND RIGHT TITLE PARTS)*
************************************************************************
TITLE: / 'DFSORT INFORMATION FOR SORTS INVOKED BY A PROGRAM'            
       / 'RUN DATE:' #DATE                                              
                                                                        
TITLE: / 'FROM SMF RECORDS 16 AND 30'                                   
       / 'PAGE' #PAGENUM                                                
                                                                                                                 

 

Produce This SMF Report:


                        DFSORT INFORMATION FOR SORTS INVOKED BY A PROGRAM      RUN DATE: 06-01-12
                                    FROM SMF RECORDS 16 AND 30                          PAGE    1
        SMF   READER     READER
 SYSTEM REC   START      START     SMF16                         SMF16                   INVOKING
   ID   TYPE   DATE      TIME     ICEIOTYP E15BIT E32BIT E35BIT ICEFLBYT PGMBIT JOBNAME  PROGRAM
 ______ ____ ________ ___________ ________ ______ ______ ______ ________ ______ ________ ________

  TN01    16 05-20-12 03:30:30.10 10100000   1      0      1    00000110   1    BACTXREF BR015200
  TN01    16 05-20-12 03:30:30.10 10100000   1      0      1    00000110   1    BACTXREF BR015200
  TN01    16 05-20-12 03:30:30.10 10100000   1      0      1    00000110   1    BACTXREF BR015200
  TN01    16 05-20-12 03:30:30.10 10100000   1      0      1    00000110   1    BACTXREF BR015200
  TN01    16 05-20-12 03:30:30.10 10100000   1      0      1    00000110   1    BACTXREF BR015200
  TN01    16 05-20-12 03:30:30.10 10100000   1      0      1    00000110   1    BACTXREF BR015200
  TN01    16 05-20-12 03:30:30.10 10100000   1      0      1    00000110   1    BACTXREF BR015200
  TN01    16 05-20-12 03:30:30.10 10100000   1      0      1    00000110   1    BACTXREF BR015200
  TN01    16 05-20-12 03:40:23.40 00010100   0      0      0    00000100   1    HREPUMUL ICEGENER
  TN01    16 05-20-12 03:40:23.40 00010100   0      0      0    00000100   1    HREPUMUL ICEGENER
  TN01    16 05-20-12 03:40:23.40 00010100   0      0      0    00000100   1    HREPUMUL ICEGENER
  TN01    16 05-20-12 03:40:23.40 00010100   0      0      0    00000100   1    HREPUMUL ICEGENER
  TN01    16 05-20-12 03:40:23.40 00010100   0      0      0    00000100   1    HREPUMUL ICEGENER
  TN01    16 05-20-12 03:40:23.40 00010100   0      0      0    00000100   1    HREPUMUL ICEGENER
  TN01    16 05-20-12 03:30:00.73 10100000   1      0      1    00100110   1    JZU1ICF3 IKJEFT1B
  TN01    16 05-20-12 03:30:00.73 10100000   1      0      1    00100110   1    JZU1ICF3 IKJEFT1B
  TN01    16 05-20-12 03:55:52.41 00110100   0      0      1    00000100   1    JZV550DU ICETOOL
  TN01    16 05-20-12 03:55:52.41 00110100   0      0      1    00000100   1    JZV550DU ICETOOL
  TN01    16 05-20-12 03:55:52.41 00110100   0      0      1    00000100   1    JZV550DU ICETOOL
  TN01    16 05-20-12 03:55:52.41 00110100   0      0      1    00000100   1    JZV550DU ICETOOL
  TN01    16 05-20-12 03:55:52.41 00110100   0      0      1    00000100   1    JZV550DU ICETOOL

See Other Sample SMF Reports
Copyright 2017.
Pacific Systems Group.
All rights reserved.


Spectrum Writer 4GL - the economical alternative to SAS, Easytrieve, DYL-280...

Home | Products | Prices | Documentation | 30-Day Trials | Customer Reviews | Company | FAQ | Sample Reports | SMF Records
Send Your Comments or Questions