Implementation

Usually, the dialog between a Rexx program and you as the user takes place on a line-by-line basis and is, therefore, carried out with the SAY, PULL, or PARSE PULL instructions. This technique considerably enhances the usability of many programs, because they can be converted to programmable dialogs by using the external data queue to provide the input you generally type. Use the PARSE LINEIN instruction only when it is necessary to bypass the external data queue.

When a dialog is not on a line-by-line basis, use the serial interfaces the CHARIN and CHAROUT methods provide. These methods are important for input and output in transient stream objects, such as keyboards, printers, or network environments.

Opening and closing of persistent stream objects, such as files, is largely automatic. Generally the first CHARIN, CHAROUT, CHARS, LINEIN, LINEOUT, or LINES message sent to a stream object opens that stream object. It remains open until you explicitly close it with a CHAROUT or LINEOUT or until the program ends. Using the LINEOUT method with only the name of a stream object (and no output string or line) closes the named stream object. The Stream class also provides OPEN and CLOSE methods and the COMMAND method, which can explicitly open or close a stream object.

If you open a stream with the CHARIN, CHAROUT, LINEIN, or LINEOUT methods, it is opened for both reading and writing, if possible. You can use the OPEN method or the COMMAND method to open a stream for read-only or write-only operations.