An INTEGER declaration declares simple variables that can have integer values, that is, arithmetic values that have exponents of 0 (zero) and no fractional parts.
<integer declaration>
┌◄───────── , ────────┐ ──┬───────────┬─┬───────┬─ INTEGER ─┴─┬─<identifier>────┬─┴────────────┤ ├─ PRIVATE ─┤ └─ OWN ─┘ └─<equation part>─┘ └─ PUBLIC ──┘
An identifier that is associated with the INTEGER data type in an INTEGER declaration.
The PRIVATE and PUBLIC specifiers can only be used for simple variables that are declared within a structure block or a connection block. The PRIVATE specifier limits visibility of the simple variable to the scope of the structure block or the connection block. A PRIVATE simple variable cannot be accessed using a structure or connection block qualifier. The PUBLIC specifier allows the simple variable to be accessed using a structure or connection block qualifier. If neither PRIVATE nor PUBLIC is specified, the default value is PUBLIC and access to the simple variable using a structure or connection block qualifier is allowed.
A simple variable declared to be OWN retains its value when the program exits the block in which the variable is declared, and that value is again available when the program reenters the block in which the variable is declared.
When an arithmetic value is assigned to an integer simple variable, the value is rounded to an integer, if possible, before it is stored in the simple variable.
When an integer simple variable is allocated, it is initialized to 0 (zero) (a 48-bit word with all bits equal to zero).
See Data Representation for additional information on the internal structure of an integer operand.
| Note: | In general, it is not recommended to use the INTEGER data items containing the values in which particular bit patterns or settings must be retained. In particular, when bits 47 and 45 are set in an item or expression whose value is to be stored to an INTEGER, the original settings of these bits might not be preserved if the item was declared REAL. When bit 46 is set in an item or expression that has a numeric value zero (0) stored in an INTEGER, the original setting of that bit might not be preserved if the item was declared REAL. If an INTEGER declaration is required for other reasons, the contents of those bits might be preserved by using a REAL data item, which has an equation part specifying INTEGER as the destination. For more information, see Type Coercion of One-Word and Two-Word Operands. |

