FILE Examples
Example 1:
|
|
|
DEFFILE may be used for sequential or random file I/O. Since no parameter was specified, the logical sector and buffer sizes are the default (256 bytes). For random I/O, record zero would begin at the first byte in the file, record one at the 257th byte and so forth.
Example 2:
|
|
|
|
BUFFILE may be used for sequential or random file I/O. Its defined logical sector and buffer sizes are set to 8192 bytes. If BUFFILE were used for random I/O, record 0 would begin at the 1st byte in the file, record 1 at the 8193rd, record 2 at byte 16385th and so forth.
Example 3:
|
|
|
|
(or)
|
|
|
|
FIXFILE may be used for sequential or random file I/O. Its defined logical sector and buffer sizes are 4098 bytes for MS-DOS and 4097 bytes for Linux (FIX/FIXED size plus the appropriate EOR). For random I/O, record zero would begin at the first byte in the file, record one would begin at the 4099th (MS-DOS) or 4098th (Linux) byte, record two would begin at the 8197th (MS-DOS) or 8195th (Linux) byte and so forth since sufficient space for the EOR was automatically added.
Example 4:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PTRFILE is a Pointer Variable that contains the address of another FILE variable at execution time. This assignment is usually accomplished via the parameterized CALL instruction. Once initialized, PTRFILE may be used as any other FILE variable. It takes on all the attributes of the pointed to FILE variable.
Example 5:
|
|
|
|
This instruction defines a global file. It is kept open during the CHAIN instruction.
Example 6:
|
|
|
|
This instruction defines a global file whose attributes are undefined. Prior to being opened, it must be defined by performing a LOADMOD instruction or a CALL instruction of a separately compiled routine that defines the file with a '%' operator.
Example 7:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This instruction defines a global file that is associated with a database and a view.
![]() |