Compaq AAQ2G1FTK Marine Radio User Manual


 
Processing Files and Records
6.3 Creating and Processing Files
----------------(1)---------------- --------------(2)---------------
WRITE STOCK-RECORD FROM STOCK-WORK. MOVE STOCK-WORK TO STOCK-RECORD.
WRITE STOCK-RECORD.
When you omit the FROM phrase, you process the records directly in the record
area or buffer (for example, STOCK-RECORD).
The following example writes the record PRINT-LINE to the device assigned
to that record’s file, then skips three lines. At the end of the page (as specified
by the LINAGE clause), it causes program control to transfer to HEADER-
ROUTINE.
WRITE PRINT-LINE BEFORE ADVANCING 3 LINES
AT END-OF-PAGE PERFORM HEADER-ROUTINE.
For a WRITE FROM statement, if the destination area is shorter than the file’s
record length, the destination area is padded on the right with spaces; if longer,
the destination area is truncated on the right. This follows the rules for a group
move.
6.3.3 File Handling for Relative Files
Creating a relative file involves the following tasks:
1. Specifying ORGANIZATION IS RELATIVE in the Environment Division
SELECT clause
2. Specifying ACCESS MODE IS SEQUENTIAL (or RANDOM) in the
Environment Division SELECT clause
Each of these two access modes requires a different processing technique.
(Refer to the Creating a Relative File in Sequential Access Mode and
Creating a Relative File in Random Access Mode sections in this chapter
for information about those techniques.)
3. Opening the file for OUTPUT or I-O
4. Initializing the relative key data name for each new record
5. Executing a WRITE statement for each new relative record
6. Closing the file
Processing Files and Records 629