Defining I/O areas

Use I/O areas to pass segments back and forth between your program and the database.

The contents of an I/O area depends on the kind of command you are issuing:

  • When you retrieve a segment, DL/I places the segment you requested in the I/O area.
  • When you add a new segment, you build the new segment in the I/O area before issuing an ISRT command.
  • Before you modify a segment, you first retrieve the segment into the I/O area then issue the DLET or REPL command.
Restriction: The I/O area must be long enough to contain the longest segment you retrieve from or add to the database. (Otherwise, you might experience storage overlap.) If you are retrieving, adding, or replacing multiple segments in one command, you must define an I/O area for each segment.

As an example of what a segment looks like in your I/O area, say that you retrieved the ILLNESS segment for Robert James, who came to the clinic on March 3, 1988. He was treated for strep throat. The data returned to your I/O area would look like this:

19880303STREPTHROA

COBOL I/O area

The I/O area in a COBOL program should be defined as a 01 level working storage entry. You can further define the area with 02 entries.

IDENTIFICATION DIVISION.
⋮
DATA DIVISION.
WORKING-STORAGE SECTION.
01    INPUT-AREA.
    02 KEY PICTURE X(6).
    02 FIELD PICTURE X(84).

PL/I I/O area

In PL/I, the name for the I/O area used in the DL/I call can be the name of a fixed-length character string, a major structure, a connected array, or an adjustable character string.

Restriction: The PL/I I/O area cannot be the name of a minor structure or a character string with the attribute VARYING. If you want to define it as a minor structure, you can use a pointer to the minor structure as the parameter.

Your program should define the I/O area as a fixed-length character string and pass the name of that string, or define it in one of the other ways described previously and then pass the pointer variable that points to that definition. If you want to use substructures or elements of an array, use the DEFINED or BASED attribute.

DECLARE    1 INPUT_AREA,
           2 KEY CHAR(6),
           2 FIELD CHAR(84);

Assembler language I/O area

The I/O area in an assembler language program is formatted as follows:

 
IOAREA   DS   0CL90
KEY      DS   CL6
FIELD    DS   CL84