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


Opening a stream explicitly

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

You open a stream explicitly by using the stream() function.

To explicitly open a file stream, use the open command. The advantage of opening file streams explicitly is that the program can determine that the stream open failed. The program can also have several separate streams for the same file.

The stream open command fails if:
  • The file does not exist.
  • The path name cannot be accessed for either input or output.

If the file cannot be opened, a message is written to stderr. The I/O function returns as if the stream is empty, at end of file, and the file cannot be extended.

When a stream is explicitly opened, the stream() function returns a string that is the name of the stream. This is the only name that can be used to identify that stream. Multiple opens for the same path name open multiple streams, each with its own name.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014