AFILE
ANSI
The AFILE instruction defines an Associative Access Method (AAM) file. AAM is a method of retrieving data records using one or more free form key specifications. It 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 AFILE 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:
An AFILE label must have been defined with a File Definition instruction before being referenced in a file I/O instruction.
AFILE definitions reference two physical files
on the system. These files perform particular functions within the AAM implementation as follows:
|
File |
Use |
|
TXT |
The data file containing all of the text records for this AFILE. |
|
AAM |
The associative index to the records in the TXT file. It also monitors deleted record space for re-use when appropriate and contains the TXT file name (including the drive &/or path). |
{parm} is optional. The supported parameters are:
BUFFER={nnnn | nvar | exp}
COMP or COMPRESSED
DYNAMIC
FIX={nnnn | nvar | exp} or FIXED={nnnn | nvar | exp}
FORMAT={MSDOS | UNX | BINARY}
NAME={value}
NOPATH
SEARCHCNT={nn}
UNCOMP or UNCOMPRESSED
VARIABLE={nnnn | nvar | exp}
VIEW={viewname}
WEOF
Additional parameters supported when using Datapoint Corporation's RMS Remote Access Server (RMSRAS) are as follows:
AIMBUFFS={nn}
FORMAT={BINARY | BIT8 | RMS | RMSUNCOMP}
INCREMENT={nn}
LENGTH={nn}
STATIC={nn}
Where necessary (and/or desired), these parameters may be combined, such as:
BUFFER and WEOF
COMPRESSED and SEARCHCNT
VARIABLE and COMPRESSED
If an AFILE contains compressed records, the value specified for the buffer must be at least two (2) times as large as the longest record(s) in the file. At compile time, if the file is specified as being compressed, the buffer is automatically doubled. However, if the file is specified as fixed and at file OPEN time, it is compressed, the buffer may actually be too small. If the buffer is too small, an I/O error occurs.
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.
It is not recommended that AFILEs be used on diskette based systems.
Most parameters specified on the AFILE definition are overridden at execution by the actual characteristics of the file. The exception to this rule is the actual (maximum if variable length or space compressed records) record length specified with BUFFER, FIXED, or VARIABLE parameters.
Care should be used if performing UPDATEs against variable length or space compressed records. It is possible to physically damage the text file. UPDATEs are not recommended with space compressed data files.
When an ISAM or AAM file is created with variable length or space compressed records, all secondary ISIs and AAMs should be created with the same characteristics.
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.
An AFILE array variable may be declared within a FILELIST/FILELISTEND declaration.
See Also: Example Code, File Definitions, Disk I/O Instructions
![]() |