More about Stream Objects

To use streams in Rexx, you create new instances of the Stream class. These stream objects represent the various data sources and destinations available to your program, such as hard disks, CD-ROMs, keyboards, displays, printers, serial interfaces or devices on a network.

Stream objects can be transient or persistent. An example of a transient (or dynamic) stream object is a serial interface. Data can be sent or received from serial interfaces, but the data is not stored permanently by the serial interface itself. Consequently, you cannot, for example, read from or write to a random position in the data stream–it can only be read and/or written as a sequential stream of characters. Once you read from or write to the stream, the data cannot be re-accessed.

A disk file is an example of a persistent stream object. Because the data is stored on disk, you can search forward and backward in the stream and reread data that you have previously read. Rexx maintains separate read and write pointers to a stream that you can move independently of each other using arguments on methods such as LINEIN, LINEOUT, CHARIN, and CHAROUT. The Stream class also provides SEEK and POSITION methods for setting the read and write positions.