Compaq AAQ2G1FTK Marine Radio User Manual


 
Processing Files and Records
6.2 Identifying Files and Records from Within Your Compaq COBOL Program
Dening a File Connector with SELECT and ASSIGN
Your program must include a SELECT statement, including an ASSIGN clause,
for every file description entry (FD) it contains. The file name you specify in the
SELECT statement must match the file name in the file description entry.
In the ASSIGN clause, you specify a nonnumeric literal or data name that
associates the file name with a file specification. This value must be a complete
file specification.
Example 6–8 and Example 6–9 show the relationships between the SELECT
statement, the ASSIGN clause, and the FD entry.
In Example 6–8, because the file name specified in the FD entry is DAT-FILE,
all I/O statements in the program referring to that file or to its associated record
must use the file name DAT-FILE or the record name DAT-RECORD. The I/O
system uses the ASSIGN clause to interpret DAT-FILE as REPORT.DAT on
OpenVMS Alpha systems, and REPORT on Tru64 UNIX and Windows NT
systems. The default directory will be used on OpenVMS Alpha systems, and the
current working directory will be used on Tru64 UNIX and Windows NT systems.
Example 68Dening a Disk File
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT DAT-FILE
ASSIGN TO "REPORT".
.
.
.
DATA DIVISION.
FILE SECTION.
FD DAT-FILE.
01 DAT-RECORD PIC X(100).
.
.
.
Note
On OpenVMS Alpha systems, if no file type is supplied, Compaq COBOL
supplies the default file extension DAT. On Tru64 UNIX and Windows NT
systems, the extensions dat and idx (and lck, on Windows NT systems)
are appended, but only in the case of indexed files.
The I/O statements in Example 6–9 refer to MYFILE-PRO, which the ASSIGN
clause identifies to the operating system as MARCH.311. Additionally, the
operating system looks for the file in the current directory on the magnetic tape
mounted on MTA0: on an OpenVMS Alpha system.
Processing Files and Records 615