Imagine four indexed files (north.dat, south.dat, east.dat and west.dat) which contain for the north, south, east and west of the country the scores achieved by members of a national organisation in a national competition. The COBOL syntax used to define north.dat is shown below:
file-control. select idxfile assign to "north.dat" organization is indexed record key is member-id. data division. file section. fd idxfile record contains 39 characters. 01 idxfile-record. 03 member-id pic 9(6). 03 surname pic x(15). 03 first-name pic x(15). 03 score pic 9(3).
Each of the other files has been created in the same way and the results of the competition have been entered in the files. The following examples use these files.