OPEN-FUNCTION
This function opens an existing indexed 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 functions.
If it fails, RETURN-CODE is set to ZERO.
After the file is opened, the primary key is set as the current key of reference and it is positioned at the beginning of the file.
This function only opens already existing files. If the file does not exist, the function fails, even when opening for output.
Syntax
 SET OPEN-FUNCTION TO TRUE
 
 CALL "I$IO" USING IO-FUNCTION
                   name
                   mode
                   lParms
            GIVING returnCode
Parameters:
name
the name of the file to open.
mode
one of the following values (defined in isfilesys.def):
 
Finput
Foutput
Fio
Fextend
Open for input only.
Open for output only.
Open for input and output.
Same as Foutput.
mode may also have one of the following flags (defined in isfilesys.def) added to it to indicate file locking options:
Fmulti_lock
Fread_lock
Fwrite_lock
Fmass_update
FEncrypt
Ftrans
FBulk_addition
Keep locks on multiple records.
Locks file against other updaters.
Locks file against all others.
Same as Fwrite_lock.
Consider the file as encrypted.
Extends locking rules for transaction management.
Same as Fwrite_lock.
lParms
The l_parms parameter is the same as the l_parms parameter passed when using the MAKE-FUNCTION opcode.
 
This parameter is a string that contains three comma-separated numbers.
 
Valid values are (in order):
the maximum record size,
the minimum record size,
the number of keys for the file,
 
If the maximum record size does not match the minimum record size, then variable sized records are implied.
 
If the parameter is initialized, the runtime retrieves the values from the file during the open. If the parameter is set, some file handlers may return an error if it doesn’t match with the actual characteristics of the file.
Return code:
returnCode can be any signed numeric data item and provides additional information:
>0
File handle.
0
Operation failed.