DESCRIBE - Determining the Distance Between Two Fields

Basic form

DESCRIBE DISTANCE BETWEEN f1 AND f2 INTO f3.

Extras:

1. ... IN CHARACTER MODE

2. ... IN BYTE MODE

Effect

The distance between the fields f1 and f2 is returned in f3 (in bytes). The length of the field that comes before the other field in the memory is always included. The value returned in f3 is of the type I. You must use one of the two additions.

Example

Determine the distance between two components of the sample table SBOOK in the flight booking system:

DATA SBOOK_WA TYPE SBOOK.
DATA DIST TYPE I.
DESCRIBE DISTANCE BETWEEN SBOOK_WA-CARRID
                  AND     SBOOK_WA-BOOKID
                          INTO    DIST IN BYTE MODE.

Result: DIST contains the value 15 since exactly two fields occur between the SBOOK components CARRID and BOOKID: SBOOK-CONNID (4 bytes) and SBOOK-FLDATE (8 bytes). SBOOK-CARRID itself is 3 bytes long. The sum of these values is the distance between the field beginnings in bytes.

Addition 1

... IN CHARACTER MODE

Effect

If you use the addition IN CHARACTER MODE, the statement returns the distance in characters.

Addition 2

... IN BYTE MODE

Effect

If you use the addition IN BYTE MODE, the statement returns the distance in bytes.

Additional help

Determining theAttributes of Data Objects