COBOL: How to Write Logic For Relative Files

relative file consists of a specified number of areas. Each of these areas can contain a record, or it can be empty. To identify an area in a relative file, you would need to use a relative record number (RRB) – that indicates the area’s relative position in the file.

Writing Select Statement

Writing Select Statement

system-name is equal to DD name. In the Select statement we write as:

SELECT INVMAST  ASSIGN TO INVMAST
                ORGANIZATION IS RELATIVE
                ACCESS IS SEQUENTIAL/RANDOM
                RELATIVE KEY IS INVMAST-RR-NUMBER.

Open Files Statement

Open Files Statement

Start Record Statement

Start Record Statement

Delete Record Statement

DELETE file-name RECORD
    [INVALID KEY imperative-statement-1]
    [NOT INVALID KEY imperative-statement-2]
    [END-DELETE]

Closing file Statement

CLOSE file-name.

Related Posts

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.