HP 3000 Manuals

Data Item Sizes [ HP Transact Reference Manual ] MPE/iX 5.0 Documentation


HP Transact Reference Manual

Data Item Sizes 

The size of a data item is specified by indicating the number of
characters or digits you want in each data item.  Transact determines how
much storage space is required for that number of characters or digits
based on the data item type.  You may override the default storage space
either by specifying an exact storage size or the number of decimal
digits--the number of digits you want to the right of the decimal point
in a numeric data item.  Be sure that space is allocated for the decimal
point when you are computing data item sizes.

When data items are displayed, Transact generally requires the same
number of display characters as the size specified in the DEFINE(ITEM)
statement.  Numeric data items must allow an additional character for the
sign unless the item is positive only.  When determining the space needed
for displaying, add a space for the sign, even if the value to be
displayed happens to be positive.

The following example identifies each of the values used in an item
definition:

[]
Table 3-2. Data Item Size --------------------------------------------------------------------------- | | | | | | Transact | Transact Default | Transact Display | COBOL | | Type | Storage Allocation | Requirements | Type | | | | | | --------------------------------------------------------------------------- | | | | | | X or U | ASCII character | Same as storage. | DISPLAY PIC X | | | string; 1 storage | | or | | | byte per specified | | DISPLAY PIC A | | | character. | | | | | | | | --------------------------------------------------------------------------- | | | | | | 9 | ASCII numeric string, | Same as storage. | DISPLAY PIC X | | | positive only; 1 | | | | | storage byte per | | | | | specified digit. | | | | | | | | --------------------------------------------------------------------------- | | | | | | I* | Binary integer; | 1 character per | | | | default storage | digit or decimal | | | | length depends on | point, plus one | | | | item size: | character for a | | | | | sign, unless item | | | | | is positive only: | | | | | | | - - - - - | | I(1) to I(4) = 2 | | COMP S9 | | | bytes | | to S9(4) | | | | | | - - - - - | | I(5) to I(9) = 4 | I+(5) = 5 chars | COMP S9(5) | | | bytes | I(5) = 6 chars | to S9(9) | | | | I(5,2) = 6 chars | | | | | | | - - - - - | | I(10) to I(18)=8 | | COMP S9(10) | | | bytes | | to S9(18) | | | | | | - - - - - | | I(19) to I(27)=12 | | (none) | | | bytes | | | | | | | | --------------------------------------------------------------------------- Table 3-2. Data Item Size (cont.) --------------------------------------------------------------------------- | | | | | | Transact | Transact Default | Transact Display | COBOL | | Type | Storage Allocation | Requirements | Type | | | | | | --------------------------------------------------------------------------- | | | | | | J* | COBOL binary type; | | | | | (use for consistency | | | | | with TurboIMAGE type | | | | | J): | | | | | | | | - - - - - | | J(1) to J(4) = 2 | | COMP S9 | | | bytes | | to S9(4) | | | | | | - - - - - | | J(5) to J(9) = 4 | J(5) = 5 chars | COMP S9(5) | | | bytes | J(5) = 6 chars | to S9(9) | | | | J(5,2) = 6 chars | | | | | | | - - - - - | | J(10) to J(18) = 8 | | COMP S9(10) | | | bytes | | to S9(18) | | | | | | - - - - - | | J(19) to J(27) = 12 | | (none) | | | bytes | | | | | | | | --------------------------------------------------------------------------- For I or J, any 16-bit integers can range between -32768 and * 32767--defined as I(5,,2) or J(5,,2). Any 32-bit integers can range between -2147483648 and +2147483647--defined as I(10,,4) or J(10,,4). Definitions of I or J types with storage lengths other than 2, 4, 8, or 12 bytes get undefined results and can result in arithmetic traps. Table 3-2. Data Item Size (continued) -------------------------------------------------------------------------- | | | | | | Transact | Transact Default | Transact Display | COBOL | | Type | Storage Allocation | Requirements | Type | | | | | | -------------------------------------------------------------------------- | | | | | | Z* | Zoned decimal number; | 1 character per | | | | 1 storage byte per | digit or decimal | | | | digit, including | point, plus 1 | | | | sign, if any, which | character for a | | | | is combined with the | sign, unless item | | | | last digit: | is positive only: | | | | | | | - - - - - | | Z+(10) = 10 bytes | Z+(10) = 10 chars | DISPLAY PIC 9 | | | Z(10) = 10 bytes | Z(10) = 11 chars | DISPLAY PIC S9 | | | | | | -------------------------------------------------------------------------- | | | | | | P | Packed decimal digit; | 1 character per | COMP-3 | | | 1 nibble(1/2 byte) | digit or decimal | PIC 9 | | | per digit, plus 1 | point, plus 1 | | | | nibble for the sign: | character for a | | | | | sign, unless item | | | | | is positive only: | | | | | | | - - - - - | | P+(10) = 6 bytes | P+(10) = 10 chars | | | | P(10) = 6 bytes | P(10) = 11 chars | | | | P(11) = 6 bytes | P(10,2) = 11 chars | | | | | | | - - - - - | | (Sign is stored even | | | | | if item is positive | | | | | only. | | | | | | | | -------------------------------------------------------------------------- Zoned decimal data items are stored as a string of ASCII digits. * For data items defined as Z, the right-most digit is always overpunched with a sign indicator, a character that represents both the sign and the right-most digit. The following table shows the characters representing the overpunch. ------------------------------------------ | | | Low-Order Last Last | | Digit Character Character | | if Positive if Negative | | | ------------------------------------------ | | | 0 { } | | | | 1 A J | | | | 2 B K | | | | : : : | | | | 9 I R | | | ------------------------------------------ For data items defined as Z+ (implying positive only), no overpunch occurs and the right-most digit is unchanged. Z+ is stored like type 9. The maximum size for 9, Z, P, I, J, and K data items is 27 characters unless the decimal point is included. In that case, the maximum size is 28 characters. The maximum size for R and E data items is 22 characters. Table 3-2. Data Item Size (continued) -------------------------------------------------------------------------- | | | | | | Transact | Transact Default | Transact Display | COBOL | | Type | Storage Allocation | Requirements | Type | | | | | | -------------------------------------------------------------------------- | | | | | | K* | SPL logical value; | 1 character per | (none) | | | storage length | digit (K type | | | | depends on item size: | items are | | | | | always positive): | | | | | | | - - - - - | | K(1) to K(4) = 2 | K(10) = 10 chars | | | | bytes K(5) to K(9) | K(10,2) = 10 chars | | | | = 4 bytes K(10) to | | | | | K(18) = 8 bytes K(19) | | | | | to K(27) = 12 bytes | | | | | | | | -------------------------------------------------------------------------- | | | | | | R | SPL Real or Long | 1 character per | (none) | | | value: | digit, plus 1 | | | | R(1) to R(6) = 4 | character for a | | | | bytes R(7) and | sign, unless item | | | | above = 8 bytes | is positive only: | | | | | | | - - - - - | | | R+(5) = 5 chars | | | | | R(5) = 6 chars | | | | | R(5,2) = 6 chars | | | | | NOTE: Exponent is | | | | | not displayed. | | | | | | | -------------------------------------------------------------------------- | | | | | | E | SPL Real or Long | Displayed in | (none) | | | value; stored | format: n.nnE+nn | | | | exactly like R. | | | | | | | | - - - - - | | Constant values may | 1 character per | | | | not be entered in E | digit, plus 1 | | | | format; constant | character each for | | | | values entered in | the mantissa sign | | | | other formats into | (unless item is | | | | E-type items are | positive), the | | | | displayed in E-type | decimal point, the | | | | format. | E, and the | | | | | exponent sign, | | | | | plus 2 characters | | | | | for the exponent: | | | | | | | - - - - - | | (E is not the same as | E(5) = 11 chars | | | | the E data type in | E+(5) = 10 chars | | | | TurboIMAGE.) | E(5,2) = 10 chars | | | | | | | -------------------------------------------------------------------------- For K, any 16-bit logical value can range between 0 and 65535 * defined as K(5,,2). Any 32-bit logical value can range between 0 and 4,294,967,295 defined as K(10,,4).


MPE/iX 5.0 Documentation