COBOL Manual for TNS and TNS/R Programs
Disk Input and Output
HP COBOL Manual for TNS and TNS/R Programs—522555-006
28-18
Creating and Using HP COBOL Indexed Files
An HP COBOL program can create, read, write, and purge indexed files. An
HP COBOL program must use the FILE_CREATE_ procedure to create an indexed file
that has alternate keys.
An HP COBOL program cannot directly create an indexed file that has alternate keys,
because the operating environment maintains the alternate keys in one or more
separate files, whose names are recorded with the operating environment information
about the indexed file (see Alternate Record Keys).
An HP COBOL program can create an indexed file that does not have alternate keys
simply by describing the file as having indexed organization (but without alternate
keys) and opening the file for OUTPUT, EXTEND, or I-O. The HP COBOL run-time
routines create the indexed file.
These FUP commands declare the same indexed file as the preceding HP COBOL
code:
SET TYPE K
SET EXT (1000 RECS, 2000 RECS)
SET REC 200
SET BLOCK 2048
CREATE $COBOL.PROGS.JAKE
Example 28-8. Indexed File Without Alternate Keys
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INDFILE
ASSIGN TO "$COBOL.PROGS.JAKE"
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
RECORD KEY IS JAKE-KEY.
...
DATA DIVISION.
FILE SECTION.
FD INDFILE
RECORD CONTAINS 5 TO 200 CHARACTERS
LABEL RECORDS ARE OMITTED.
01 IND-RECORD.
...
WORKING-STORAGE SECTION.
...
01 KEYS-GROUP.
03 JAKE-KEY PIC X(18).