Friday, September 22, 2023

Assembler program to process SMF 30 subtype records 2 and 3

 
Assembler program to process SMF 30 subtype records 2 & 3 are given below.
The input SMF file is in VBS record format. Format of the output record is given below. Between each field, there is a blank inserted.
 
LPAR system id       – 4 bytes
Interval start time – 19 bytes (Format CCYY/MM/DD HH:MM:SS)
Interval end time   - 19 bytes (Format CCYY/MM/DD HH:MM:SS)
Jobname             - 08 bytes
Jobid               - 08 bytes
Step name           - 08 bytes
Proc Step name      - 08 bytes
Program name        - 08 bytes
CPU time            - 08 bytes (Format SSSSS.HS)
Normalized ZIIP time- 08 bytes (Format SSSSS.HS)
ZIIP on CP          - 08 bytes (Format SSSSS.HS)
Normalized ZAAP time- 08 bytes (Format SSSSS.HS)
ZAAP on CP          - 08 bytes (Format SSSSS.HS)
 
Please note that CPU time does not include “ZIIP on CP” and “ZAAP on CP”
 
Assembler program to process SMF 30 subtype records 2 & 3
 
         YREGS                                                         
SMF30ASM CSECT                                                          
         STM   R14,R12,12(R13)                                         
         BASR  R12,0                                                   
         USING *,R12                                                   
         ST    R13,SAVE+4                                              
         LA    R2,SAVE                                                  
         ST    R2,8(R13)                                               
         LR    R13,R2                                                  
         OPEN  (OUT,(OUTPUT))                                          
         OPEN  (SMF30IN,(INPUT))                                       
         USING SMFRCD30,R9                                             
MAIN     EQU   *                                                       
         GET   SMF30IN                                                  
         LR    R9,R1               STORE THE ADDRESS OF THE INPUT RCD                                     
         CLI   SMF30RTY,X'1E'      CHECK FOR SMF 30 RECORD             
         BNE   MAIN                NO - GO TO READ NEXT RECORD         
*                                                                       
         CLC   SMF30STP,=H'+2'     WAS IT ACTIVITY SINCE PREV INTRVL   
         BE    CONT                YES, CONTINUE                       
*                                                                       
         CLC   SMF30STP,=H'+3'     INTRVAL BFRE STEP COMPLETION        
         BE    CONT                YES, CONTINUE                       
*                                                                      
         B     MAIN                                                    
CONT     EQU   *                                                       
         CLI   SMF30CON+1,1        CHECK IF ACCOUTING SEGMENT IS THERE 
         BL    MAIN                NO - GO TO READ NEXT RECORD         
*                                                                      
         LR    R4,R9                   GET SMF RECORD ADDRESS          
         A     R4,SMF30IOF             ADD ID SECTION OFFSET           
         USING SMF30ID,R4              REDIRECT DSECT                  
         MVI   OUTREC,C' '                                             
         MVC   OUTREC+1(L'OUTREC-1),OUTREC                             
         MVC   SYSID,SMF30SID          MOVE SYSTEM ID                  
         MVC   JOBNAME,SMF30JBN        MOVE JOB NAME                   
         MVC   JOBID,SMF30JNM          MOVE JOB ID                     
         MVC   PGMNAME,SMF30PGM        MOVE PROGRAM NAME               
         MVC   DWORD,SMF30IET          CONVERT INTERVAL END TIME       
         BAS   R14,TODCNV                                           
         MVC   ENDTM,OUTTIM                                         
         MVC   DWORD,SMF30ISS          CONVERT INTERVAL START TIME  
         BAS   R14,TODCNV                                           
         MVC   STTM,OUTTIM                                           
         CLC   SMF30WID,=CL4'STC'      IS IT A STARTED TASK ?       
         BE    PRSTPNM                 YES, FILL IN PROC STEP       
*                                                                   
         CLI   SMF30PSN,C' '           IS PROC STEP NAME BLANK?     
         BE    MOVSTPNM                YES, DO NOT MOVE IT IN       
*                                                                   
         MVC   STEPNAME,SMF30PSN       MOVE IN STEP NAME            
PRSTPNM  EQU   *                                                    
         MVC   PROCSTEP,SMF30STM       MOVE IN PROC STEP NAME       
         B     CONT1                   DROP REGISTER                
*                                                                    
MOVSTPNM EQU   *                                                    
         MVC   STEPNAME,SMF30STM       MOVE IN STEP NAME            
CONT1    EQU   *                                                    
         DROP  R4                                                    
*        CP TIME                                                 
         LR    R4,R9               GET RECORD ADDRESS            
         A     R4,SMF30COF         POINT TO ACCOUNTING SECTION   
         USING SMF30CAS,R4                                       
         ICM   R1,15,SMF30CPS      GET SRB TIME                  
         ICM   R0,15,SMF30CPT      GET TCB TIME                  
         AR    R0,R1               ADD SRB TIME TO TCB TIME      
         ICM   R1,15,SMF30ICU      GET INTIATOR TIME FOR TCB     
         AR    R0,R1               ADD INIT TIME TO TCB TIME     
         ICM   R1,15,SMF30HPT      GET HIPERPACE TIME            
         AR    R0,R1               ADD HIPER TIME TO TCB TIME    
         ICM   R1,15,SMF30IIP      GET INTERRUPT TIME            
         AR    R0,R1               ADD INTRP TIME TO TCB TIME    
         ICM   R1,15,SMF30RCT      GET RCT TIME                  
         AR    R0,R1               ADD RCT TIME TO TCB TIME      
         ICM   R1,15,SMF30ISB      GET INTIATOR TIME FOR SRB     
         AR    R0,R1               ADD INIT TIME TO TCB TIME     
         LR    R1,R0               GET CP TIME                   
         BAL   R14,PTIME8          CONVERT TO seconds            
         MVC   CPTME,TIME8         COPY TIME TO OUTPUT           
*        ON ZIIP NORMALIZED                                       
         BAS   R14,GETIONI         GET ZIIP ON ZIIP TIME          
         LR    R15,R9              GET SMF30 RECORD ADDRESS       
         A     R15,SMF30POF        GET PERFORMANCE SEGMENT ADDRESS
         USING SMF30PRF,R15                                       
         SLR   R0,R0               CLEAR R0                       
         MH    R1,SMF30ZNF         NORMALIZE                      
         LA    R15,256              ZIIP                           
         DR    R0,R15                CPU                          
         DROP  R15                    TIME                        
         SLR   R0,R0               CLEAR R0                       
         BAL   R14,PTIME8          CONVERT TO seconds             
         MVC   ZIPONZ,TIME8        COPY TIME TO OUTPUT            
*        ZIIPONCP                                                 
         BAS   R14,GETIONC         GET ZIIP TIME ON CP            
         SLR   R0,R0               CLEAR R0                       
         BAL   R14,PTIME8          CONVERT TO seconds             
         MVC   ZIPONCP,TIME8       COPY TIME TO OUTPUT            
*        ON ZAAP NORMALIZED                                        
         BAS   R14,GETAONA         GET ZAAP ON ZAAP TIME          
         LR    R15,R9              GET SMF30 RECORD ADDRESS       
         A     R15,SMF30POF        GET PERFORMANCE SEGMENT ADDRESS
         USING SMF30PRF,R15                                        
         SLR   R0,R0               CLEAR R0                       
         MH    R1,SMF30SNF         NORMALIZE                      
         LA    R15,256              ZAAP                          
         DR    R0,R15                CPU                          
         DROP  R15                    TIME                        
         SLR   R0,R0               CLEAR R0                       
         BAL   R14,PTIME8          CONVERT TO seconds             
         MVC   ZAPONZ,TIME8        COPY TIME TO OUTPUT            
*        ZAAPONCP                                                 
         BAS   R14,GETAONC         GET ZAAP TIME ON CP            
         SLR   R0,R0               CLEAR R0                        
         BAL   R14,PTIME8          CONVERT TO seconds             
         MVC   ZAPONCP,TIME8       COPY TIME TO OUTPUT            
         DROP  R4                                                 
         PUT   OUT,OUTREC                                          
         B     MAIN                                               
*                                                                 
EOF      EQU   *                                                     
         CLOSE (SMF30IN)                                             
         CLOSE (OUT)                                                 
         L     R13,4(R13)                                            
         LM    R14,R12,12(R13)                                        
         LA    R15,0                                                 
         BR    R14                                                   
*                                                                    
*        Retrieve zAAP time on CP                                    
*                                                                    
GETAONC  DS    0H                                                     
         USING SMFRCD30,R9                                           
         USING SMF30CAS,R4                                           
         SLR   R1,R1              Clear R1                           
         CLI   SMF30CON+1,1       CPU accounting section exist       
         BLR   R14                No - use zero                      
         TM    SMF30TF2,SMF30_TIME_IFA_ON_CP_F Is value available    
         BOR   R14                No, skip it                         
         ICM   R1,15,SMF30_TIME_IFA_ON_CP Get zAAP on CP time        
         BR    R14                                                   
         DROP  R4,R9                                                
*                                                                    
*        Retrieve zIIP time on CP                                   
*                                                                   
GETIONC  DS    0H                                                   
         USING SMFRCD30,R9                                          
         USING SMF30CAS,R4                                          
         SLR   R1,R1              Clear R1                          
         CLI   SMF30CON+1,1       CPU accounting section exist      
         BLR   R14                No - use zero                     
         TM    SMF30T32,SMF30_TIME_ZIIP_ON_CP_F Is value available  
         BOR   R14                No, skip it                       
         ICM   R1,15,SMF30_TIME_ZIIP_ON_CP Get zIIP on CP time      
         BR    R14                                                  
         DROP  R4,R9                                                
*                                                                   
*        Retrieve zAAP time on zAAP                                 
*                                                                   
GETAONA  DS    0H                                                   
         USING SMFRCD30,R9                                           
         USING SMF30CAS,R4                                         
         SLR   R1,R1              Clear R1                         
         CLI   SMF30CON+1,1        CPU accounting section exist    
         BLR   R14                No - use zero                    
         TM    SMF30T32,SMF30_TIME_ON_IFA_F Is value available     
         BOR   R14                No, skip it                      
         ICM   R1,15,SMF30_TIME_ON_IFA Get zAAP on zAAP time       
         BR    R14                                                 
         DROP  R4,R9                                               
*                                                                  
*        Retrieve zIIP time on zIIP                                 
*                                                                  
GETIONI  DS    0H                                                  
         USING SMFRCD30,R9                                         
         USING SMF30CAS,R4                                          
         SLR   R1,R1              Clear R1                         
         CLI   SMF30CON+1,1       CPU accounting section exist     
         BLR   R14                No - use zero                    
         TM    SMF30T32,SMF30_TIME_ON_zIIP_F Is value available    
         BOR   R14                No, skip it                      
         ICM   R1,15,SMF30_TIME_ON_zIIP Get zIIP on zIIP time     
         BR    R14                                                 
         DROP  R4,R9                                              
******************************************************************
*                                                                *
*  Format time in 8 characters as:                               *
*        INPUT   Same as Ptime                                   *
*        OUTPUT  TIME8 Contains 8 character time in seconds      *
*                SSSSS.TH If time less than 1 hour               *
*                                                                *
******************************************************************
PTIME8   DS    0H                                                  
         SLR   R0,R0               ZERO REG FOR DIVIDE            
         D     R0,=F'+100'         Get seconds                    
         CVD   R0,DWORD2           get remainder                  
         CVD   R1,DWORD            Get quotient                   
         MP    DWORD,=P'100'                                      
         AP    DWORD,DWORD2                                       
         MVC   TIME9,=X'4020202021204B2020'                       
         ED    TIME9,DWORD+4       Edit time DD HH:MM:SS          
         MVC   TIME8,TIME9+1                                  
         BR    R14                                            
*                                                             
TODCNV   SAVE  (14,12)             SAVE CALLER'S REGISTERS    
         L     R4,CVTPTR          POINT TO CVT                
         USING CVTMAP,R4          ADDRESS CVT                 
         L     R4,CVTEXT2                                     
         DROP  R4                                             
         USING CVTXTNT2,R4                                    
* CONVERT TOD TO LOCAL TIME                                   
         LG    R1,DWORD                                       
         ALG   R1,CVTLDTO                                     
         SLG   R1,CVTLSO                                      
         STG   R1,DWORD                                       
         DROP  R4                                             
* NOW DWORD CONTAINS LOCAL TIME                               
         STCKCONV STCKVAL=DWORD,CONVVAL=OUTVAL,TIMETYPE=DEC,  
               DATETYPE=YYYYMMDD                              
         MVC   CTIME,TMMSK                                    
         ED    CTIME,OTIME                                    
         MVC   CDATE,DTMSK                                    
         ED    CDATE,ODATE                                    
         MVC   OUTTIM(10),CDATE+1                             
         MVI   OUTTIM+10,C' '                                 
         MVC   OUTTIM+11(8),CTIME+1                           
         RETURN (14,12)            RETURN TO CALLER           
*                                                             
SAVE     DS    18F                                            
OUTLEN   EQU   140                                            
OUTREC   DS    CL(OUTLEN)                                     
         ORG   OUTREC                                         
SYSID    DS    CL4,C' '                                       
STTM     DS    CL19,C' '                                      
ENDTM    DS    CL19,C' '                                      
JOBNAME  DS    CL8,C' '            JOB NAME                   
JOBID    DS    CL8,C' '            JOB ID                     
STEPNAME DS    CL8,C' '            STEPNAME                   
PROCSTEP DS    CL8,C' '            PROCEDURE STEP NAME        
PGMNAME  DS    CL8,C' '            PROGRAM NAME               
CPTME    DS    CL8,C' '            GENERAL PROCESSOR CP TIME  
ZIPONZ   DS    CL8,C' '            ZIIP ON ZIIP           
ZIPONCP  DS    CL8,C' '            ZIIP ON CP             
ZAPONZ   DS    CL8,C' '            ZAAP ON ZAAP           
ZAPONCP  DS    CL8                 ZAAP ON CP             
         ORG                                              
*                                                         
DWORD    DS    D                                           
DWORD2   DS    D                                          
TIME9    DS   C'BSSSSS.TH'          Time in 9 bytes format
TIME8    DS   CL8                   Time in 9 bytes format
*                                                         
OUTVAL   DS    0CL16                                      
OTIME    DS    PL8                                        
ODATE    DS    PL8                                        
CTIME    DS    CL9                                        
CDATE    DS    CL11                                       
OUTTIM   DS    CL19                                       
DTMSK    DC    X'F021202020612020612020'                  
TMMSK    DC    X'F021207A20207A2020'                      
*                                                         
OUT      DCB   DDNAME=OUT,LRECL=OUTLEN,RECFM=FB,DSORG=PS,            
               MACRF=PM                                               
SMF30IN  DCB   DDNAME=SMF30IN,DSORG=PS,MACRF=GL,EODAD=EOF,BFTEK=A    
         IFASMFR 30                SMF TYPE 30 RECORD                
         CVT   DSECT=YES                                             
SMF30ASM CSECT                                                       
         LTORG                                                       
         END   SMF30ASM                                              
 
Job to compile the above Assembler program
 
// SET PGM=SMF30ASM                                
//ASM     EXEC PGM=ASMA90,                         
//             PARM=('',                           
//             '')                                 
//SYSPRINT DD  SYSOUT=*                            
//SYSLIB   DD DISP=SHR,DSN=SYS1.MACLIB              
//SYSUT1   DD UNIT=SYSDA,SPACE=(CYL,(5,5))         
//SYSUT2   DD UNIT=SYSDA,SPACE=(CYL,(5,5))         
//SYSPUNCH DD  DUMMY                               
//SYSLIN   DD  DISP=(,PASS),DSN=&&OBJECT(&PGM),    
//             UNIT=SYSDA,SPACE=(CYL,(1,1,1)),     
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)   
//SYSIN    DD  DISP=SHR,DSN=MY.SOURCE.LIB(&PGM)  
//ASMAOPT  DD  DUMMY                               
//*                                                
//LINK1 EXEC PGM=IEWBLINK,                         
//             COND=(4,LT),                        
//             PARM=('LIST=ALL,XREF,MAP,,',        
//             'LET,,,')                            
//SYSPRINT DD SYSOUT=*                             
//SYSUT1   DD UNIT=SYSDA,SPACE=(CYL,(5,5))           
//SYSLIB   DD DISP=SHR,DSN=CEE.SCEELKED              
//SYSLMOD  DD DISP=(OLD,PASS),DSN=MY.LOADLIB(&PGM) 
//SYSLIN   DD DISP=(OLD,PASS),DSN=&&OBJECT(&PGM)     
 
JCL to run the above assembler program
 
//STEP10 EXEC PGM=SMF30ASM                                    
//STEPLIB  DD DSN=MY.LOADLIB,DISP=SHR                      
//SYSPRINT DD SYSOUT=*                                       
//OUT      DD DSN=MY.OUTPUT.FILE,                      
//          DISP=(NEW,CATLG,DELETE),                           
//          SPACE=(CYL,(50,50,)),              
//         DCB=(LRECL=140,RECFM=FB)                           
//SMF30IN DD DISP=SHR,DSN=SMF.FILE.CONTAINING.SMF30.RECORDS
//*