BPX4FCR (fchattr) example

The following code changes the attributes of the standard input file. The owning user and group ids are changed; the file change time is set to the current time; and the user read-execute, group write, and other read-execute permissions are set. For the callable service, see fchattr (BPX1FCR, BPX4FCR) — Change the attributes of a file or directory by descriptor. For the data structures, see BPXYATT — Map file attributes for chattr and fchattr and BPXYMODE — Map the mode constants of the file services. AMODE 31 callers use BPX1FCR (fchattr) example.
                                              
         MVC   ATTID,=CL4'ATT '      Eye Catcher                        
         MVC   ATTVERSION,=AL2(ATT#VER)  version                        
         XC    S_MODE,S_MODE         Clear mode                         
         MVI   S_MODE2,S_IRUSR       Read-execute/write/read-execute    
         MVI   S_MODE3,S_IXUSR+S_IWGRP+S_IROTH+S_IXOTH                  
         MVC   ATTMODE,S_MODE        Move mode data to attribute       +
                                     structure                          
         MVC   ATTUID,=F'7'          Specify new UID                    
         MVC   ATTGID,=F'77'         Specify new GID                    
         OI    ATTSETFLAGS1,ATTMODECHG+ATTOWNERCHG                     +
                                     Flag Mode, UID and GID changes     
         OI    ATTSETFLAGS2,ATTCTIMETOD                                +
                                     Set change time to current time    
         SPACE ,                                                        
         CALL  BPX4FCR,              Change file attributes            +
               (=A(STDIN_FILENO),    Input: File descriptor            +
               =A(ATT#LENGTH),       Input: BPXYATT length             +
               ATT,                  Input/output: BPXYATT             +
               RETVAL,               Return value: 0 or -1             +
               RETCODE,              Return code                       +
               RSNCODE),             Reason code                       +
               MF=(E,PLIST)          ----------------------------------