FILE
ANSI
The FILE instructions define files that are used for sequential or random file I/O. Sequential files read or write data in sequential order, while random files read or write data sequentially or directly by random record number. The instruction uses one of the following formats:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Where:
label
Optional. A Program Execution Label.
%
Optional. Denotes the item as being GLOBAL.
*
Optional. Denotes the item as being COMMON.
arraysize
Optional. An Integer decimal constant, CONST variable or equated value indicating the number of array items.
parm
Optional. One of the valid parameters listed below.
^
Optional. Denotes the item as being a POINTER.
target
Optional. A previously declared FILE variable that initializes the array.
%%
Optional. Denotes the item as GLOBAL but does not initialize it in any way.
Flags Affected: NONE
Note the following:
A FILE must have been defined with a FILE Definition instruction before being referenced in a file I/O instruction. An RFILE is treated as a FILE by the compiler.
{parm} is optional. The supported parameters are:
BUFFER={nnnn | nvar | exp}
COBOL
COMP or COMPRESSED
DYNAMIC
FIX={nnnn | nvar | exp} or FIXED={nnnn | nvar | exp}
FORMAT={MSDOS | UNX | BINARY}
OVERLAP
UNCOMP or UNCOMPRESSED
VAR={nnnn | nvar | exp} or VARIABLE={nnnnn | var | exp}
VIEW={viewname}
Additional parameters supported when using Datapoint Corporation's RMS Remote Access Server (RMSRAS) are as follows:
FORMAT={BINARY | BIT8 | RMS | RMSUNCOMP}
INCREMENT={nn}
LENGTH={nn}
STATIC={nn}
If none of the above parameters are given, BUFFER=256 is assumed. This establishes a buffer and sector length of 256 bytes for all I/O operations.
If the operand field begins with an asterisk (*), the file is a Common Data Item. An attempt is made to maintain the OPEN status (with existing file pointers intact) of a corresponding file declaration in the program that initiated the chain. However, if the UDA of the chained to program is not in alignment (same File Definition types, sizes, and locations) with those in the program that initiated the CHAIN, a CHAIN error occurs.
The ^ denotes a Pointer Variable.
If the % form is used, the data item is placed in the Global Data Area. The variable would be available to other programs that also declared it with the percent form. Global Data Items are available with PLBCMP only.
If the %% form is used, the data label is placed in the Global Data Area but no initialization takes place if it has not already been defined in the Global Data Area. Global Data Items are available with PLBCMP only.
Array definition and referencing is handled in the same manner as DIM variables.
See Also: Example Code, File Definitions, Disk I/O Instructions
![]() |