BPX4WRT (write) example

The following code writes 80 bytes from the specified buffer to the file specified (FILEDESC). For the callable service, see write (BPX1WRT, BPX4WRT) — Write to a file or a socket. AMODE 31 callers use BPX1WRT (write) example.

                                              
*        MVC   FILEDESC,             File descriptor from open          
         MVC   BUFLENA,=F'80'                                           
         LA    R15,BUFFERA                                              
         STG   R15,BUFA                                                 
         SPACE ,                                                        
         CALL  BPX4WRT,              Write to a file                   +
               (FILEDESC,            Input: File descriptor            +
               BUFA,                 Input: ->Buffer                   +
               PRIMARYALET,          Input: Buffer ALET                +
               BUFLENA,              Input: Number of bytes to write   +
               RETVAL,               Return value: -1 or bytes written +
               RETCODE,              Return code                       +
               RSNCODE),             Reason code                       +
               MF=(E,PLIST)          ----------------------------------