Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Language Reference Manual

POSITION attribute

The POSITION attribute can be used only with string-overlay defining and specifies the bit, character, graphic or widechar within the base variable at which the defined variable is to begin.

The expression in the POSITION attribute specifies the position relative to the start of the base variable. The value specified in the expression can range from 1 to n, where n is defined as

n = N(b) - N(d) + 1

where N(b) is the number of bits, characters, graphics or widechars in the base variable, and N(d) is the number of bits, characters, graphics or widechars in the defined variable.

The expression is evaluated and converted to an integer value at each reference to the defined item.

If the POSITION attribute is omitted, POSITION(1) is the default.

When the defined variable is a bit class aggregate:

The base variable must refer to data in connected storage.

Examples:

DCL C(10,10) BIT(1),
    X BIT(40) DEF C POS(20);

X is a bit string that consists of 40 elements of C, starting at the 20th element.

DCL E PIC'99V.999',
    Z1(6) CHAR(1) DEF (E),
    Z2 CHAR(3) DEF (E) POS(4),
    Z3(4) CHAR(1) DEF (E) POS(2);

Z1 is a character string array that consists of all the elements of the decimal numeric picture E. Z2 is a character string that consists of the elements '999' of the picture E. Z3 is a character-string array that consists of the elements '9.99' of the picture E.

DCL A(20) CHAR(10),
    B(10) CHAR(5) DEF (A) POSITION(1);

The first 50 characters of B consist of the first 50 characters of A. POSITION(1) must be explicitly specified. Otherwise, simple defining is used and gives different results.


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)