BPX1RW (Pwrite) example
The following code writes 80 bytes from the specified buffer to the file specified (FILEDESC). It will start writing at specified offset, 30 bytes from start of the file. To positional read from a file, change the FUIORWIND to indicate FUIO#RD. For the callable service, see Pread() and Pwrite() (BPX1RW, BPX4RW) — Read from or write to a file without changing the file pointer. AMODE 64 callers use BPX4RW (Pwrite) example.
MVC FILEDESC, File descriptor from open
XC FUIO,FUIO Zero out Fuio fields
MVC FUIOID,=CL4'FUIO' Eye Catcher
MVC FUIOLEN,=AL4(FUIO#LENGTH) length
LA R15,BUFFERA Set address of buffer
ST R15,FUIOBUFFERADDR for buffer data in FUIO
MVI FUIORWIND,FUIO#WRT Flag to indicate to PWrite
MVC FUIOIBYTESRW,=F'80' Number of bytes to Write
MVC FUIOCUR2,=F'30' Offset to start writing
LA R15,FUIO Set address of Fuio
ST R15,LFUIOPTR For access to Fuio fields
SPACE ,
CALL BPX1RW, PWrite to a file +
(FILEDESC, Input: File descriptor +
LFUIOPTR, Input: Address of FUIO struct +
PRIMARYALET, Input: Fuio ALET +
FUIOLEN, Input: Fuio Length +
RETVAL, Return value: -1 or bytes written +
RETCODE, Return code +
RSNCODE), Reason code +
VL,MF=(E,PLIST) ----------------------------------