BPX4SMF (smf_record) example

The following code tests whether SMF recording is active for a specified SMF record type, and if it is, writes an SMF record. For the callable service, see smf_record (BPX1SMF, BPX4SMF) — Write an SMF record. AMODE 31 callers use BPX1SMF (smf_record) example.
                                              
         MVC   SMF_TYPE,=F'108'      Set SMF record type                
         MVC   SMF_SUBTYPE,=F'0'     Set SMF record subtype             
         MVC   BUFLENA,=F'0'         Set SMF record length              
         MVC   BUFA,=FD'0'            Zero SMF record address           
         CALL  BPX4SMF,              smf_record                        +
               (SMF_TYPE,            SMF record type                   +
               SMF_SUBTYPE,          SMF record subtype                +
               BUFLENA,              SMF record length                 +
               BUFA,                 SMF record address set to zero    +
               RETVAL,               Return value: 0 or -1             +
               RETCODE,              Return code                       +
               RSNCODE),             Reason code                       +
               MF=(E,PLIST)          ---------------------------------  
         ICM   R15,B'1111',RETVAL    Test return value                  
         BNZ   QUIT                  Not recording or error, quit       
         SPACE ,                                                        
         MVI   BUFFERA,C' '                                             
         MVC   BUFFERA+1(255),BUFFERA Clear SMF record                  
         MVI   BUFFERA+1,100         Set length in SMF header           
         MVI   BUFFERA+5,108         Set SMF type in SMF header         
         MVC   BUFFERA+18(16),=CL16'Here is the data'  Set SMF record   
         MVC   SMF_TYPE,=F'108'      Set SMF record type                
         MVC   SMF_SUBTYPE,=F'0'     Set SMF record subtype             
         MVC   BUFLENA,=F'100'       Set SMF record length              
         LA    R15,BUFFERA                                              
         STG   R15,BUFA              Set SMF record address             
         CALL  BPX4SMF,              smf_record                        +
               (SMF_TYPE,            SMF record type                   +
               SMF_SUBTYPE,          SMF record subtype                +
               BUFLENA,              SMF record length                 +
               BUFA,                 SMF record address                +
               RETVAL,               Return value: 0 or -1             +
               RETCODE,              Return code                       +
               RSNCODE),             Reason code                       +
               MF=(E,PLIST)          --------------------------------   
QUIT     EQU  *