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


writefile

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

Read syntax diagramSkip visual syntax diagram
>>-writefile--pathname--mode--stem--+--------+-----------------><
                                    '-append-'   

Function

writefile invokes the open, write, and close callable services to write or append text files, with lines up to 1024 characters long.

Parameters

pathname
A pathname for the file.
mode
A three- or four-digit number, corresponding to the access permission bits. Each digit must be in the range 07, and at least three digits must be specified. For more information on permissions, see REXX predefined variables.
stem
The name of a stem variable that contains the information to be written to the file. stem.0 is set to the number of lines to be written. stem.1 through stem.n, where n is the total number of variables written, each contain a line to be written. A newline is written to the file following each line.

Within the stem, you can use the predefined variables beginning with ESC_ the same way you use C language escape sequences to avoid code page dependence with some control characters. See the usage notes for write.

append
An optional flag to indicate that the information is to be appended to the file (the file must already exist), as follows:
0
Do not append. (This is the default value.)
1
Append the information to the file.

Usage notes

File I/O stops when writefile sets a return code. writefile can set the following return codes:
4
A line is longer than 1024 characters.
8
A write was attempted but not all of the data could be written. This situation typically happens when the file system runs out of space.
For further usage notes, see:

Example

In the following example, assume that fname and the stem file. were assigned values earlier in the exec:
"writefile (fname) 600 file."

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014