1.1.9 Integer
Integers are whole numeric fields and are signed by default. Fields of type Integer have a length measured in bytes (1, 2, 4, 8). For example, a signed Integer of Byte Length 2, can store values from -32768 to +32767. Integers have no decimal places and are accurate. Integers are classed as Numbers in LANSA.
The following table provides the implied length for each of the possible byte lengths for an Integer. The implied length is equivalent to the actual length of a signed or packed field.
|
Please review the general 1.1.1 Field Type Considerations.
Field Definition Rules
Rules for defining an Integer in the repository are:
Length |
Integers may be 1, 2, 4, or 8 bytes in length. Integers have no decimals. |
Valid Keyboard Shift |
Blanks |
Allowed Attributes |
AB, ASQN, CS, FE, ND, RA, RB, RL, RLTB, SUNS |
Edit Mask |
Use of an Edit Mask (i.e. an Editcode or Editword) is allowed if the Integer is signed. Integer does not allow edit codes W and Y. May use *DEFAULT. |
Default |
*NULL |
Field Definition Notes
-
By default, Integers are signed.
-
SUNS is only supported for one byte integers initially. If SUNS is enabled, it means the Integer cannot hold negative numbers, and so it will have a higher maximum value. An Integer(1) without SUNS ranges from -128 to +127, while an Integer(1) with SUNS ranges from 0 to 255.
Usage Rules
Partition Type |
|
Files |
Integers may only be used in RDMLX Files. Integers may be used as real fields or keys. |
Logical Views |
Integers may be used as keys to logical views. |
Virtual Fields |
Integers may be used with Mathematical Virtual Fields. Integers may be used as the source field(s). Integers may be used with Code Fragment Virtual Fields. Integers must not be used with Substring, Concatenation or Date Virtual Fields. |
Predetermined Join Fields |
Integers may be used for numeric predetermined joined fields. |
RDML Commands |
Fields of type Integer may be used as a command parameter anywhere Numeric fields may be used, except where digits after the decimal point are required/expected. |
Built-In Functions |
When used in Built-In Functions, integers are valid for arguments of type 'N'. |
Special Values |
*NULL, *NAVAIL, *HIVAL, *LOVAL, *REMEMBERED_VALUE |
Conversion |
It is wrong to convert Integers to/from Date and Time fields. Refer to Field Type Conversions. |
Usage Notes
-
Working fields may be defined as TYPE(*INT) in functions or components. If no length is specified, the default of 4 is assumed. The default value will be *ZERO.
-
When used in Built-In Functions, integers are valid for arguments of type 'N'. Fields of type Integer may only be used as numeric arguments or return values under the following conditions:
-
The minimum decimals for the argument or return value is 0.
-
The minimum length for the argument or return value is less than or equal to the implied length of the Integer field. For example, if the minimum length for the argument is 4, an Integer of 1 byte may not be used (as it only has an implied length of 3).
-
The maximum length for the argument or return value is 2147483647 OR the maximum length for the argument or return value is greater than or equal to the implied length of the Integer field. For example, if the maximum length for an argument is 4, an Integer of 2, 4, or 8 bytes may not be used (as they have implied lengths of 5 or higher).
Platform Considerations
-
Refer to Platform Considerations in 1.1.1 Field Type Considerations.
Also See