Compaq AAQ2G1FTK Marine Radio User Manual


 
Processing Files and Records
6.1 Dening Files and Records
If you describe a record with both the RECORD VARYING...DEPENDING ON
phrase on data-name-1 and the OCCURS clause with the DEPENDING ON
phrase on data-name-2, Compaq COBOL specifies record length as the value of
data-name-1.
If you have multiple record-length descriptions for a file and omit either the
RECORD VARYING clause or the RECORD CONTAINS TO clause, all records
written to the file will have a fixed length equal to the length of the longest record
described for the file, as in Example 6–7.
Example 67Dening Fixed-Length Records with Multiple Record Descriptions
.
.
.
FD PARTS-MASTER.
01 PARTS-REC-1 PIC X(200).
01 PARTS-REC-2 PIC X(300).
01 PARTS-REC-3 PIC X(400).
01 PARTS-REC-4 PIC X(500).
.
.
.
PROCEDURE DIVISION.
.
.
.
100-WRITE-REC-1.
MOVE IN-REC TO PARTS-REC-1.
WRITE PARTS-REC-1.
GO TO ...
200-WRITE-REC-2.
MOVE IN-REC TO PARTS-REC-2.
WRITE PARTS-REC-2.
GO TO ...
.
.
.
Writing PARTS-REC-1, PARTS-REC-2, PARTS-REC-3 or PARTS-REC-4 produces
records equal in length to the longest record, PARTS-REC-4. Note that this is not
variable-length I/O.
Print-Control Records
On OpenVMS, Compaq COBOL places explicit form-control bytes directly into
the file. A Compaq COBOL program trying to read a print-control file can read it
successfully as a variable file (since the I/O system strips the VFC header).
Print-control files contain record-advancing information with each record. These
files are intended for eventual printing, but are created on disk by your Compaq
COBOL program. The compiler generates print-control records when you use the
WRITE AFTER ADVANCING, the LINAGE, or the APPLY PRINT-CONTROL
clause, or if you create a Report Writer file or use ASSIGN TO PRINTER (on
Tru64 UNIX and Windows NT systems).
On OpenVMS, in any of the preceding cases, if you compile /NOVFC, the compiler
does not generate print-control records, but generates stream files instead.
On OpenVMS Alpha systems, you must use the /NOFEED option on the DCL
PRINT command to print a print-control file.
612 Processing Files and Records