Product Site

14.1.4. Default Stream Names

A stream name can be a file, a queue, a pipe, or any device that supports character-based input and output. If the stream is a file or device, the name can be any valid file specification.

Windows and Unix-like systems define three default streams:

Rexx provides .INPUT and .OUTPUT public objects. They default to the default input and output streams of the operating system. The appropriate default stream object is used when the call to a Rexx I/O function includes no stream name. The following Rexx statements write a line to the default output stream of the operating system:
Lineout(,"Hello World")
.Output~lineout("Hello World")

Rexx reserves the names STDIN, STDOUT, and STDERR to allow Rexx functions to refer to these stream objects. The checks for these names are not case-sensitive; for example, STDIN, stdin, and sTdIn all refer to the standard input stream object. If you need to access a file with one of these names, qualify the name with a directory specification, for example, \stdin.

Rexx also provides access to arbitrary file descriptors that are already open when Rexx is called. The stream name used to access the stream object is HANDLE:x. x is the number of the file descriptor you wish to use. You can use HANDLE:x as any other stream name; it can be the receiver of a Stream class method. If the value of x is not a valid file descriptor, the first I/O operation to that object fails.

Notes:
  1. Once you close a HANDLE:x stream object, you cannot reopen it.
  2. HANDLE:x is reserved. If you wish to access a file or device with this name, include a directory specification before the name. For example, \HANDLE:x accesses the file HANDLE:x in the current directory.
  3. Programs that use the .INPUT and .OUTPUT public objects are independent of the operating environment.