ARTICLE
Additions for Determining Length and Distance
The DESCRIBE FIELD f OUTPUT-LENGTH len statement returns
the output length of a field. The length is always returned in
characters. If f is a structure containing non-character-type
components, the system returns the output length 0.
The DESCRIBE FIELD and
DESCRIBE DISTANCE statements determine
the field length or the distance between two fields. You must specify
the IN BYTE MODE or IN CHARACTER MODE addition for the
following variants under Unicode:
DESCRIBE FIELD f LENGTH len IN BYTE MODE.
Ascertains the length of the field f in bytes and passes it to
the field len . This variant returns the length of the reference,
and not the length of the contents, for all internally referenced data
types (strings as well as field and object references). Thus you can
only use the IN BYTE MODE variant for these fields.
DESCRIBE FIELD f LENGTH len IN CHARACTER MODE.
Ascertains the length of the field f in characters and passes it
to the field len , provided the argument is purely
character-type. f must not have the type STRING . The
relevant check is performed statically and dynamically and triggers a
syntax or runtime error, depending on the type.
DESCRIBE DISTANCE BETWEEN a AND b INTO x IN BYTE MODE.
Returns the distance between the fields a and b in bytes
and stores it in the field x .
DESCRIBE DISTANCE BETWEEN a AND b INTO x IN CHARACTER MODE.
Returns the distance between the fields a and b in
characters, such that the result always refers to the start of the
field. The system only checks at runtime to see whether or not the
distance between the arguments ca be divided by the platform-specific
length in characters, and whether or not both fields a and b have the
right alignment. If either of these conditions is not fulfilled, the
system returns a runtime error.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved