Processing Files and Records
6.2 Identifying Files and Records from Within Your Compaq COBOL Program
Example 6–15 (Cont.) Specifying Indexed File Organization and Dynamic
SELECT FLAVORS ASSIGN TO "DAIRY"
FILE SECTION.
FD FLAVORS.
01 ICE-CREAM-MASTER.
02 ICE-CREAM-MASTER-KEY
02 ICE-CREAM-MASTER-DATA.
03 ICE-CREAM-STORE-CODE
03 ICE-CREAM-STORE-ADDRESS
03 ICE-CREAM-STORE-CITY
03 ICE-CREAM-STORE-STATE
A00-BEGIN.
.
.
.
Example 6–15 defines a dynamic access mode indexed file with one primary
key and two alternate record keys. Note that one alternate record key allows
duplicates. Any program using the identical entries in the SELECT clause as
shown in Example 6–15 can reference the DAIRY file sequentially and randomly.
Refer to the Compaq COBOL Reference Manual for information relating to the
RECORD KEY and ALTERNATE RECORD KEY clauses.
Example 6–16 defines a line sequential file.
Example 6–16 Specifying Line Sequential File Organization with Sequential
IDENTIFICATION DIVISION.
PROGRAM ID. EX0616.
ENVIRONMENT DIVISION.
INOUT-OUTPUT SECTION.
SELECT MUSIC ASSIGN TO "CLASSICAL"
FILE SECTION.
FD MUSIC.
01 OPERA
PROCEDURE DIVISION.
A00-BEGIN.
.
.
.
File organization is discussed in more detail in Section 6.1.1. Record access mode
is discussed in the following section.
6–22 Processing Files and Records
Access Mode for an Indexed File
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
RECORD KEY IS ICE-CREAM-MASTER-KEY
ALTERNATE RECORD KEY IS ICE-CREAM-STORE-STATE
WITH DUPLICATES
ALTERNATE RECORD KEY IS ICE-CREAM-STORE-CODE.
Access Mode
ORGANIZATION IS LINE SEQUENTIAL.
PIC X(9).
PIC XXXX.
PIC XXXXX.
PIC X(20).
PIC X(20).
PIC XX.
Need help?
Do you have a question about the COBOL AAQ2G1FTK and is the answer not in the manual?
Questions and answers