To define a relative file with a record length of 80 characters:
file-control. select relfil assign to "relfil.dat" organization is relative access mode is random relative key is relfil-key. file section. fd relfil record contains 80 characters. 01 recseq-fd-record pic x(80). ... working-storage section. 01 relfil-key pic 9(8) comp-x.
The record key is relfil-key. When you are randomly accessing this file, there is no KEY IS field on the READ statement, the number in relfil-key determines which record is read. For sequential access, a simple READ NEXT statement gets the next record.