Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Characteristics of relative file organization

Each record in a relatively organized file is assigned a number which indicates its position in the file: the first record is assigned number 1, the second, number 2 etc.

By specifying a relative key data item in the program, the user can access any record of the file directly (randomly) via its relative record number. In addition to the options provided by sequential file organization, relatively organized files

  • can be randomly created, i.e. records can be placed on the file in any order,

  • can be randomly processed, i.e. records can be retrieved and updated in any order,

  • permit the insertion of records, provided the desired position (relative record number) is not yet occupied,

  • permit the logical deletion of existing records.

For the processing of relative files, COBOL programs use the DMS access methods ISAM and UPAM (see “Introductory Guide to DMS” [4]), which permit several users to update the file simultaneously (see section "Shared updating of files (SHARED-UPDATE)").

Existing files have a defined FCBTYPE. For files to be created, FCBTYPE ISAM is always set unless FCBTYPE PAM has been defined with the ACCESS-METHOD operand of the ADD-FILE-LINK command of FCBTYPE *UPAM (SAM is rejected with an error message).

In the following cases, only FCBTYPE ISAM can be specified:

  • if a variable record length is explicitly specified in the RECORD clause and/or

  • if OPEN EXTEND is specified and/or

  • if READ REVERSED is specified

When a relative file is mapped to ISAM, the 8-byte record key (hexadecimal) is inserted before the start of the record. The relative record key is mapped onto the key of the indexed file.

Relative files can only be stored on disk.

File structure

A description of the file structure of an ISAM file is given in section "Characteristics of indexed file organization".

The following considerations apply to PAM files:

In terms of its logical structure, a PAM file may be seen as a sequence of areas of equal length, each capable of holding one record (only fixed-length records are allowed for PAM files). Each of these areas can be accessed by means of its relative record number.If the file is created sequentially, each of these areas - starting with the first - is filled in turn with a data record; no area can be skipped.

In the case of random creation, each record is written to the area whose relative record number was supplied in the relative key field of the record prior to the output statement. The program computes the associated position in the file on the basis of the specified record number and the record length. Unoccupied areas that are skipped during output are then created as empty records, i.e. the program reserves storage areas equal to the record length and supplies the first byte of each such area with the hexadecimal value FF (HIGH-VALUE), which identifies it as an empty record (see section "Open modes and types of processing (relative files)").
PAM files can only be created on “key disks”, i.e., the BLOCK-CONTROL=PAMKEY entry is needed in the ADD-FILE-LINK command (see section "Disk and file formats").