Subscript Referencing [ HP ALLBASE/4GL Developer Reference Manual Vol. 1 ] MPE/iX 5.0 Documentation
HP ALLBASE/4GL Developer Reference Manual Vol. 1
Subscript Referencing
You can define a field on any of the following as having more than one
occurrence:
* An HP TurboIMAGE/iX data set.
* A serial file.
* An indexed KSAM file record.
* A work file record.
* A work area.
Typically this situation would occur if all the fields held similar data.
For example, you may require multiple lines of a description, and want to
use the same name for each field. You can reference each field by the
same name. HP SQL tables cannot use subscripted column definitions.
You can only use subscripts with dictionary field specifications. The
dictionary definition (refer to chapter 5) for these fields must specify
that they have more than one occurrence.
To use a subscript reference, you must enclose the subscript in
parentheses immediately after the field name. The subscript reference
must appear before any substring reference.
Format
F-data_reference(subscript).qualifier
W-data_reference(subscript).qualifier
Parameters
data-reference A dictionary field specification reference.
subscript The number of the occurrence of the field being referenced.
This can be one of the following, containing the number of the subscript
to be used:
* A number.
* A numeric constant.
* A numeric variable or calculated item.
* A screen field reference.
* A scratch-pad field reference.
* A file record field reference.
* A work area field reference.
The term specifying the number of the occurrence cannot contain subscript
or substring references.
qualifier The name of the file (optionally followed by a record layout
name) or the name of the work area containing the field.
Example 1
F-desc(*).stockdet
This example references an occurrence of the field desc in the file
stockdet, where the current screen field contains the subscript of the
actual occurrence to be referenced.
The value contained in the current screen field must not exceed the
number of occurrences defined for the field desc.
Example 2
F-desc(2)[1,10].stock
This example references the first ten characters of the second occurrence
of the field desc on the file buffer stock.
MPE/iX 5.0 Documentation