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


readfile

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

Read syntax diagramSkip visual syntax diagram
>>-readfile--pathname--stem------------------------------------><

Function

readfile invokes the open, read, and close callable services to read from a text file and format it in a stem.

Parameters

pathname
A pathname for the file to be read.
stem
Upon return, stem.0 contains the number of lines read. stem.1 through stem.n (where n is the number of lines) each contain a line read.

Usage notes

  1. The maximum allowable length of a line in the file is 1024 characters. RC=4 is returned when a line is greater than 1024 characters long or is not delimited with a newline character.The contents of the stem is unpredictable.
  2. The newline characters that delimit the lines in a text file are stripped before the lines are saved in the stem.
  3. When the return code indicates success, then Retval will be equal to or greater than zero. It will also indicate the corresponding file description number.

Example

In the following example, assume that pathname was assigned a value earlier in the exec:
"readfile (pathname) file."

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014