Records of a relative file may be randomly created, read, and updated. With this access method, the RELATIVE KEY phrase is always required. Before each execution of an input statement or output statement, the data item indicated in RELATIVE KEY phrase must be provided with the value of the required relative record number.
A relative file may be created randomly; in this case, the record placed on the file occupies the record area of the relative record number as specified in the RELATIVE KEY data item. When a relative file is read randomly, the retrieved record is the one whose relative record number is contained in the data item of the RELATIVE KEY phrase associated with that file.
An already existing relative file may be updated with the aid of REWRITE or DELETE statements. An explicit random READ statement may optionally be issued prior to the execution of a REWRITE or DELETE statement for the record to be updated, as these statements will modify the record that is denoted by the relative record number in the RELATIVE KEY data item.