BPX1ACC (access) example

The following code determines if /usr/inv/network.t can be accessed. For the callable service, see access (BPX1ACC, BPX4ACC) — Determine if a file can be accessed. For the data structure, see BPXYACC — Map flag values for access. AMODE 64 callers use BPX4ACC (access) example.
                                              
         MVC   BUFFERA(18),=CL18'/usr/inv/network.t'                    
         MVC   BUFLENA,=F'18'                                           
         XC    ACC(ACC#LENGTH),ACC                                      
         MVI   ACCINTENTFLAGS,ACC_R_OK+ACC_W_OK  Read and write access  
         SPACE ,                                                        
         CALL  BPX1ACC,              Determine accessibility of a file +
               (BUFLENA,             Input: Pathname length            +
               BUFFERA,              Input: Pathname                   +
               ACC,                  Input: Access, BPXYACC            +
               RETVAL,               Return value: 0 or -1             +
               RETCODE,              Return code                       +
               RSNCODE),             Reason code                       +
               VL,MF=(E,PLIST)       ---------------------------------- 
         SPACE ,                                                        
         ICM   R15,B'1111',RETVAL    Set condition code for RETVAL      
         BZ    PSEUDO                Branch if RETVAL is zero           
         CLC   RETCODE,=A(EACCES)    Compare RETCODE to EACCES          
         BE    PSEUDO                Branch if access denied