This routine opens an existing relative file. If it is successful, the value in RETURN-CODE should be moved to a data item that is USAGE HANDLE. This data item is passed as the open file handle to the other file handling routines. If it fails, RETURN-CODE is set to a NULL value.
The R-OPEN-FUNCTION routine takes four required parameters, and one optional parameter: filename, mode, maxsize, minsize, and blocks.
is the name of the file to open. It does not need to be null-terminated.
is one of the following values (defined in filesys.def):
Finput | open for input only |
Foutput | open for output only |
Fio | open for input and output |
Fextend | open for output only (same as Foutput) |
Foutput does not delete the current file (this behavior differs from the OPEN OUTPUT statement in COBOL).
This routine only opens files that already exist. If the file does not exist, the routine fails, even when opening with mode Foutput.
Fread_lock | locks file against other updaters |
Fwrite_lock | locks file against all others |
Fmass_update | locks file against all others (same as Fwrite_lock) |
If Fmass_update is used, the file system is directed to emphasize speed of updates over file security.
Additionally, Fmulti_lock may be added to mode to request that more than one record lock be maintained in the file by this process. If this option is not specified, then any I/O operation on the file will first release any currently locked record. This results in only one record lock being set in the file at any time. When this option is used, locked records are released only when the file is closed or when the UNLOCK routine is called.
is the maximum record size.
is the minimum record size. If maxsize is not equal to minsize, the records are considered variable length.
is the size of a block in bytes. This parameter is optional and defaults to zero (0), meaning that a block is the size of a record.