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


Open a file, read, and close it

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_rdonly,
       000
if retval=-1 then
   do
   say 'file not opened, error codes' errno errnojr
   return
   end
fd=retval
'read' fd 'bytes 80'
if retval=-1 then
   say 'bytes not read, error codes' errno errnojr
else
   say bytes
'close' fd

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014