Processing Files and Records
6.2 Identifying Files and Records from Within Your Compaq COBOL Program
Example 6–9 Defining a Magnetic Tape File (OpenVMS)
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT MYFILE-PRO
ASSIGN TO "MTA0:MARCH.311"
.
.
.
DATA DIVISION.
FILE SECTION.
FD
MYFILE-PRO.
01
DAT-RECORD PIC X(100).
.
.
.
PROCEDURE DIVISION.
A000-BEGIN.
OPEN INPUT MYFILE-PRO.
.
.
.
READ MYFILE-PRO AT END DISPLAY "end".
.
.
.
CLOSE MYFILE-PRO.
♦
Example 6–10 achieves the same result as Example 6–9, but on Tru64 UNIX. The
I/O statements in Example 6–10 refer to MYFILE-PRO, which the ASSIGN clause
identifies to the operating system as a magnetic tape file. The file is named in the
Data Division VALUE OF ID clause as MARCH.311.
Example 6–10 Defining a Magnetic Tape File (Tru64 UNIX)
ENVIRONMENT DIVISION
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT MYFILE-PRO
ASSIGN TO REEL.
.
.
.
DATA DIVISION.
FILE SECTION.
FD MYFILE-PRO VALUE OF ID "MARCH.311".
01
DAT-RECORD PIC X(100).
.
.
.
PROCEDURE DIVISION.
(continued on next page)
6–16 Processing Files and Records
Содержание COBOL AAQ2G1FTK
Страница 22: ......
Страница 30: ......
Страница 94: ......
Страница 110: ......
Страница 146: ......
Страница 180: ......
Страница 194: ...Processing Files and Records 6 1 Defi...
Страница 300: ......
Страница 490: ......
Страница 516: ......
Страница 517: ......
Страница 530: ......
Страница 534: ......
Страница 590: ......
Страница 620: ......