Valid I/O Statements For Line Sequential Files - Compaq COBOL AAQ2G1FTK User Manual

Compaq computer accessories user manual
Table of Contents

Advertisement

Processing Files and Records
6.3 Creating and Processing Files
OUTPUT—Output mode can create the following two kinds of files:
Storage files—A storage file remains on tape or disk for future reference
or processing.
Print-control files—The Data Division LINAGE clause, the Environment
Division APPLY PRINT-CONTROL clause, the Procedure Division
ADVANCING phrase (in the WRITE statement), or Report Writer
statements and phrases designates a file as a print-control file.
On OpenVMS Alpha, each record in a print-control file contains a header
that performs line spacing. On Tru64 UNIX and Windows NT, line
spacing is done with blank records in print-control files.
EXTEND—Extend mode permits new records to be added in sequence
after the last record of an existing file (see Extending a Sequential or Line
Sequential File in Section 6.5.1).
Table 6–4 Valid I/O Statements for Line Sequential Files
File
Organization
LINE
SEQUENTIAL
Writing a Line Sequential File
Each WRITE statement appends a logical record to the end of an output file,
thereby creating an entirely new record in the file. The WRITE statement
appends records to files that are OPEN for the following modes:
OUTPUT—Output mode creates a new file or overwrites an already existing
file.
EXTEND—Extend mode permits new records to be added in sequence
after the last record of an existing file (see Extending a Sequential or Line
Sequential File.
You can write records in the following two ways:
WRITE record-name FROM source-area
WRITE record-name
However, the first way provides easier program readability when working with
multiple record types. For example, statements ( 1 ) and ( 2 ) in the following
example are logically equivalent:
FILE SECTION.
FD STOCK-FILE.
01 STOCK-RECORD
WORKING-STORAGE SECTION.
01 STOCK-WORK
6–28 Processing Files and Records
Access
Mode
Statement
SEQUENTIAL
READ
WRITE
UNLOCK
PIC X(80).
PIC X(80).
Open Mode
INPUT
OUTPUT EXTEND
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COBOL AAQ2G1FTK and is the answer not in the manual?

Table of Contents