z/OS Using REXX and z/OS UNIX System Services
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Open, write, and close a file

z/OS Using REXX and z/OS UNIX System Services
SA23-2283-00

/*   rexx   */
call syscalls 'ON'
address syscall
path='/u/schoen/my.file'
'open' path,
       O_rdwr+O_creat+O_trunc,
       660
if retval=-1 then
   do
say 'file not opened, error codes' errno errnojr
   return
   end
fd=retval
rec='hello world' || esc_n
'write' fd 'rec' length(rec)
if retval=-1 then
   say 'record not written, error codes' errno errnojr
'close' fd

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014