The system function
POS(field-name) returns an
identification of the field whose name is specified with the system function.
The value returned is an internal representation of the field address.
POS(field-name) may be used to
identify a specific field, regardless of its position in a map. This means that
the sequence and number of fields in a map may be changed, but
POS(field-name) will still uniquely
identify the same field. With this, for example, you need only a single
REINPUT statement to make the field to be
dependent on the program logic.
DECIDE ON FIRST VALUE OF ... VALUE ... COMPUTE #FIELDX = POS(FIELD1) VALUE ... COMPUTE #FIELDX = POS(FIELD2) ... END-DECIDE ... REINPUT ... MARK #FIELDX
If the field specified with
POS is an array, a specific
occurrence must be specified; for example,
POS cannot be applied to an array range.
POS cannot distinguish between two different variables
that start at the same storage position (
REDEFINE variables) since the
internal field address returned by
POS is the same
The system function
POS(field-name) may be used in
conjunction with the Natural system variable
to make the execution of certain functions dependent on which field the cursor
is currently positioned in.
*CURS-FIELD contains the internal
identification of the field in which the cursor is currently positioned; it
cannot be used by itself, but only in conjunction with
POS(field-name). You may use them to
check if the cursor is currently positioned in a specific field and have
processing performed depending on that condition.
IF *CURS-FIELD = POS(FIELDX) MOVE *CURS-FIELD TO #FIELDY END-IF ... REINPUT ... MARK #FIELDY
POS(field-name)serve only as internal identifications of the fields and cannot be used for arithmetic operations.
POS(field-name)for an occurrence of an X-array (an array for which at least one bound in at least one dimension is specified as expansible) may change after the number of occurrences for a dimension of the array has been changed using the
POS(field-name)refer to a context variable, the resulting information can only be used within the same conversation.
*CURS-FIELDidentifies the operand that represents the value of the control that has the input focus. You may use
*CURS-FIELDin conjunction with the
POSfunction to check for the control that has the input focus and perform processing depending on that condition.
POS(field-name)cannot distinguish between two different variables that start at the same storage position (
REDEFINEvariables) since the internal field addresses returned by
POS(field-name)are the same for both variables.