Coded example

The following Assembler code example calls the Monitor II data interface service to obtain SMF record type 79 subtype 2 (address space resource data).
         ICTL      1,71,20
         PRINT     ON,GEN
EXSMFI   CSECT
         STM       R14,R12,12(R13)     Save entry regs
         LR        R12,R15             Set base from entry point
         USING     EXSMFI,R12          Tell asmblr of prcdr base
         LA        R2,SAVEAREA         Ptr to save area
         ST        R13,4(,R2)          Save old save in new area
         ST        R2,8(,R13)          Save new as forward of last
         LR        R13,R2              Point at new
* Get storage for SMF record buffer
         LA        R3,R792RLEN         Length of data section
         L         R4,CVTPTR           Address of CVT
         USING     CVT,R4
         L         R5,CVTASVT          ASVT address
         USING     ASVT,R5
         M         R2,ASVTMAXU         Multiply by maximum users
         DROP      R4                  CVT no longer needed
         DROP      R5                  ASVT no longer needed
         A         R3,HDRLEN           Add length of record headers
         SR        R4,R4               Subpool 0
         GETMAIN   RU,LV=(3),SP=(4)    Get storage
         ST        R1,BUFFER           Buffer address to parm list
         ST        R3,BUFLEN           Length to parm list
* Call ERBSMFI to create the record
         LA        R1,PARMLIST         Parameter to reg 1
         LINK      EP=ERBSMFI
*
* Check the return code and process the record here
*
         L         R2,BUFFER           Get ptr to buffer start
         L         R3,BUFLEN           Get buffer length
         SR        R4,R4               Subpool zero
         FREEMAIN  RU,LV=(3),A=(2),SP=(4)
         L         R13,4(,R13)         Point at old save area
         SR        R15,R15             Set return code
         L         R14,12(,R13)        Restore return register
         LM        R0,R12,20(R13)      Restore all the rest
         BR        R14                 Return to caller
SAVEAREA DS        CL72                Save area
PARMLIST DC        A(REQTYPE)          Pointer to request type
         DC        A(RECTYPE)          Pointer to record type
         DC        A(SUBTYPE)          Pointer to subtype
BUFFER   DS        A                   Pointer to output buffer
         DC        A(BUFLEN)           Pointer to buffer length
         DC        A(CPUUTL)           Pointer to CPU utilization
         DC        A(DPR)              Pointer to demand paging rate
REQTYPE  DC        F'1'                Request type
RECTYPE  DC        F'79'               Record type 79
SUBTYPE  DC        F'2'                Subtype for ARD report record
BUFLEN   DS        F                   Length of SMF record buffer
CPUUTL   DS        F                   Return area for CPU util.
DPR      DS        F                   Return area for demand paging
HDRLEN   DC        A(HLEN+PLEN+CLEN)   Header length
*                                                                     *
***********************************************************************
*        Patch Area                                                   *
***********************************************************************
PATCH    DC        64S(*)
*
         LTORG
*
         PRINT     NOGEN
* SMF record 79 mapping
         ERBSMFR   79
* Record lengths
SMF79HDR DSECT
HLEN     EQU       *-SMF79HDR
SMF79PRO DSECT
PLEN     EQU       *-SMF79PRO
R79CHL   DSECT
CLEN     EQU       *-R79CHL
EXSMFI   CSECT
* System control block mappings
         CVT       DSECT=YES,LIST=NO
         IHAASVT   DSECT=YES,LIST=NO
* Registers
R0       EQU       0
R1       EQU       1
R2       EQU       2
R3       EQU       3
R4       EQU       4
R5       EQU       5
R6       EQU       6
R7       EQU       7
R8       EQU       8
R9       EQU       9
R10      EQU       10
R11      EQU       11
R12      EQU       12
R13      EQU       13
R14      EQU       14
R15      EQU       15
         END       EXSMFI