Rational Developer for System z
PL/I for Windows, Version 7.6, Programming Guide

Using record-oriented I/O

PL/I supports various types of data sets with the RECORD attribute. This section covers how to use record-oriented I/O with consecutive data sets.

Table 16 lists the data transmission statements and options that you can use to create and access a consecutive data set using record-oriented I/O.

A CONSECUTIVE file that is associated with a DDM direct or keyed data set can be opened only for INPUT. PL/I raises UNDEFINEDFILE if an attempt is made to open such a file for OUTPUT or UPDATE.

Table 16. Statements and options allowed for creating and accessing consecutive data sets
File Declaration1 Valid Statements,2 with Options You Must Specify Other Options you can Specify
SEQUENTIAL OUTPUT
BUFFERED
WRITE FILE(file-reference)
FROM(reference);

LOCATE based-variable
FILE(file-reference);
SET(pointer reference)
SEQUENTIAL OUTPUT
UNBUFFERED
WRITE FILE(file-reference)
FROM(reference);
SEQUENTIAL INPUT
BUFFERED
READ FILE(file-reference)
INTO(reference);

READ FILE(file-reference)
SET(pointer-reference);

READ FILE(file-reference)
IGNORE(expression);

 
SEQUENTIAL INPUT
UNBUFFERED
READ FILE(file-reference)
INPUT(reference);

READ FILE(file-reference)
IGNORE(expression);

SEQUENTIAL UPDATE
BUFFERED
READ FILE(file-reference)
INTO(reference);

READ FILE(file-reference)
SET(pointer-reference);

READ FILE(file-reference)
IGNORE(expression);

REWRITE FILE(file-reference);






FROM(reference)
SEQUENTIAL UPDATE
UNBUFFERED
READ FILE(file-reference)
INTO(reference);

READ FILE(file-reference)
IGNORE(expression);

REWRITE FILE(file-reference)
FROM(reference);

Notes:

1 The complete file declaration would include the attributes FILE, RECORD, and ENVIRONMENT

2 The statement READ FILE (file-reference); is a valid statement and is equivalent to READ FILE(file-reference) IGNORE (1);


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)