Compaq AAQ2G1FTK Marine Radio User Manual


 
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 64 Valid I/O Statements for Line Sequential Files
Open Mode
File
Organization
Access
Mode Statement INPUT OUTPUT EXTEND
LINE
SEQUENTIAL
SEQUENTIAL READ Yes No No
WRITE No Yes Yes
UNLOCK Yes Yes Yes
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 PIC X(80).
WORKING-STORAGE SECTION.
01 STOCK-WORK PIC X(80).
628 Processing Files and Records