INTEGER


 

The INTEGER instruction defines an unsigned, integer numeric variable of 1, 2, 3, 4 or 8 bytes. Integers are extremely useful for high-speed loop or arithmetic processing. It uses one of the following formats:

 

(1)

[label]

INTEGER

[%][*]{size}

(2)

[label]

INTEGER

[%][*]{size},{value}

(3)

[label]

INTEGER

[%][*]{size}({arraysize})

(4)

[label]

INTEGER

[%][*]{size}({arraysize}),({value}),..,({value})

(5)

[label]

INTEGER

[%][*]{size}({arraysize},..,{arraysize})

(6)

[label]

INTEGER

[%][*]{size}({arraysize},..,{arraysize}):

 

 

 

({value}),..,({value})

(7)

[label]

INTEGER

^

(8)

[label]

INTEGER

^,{variable}

(9)

[label]

INTEGER

^ ({arraysize},...)[,({target}),...,({target})]

(10)

[label]

INTEGER

%%

(11)

[label]

INTEGER

[*][%]{size}({arraysize}), INITIAL {dvalue}, ...

(12)

[label]

INTEGER

({arraysize})@

(13)

[label]

INTEGER

@()

(14)

[label]

INTEGER

@(,)

(15)

[label]

INTEGER

@(,,)

(16)

[label]

INTEGER

{value}

 

Where:

label

Optional. A Data Definition Label.

%

Optional. Denotes the item as being GLOBAL.

%%

Optional. Denotes the item as GLOBAL but does not initialize it in any way.

*

Optional. Denotes the item or file as being COMMON.

size

Required. A decimal constant or EQUATEd value of 1, 2, 3, 4 or 8 (9.0) indicating the integer size.

value

Required. A numeric Literal (i.e., "345").

arraysize

Optional. An integer decimal constant, CONST variable or EQUATEd value indicating the number of array items.

target

Optional. A previously declared INTEGER variable that initializes the array.

^

Optional. Denotes the item as being a POINTER.

variable

Required. The name of a previously defined variable of the same type.

Flags Affected: NONE

Note the following:

  1. All INTEGERS are unsigned (positive values only). If an initial value ({value}) is not specified, the variable is set to zero.

  2. INTEGERS are stored internally in the byte order format of the system in use (LSB/MSB reverse order (Intel based systems), MSB/LSB forward order (AT&T, Western Electric, Hewlett-Packard, Motorola based systems). The interpreter handles the transfer to and from DIMs/FORMs to insure consistent results. (Note: INTEGERs may be moved to a DIM or FORM before the data is written to disk to provide transportability.)

  3. Any operation in which the result is larger than the destination discards the high order (most significant) bytes exceeding the destination variable's size.

  4. To insure no loss of significant data in any operations mixing FORMS and INTEGERS:

  5. If format (2), (4) or (6) is used, {value} must be a valid decimal string within quotes ("").

  6. An INTEGER may be used any place a FORM is valid except for KEYIN, DISPLAY, and PRINT. (PLBCMP also supports INTEGERS in AND, NOT, OR, TEST, and XOR.)

  7. The ^ denotes a Pointer Variable.

  8. If the % form is used, the data item is placed in the Global Data Area. The variable is then available to other programs that also declared it with the percent form. Global Data Items are available with PLBCMP only.

  9. If the %% form is used, the data label is placed in the Global Data Area but no initialization takes place if it has not already been defined in the Global Data Area. If an array data label is placed in the Global Data Area, when initialized, it must have the same number of elements in the array. Global Data Items are available with PLBCMP only.

  10. If the * form is used, the data item is in common with other programs and all of the rules of COMMON must be followed.

  11. If an array is defined, each element may have a label.

  12. Formats (11) through (16) are only valid when the SWDBC mode of the compiler is enabled (-zc=3).

  13. Generate/bullet1.gif    Format (11) provides a new array initialization syntax. The {dvalue} in this syntax form is a decimal immediate value without double quote characters.

    Generate/bullet1.gif    Format (12) provides a new INTEGER syntax for an array of FORM pointers.

    Generate/bullet1.gif    Format (13) provides a new INTEGER array pointer construct. The INTEGER array pointer can contain an address of a INTEGER array.

    Generate/bullet1.gif    Format (14) provides a two-dimensioned INTEGER array pointer construct. The two-dimensioned INTEGER array pointer can contain an address of a two-dimensioned INTEGER array.

    Generate/bullet1.gif    Format (15) provides a three-dimensioned INTEGER array pointer construct. The three-dimensioned INTEGER array pointer can contain an address of a three-dimensioned INTEGER array.

    Generate/bullet1.gif    Format (16) allows specification of an INTEGER where the {value} is a numeric literal without a size specification. In this case, the INTEGER size defaults to an four byte integer.

 

 

See Also: Example Code, FORM, Numeric Strings, Data Definitions

 



PL/B Language Reference BOOLEAN LABEL