Enform Plus Reference Manual

Enform Plus Language Elements
Enform Plus Reference Manual422684-001
3-8
Subscripts
advantage of the form record-name.KEY is that you do not need to know the name
of the primary key field to reference it. A listing of the primary key values of the parts
file can be obtained by the following:
OPEN parts;
LIST parts.KEY;
The record with the primary key value of 1403 can be referenced by:
WHERE parts.KEY = 1403
For files with relative file structure, the primary key is a record number. The record
number is the ordinal position of the record relative to the beginning of the physical file.
The first record in the physical file has position zero. A listing of the primary keys of a
relative file can be obtained by:
OPEN rell;
LIST KEY OF rell;
The primary key of the fifth record in the file can be referenced by:
WHERE KEY OF rell = 4
Remember, the fifth record in a file with relative file structure has position four because
the first record is in position zero.
For entry-sequenced and unstructured files, the primary key is a record address-the byte
address of the record's block plus the relative record number within the block. A record
address is always an even number. For more information about file structures, see the
Enscribe Programmer’s Guide.
A listing of the primary keys of an entry-sequenced file can be obtained by:
OPEN entryseq;
LIST entryseq.KEY;
The third record in the file entryseq has a primary key whose byte offset is 16. The
record can be referenced by:
WHERE entryseq.KEY = 16
For more information about file structures, see the Enscribe Programmer’s Guide.
Subscripts
Subscripts, although they are not required, are usually used to reference elements in a
user table or database table. (A database table is created when the dictionary description
of a database field contains an OCCURS clause.) Subscripts are needed for references to
user tables and database tables because all the elements in such tables have the same
name. Subscripts can be used in references to database fields and user variables,
although they are not necessary.