The R$IO routine provides an interface to the relative file handler. Calls to the routine require an operation code and a variable number of parameters, depending on the operation called. The return code is set automatically after the call. The external variable F-ERRNO is set according to any errors found. F-ERRNO may not be reset on entry to R$IO, and should be checked only if R$IO returns an error condition.
CALL "R$IO" USING OP-CODE, PARAMETERS
Specifies the file handling routine to be performed. The following table lists each op-code and its corresponding operation. The operations are detailed below:
Code | Operation |
---|---|
1 | R-OPEN-FUNCTION |
2 | R-CLOSE-FUNCTION |
3 | R-MAKE-FUNCTION |
4 | R-READ-FUNCTION |
5 | R-NEXT-FUNCTION |
6 | R-PREVIOUS-FUNCTION |
7 | R-START-FUNCTION |
8 | R-WRITE-FUNCTION |
9 | R-REWRITE-FUNCTION |
10 | R-DELETE-FUNCTION |
11 | R-UNLOCK-FUNCTION |
The remaining parameters vary depending on the operation selected. They provide information and hold results for the operations specified. Parameters may be omitted from those operations that do not require them. The parameters are detailed below.
All parameters passed to R$IO are passed by reference. This applies even to parameters that are integer values in the corresponding file handling routines.
R$IO automatically terminates PIC X filename parameters with a LOW-VALUES byte.
You do not have to specify SYNC for level 01 or level 77 parameters because they are automatically synchronized by ACUCOBOL-GT.
The filesys.def COPY file contains many useful definitions for use with R$IO. It contains definitions for the R$IO op-codes as well as the F-ERRNO error values. It also includes many useful pre-declared variables that are of the proper type and usage.
The runtime configuration variables FILE_PREFIX and FILE_SUFFIX are ignored by the R$IO routine.