Element Reference Syntax in Procedure Files

SIZEOF_ElementName

DECSIZEOF_ElementName

You can use the size or the number of decimals of an element in the database definition as constants in place of integers in a Lawson 4GL procedure file (ProgramCode PD). The Lawson precompiler converts SIZEOF_ElementName and DECSIZEOF_ElementName to integers at the time of shell generation for COBOL.

Directive Description
SIZEOF_ElementName This directive instructs the precompiler to determine the size, as defined in the database definition, of ElementName and use that size in the procedure as an integer value.
DECSIZEOF_ElementName This directive instructs the precompiler to determine the number of decimals, as defined in the database definition, of ElementName and use that number in the procedure as an integer value.

Example - Using SIZEOF_ in a PERFORM Loop

You could perform a loop filling an array until the size of an element is reached. The following procedure

PERFORM
    VARYING SUB FROM 1 BY 1
    UNTIL   (SUB > 30)
        MOVE WS-VAR-LVL-DIGIT(SUB) TO WS-BREAK-VAR-LVL-DIGIT(SUB)
END PERFORM

becomes

PERFORM
    VARYING SUB FROM 1 BY 1
    UNTIL   (SUB > SIZEOF_VAR-LEVELS)
        MOVE WS-VAR-LVL-DIGIT(SUB) TO WS-BREAK-VAR-LVL-DIGIT(SUB)
END PERFORM