Processing Files and Records
6.2 Identifying Files and Records from Within Your Compaq COBOL Program
Sample SELECT statements for indexed files with dynamic and sequential access
modes are shown in Example 6–19.
Example 6–19 SELECT Statements for Indexed Files with Dynamic and Default Sequential
Access Modes
(1)
(2)
FILE-CONTROL.
FILE-CONTROL.
SELECT A-GROUP
SELECT TEAS
ASSIGN TO "RFCBA.PRO"
ASSIGN TO "TEA"
ORGANIZATION IS INDEXED
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
RECORD KEY IS LEAVES.
RECORD KEY IS WRITER
ALTERNATE RECORD KEY IS EDITOR.
Because the default file organization is also sequential, both the relative and
indexed examples require the ORGANIZATION IS clause.
Sample SELECT statements for line sequential files with sequential access modes
are shown in Example 6–20.
Example 6–20 SELECT Statements for Line Sequential Files with Sequential Access Modes
(1)
(2)
FILE-CONTROL.
FILE-CONTROL.
SELECT MAMMALS
SELECT VACATION-SPOTS
ASSIGN TO "DOLPHINS"
ASSIGN TO "BAHAMAS"
ORGANIZATION IS LINE SEQUENTIAL
ORGANIZATION IS LINE SEQUENTIAL.
ACCESS MODE IS SEQUENTIAL.
6.3 Creating and Processing Files
Creating and processing sequential, line sequential, relative, and indexed files
includes the following tasks:
1.
Opening the file
2.
Executing valid I/O statements
3.
Closing the file
Sections 6.3.2, 6.3.3, and 6.3.4 describe the specific tasks involved in creating and
processing sequential, relative, and indexed files.
6.3.1 Opening and Closing Files
A Compaq COBOL program must open a file with an OPEN statement before any
other I/O or Report Writer statement can reference it. Files can be opened more
than once in the same program as long as they are closed before being reopened.
Sample OPEN and CLOSE statements are shown in Example 6–21.
6–24 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: ......