Chapter 5. Input and Output

Overview

Input/output, or I/O, is how a program interacts with its environment. Input may come from what a user types in, an input file, or another program. Program output might be written to the display, to an output file, or to a communication mechanism such as a pipe. These are just a few of the possibilities.

Rexx provides a simple-to-use, high-level I/O interface. At the same time, Rexx aims for standardization and portability across platforms. Unfortunately, this latter goal is difficult to achieve—I/O is inherently platform-dependent, because it relies upon the file systems and drivers the operating system provides for data management. These vary by operating system.

This chapter describes the Rexx I/O model at a conceptual level. Then it explores examples and how to code I/O. The last part of the chapter discusses some of the problems that any programming language confronts when trying to standardize I/O across platforms, some of the trade-offs involved, and how this tension has been resolved in Rexx and its many implementations.

Rexx provides an I/O model that is easy to use and as portable as possible. Section II explores the I/O extensions that many versions of Rexx offer for more sophisticated (but less portable) I/O. Chapter 15 illustrates database I/O and how to interface scripts to popular database management systems such as SQL Server, Oracle, DB2, and MySQL.

The Conceptual I/O Model

Rexx views both input and output as streams—a sequence of ...

Get Rexx Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.