VMS Help  —  MACRO  /ALPHA  Supplied Library Macros, .PACKED
    Packed decimal string storage macro.

    Format

      .PACKED  decimal-string[,symbol]

1  –  Parameters

 decimal-string

    A decimal number from 0 to 31 digits long with an optional sign.
    Digits can be in the range 0 to 9.

 symbol

    An optional symbol that is assigned a value equivalent to the
    number of decimal digits in the string. The sign is not counted
    as a digit.

2  –  Description

    .PACKED generates packed decimal data with two digits per byte.
    Packed decimal data is useful in calculations requiring exact
    accuracy. It is operated on by the decimal string instructions.

    A packed decimal string is a contiguous sequence of bytes in
    memory. It is specified by two attributes: the address A of
    the first byte and a length L, which is the number of digits in
    the string and not the length of the string in bytes. The bytes
    of a packed decimal string are divided into two, 4-bit fields
    (nibbles). Each nibble except the low nibble (bits 3:0) of the
    last (highest-addressed) byte must contain a decimal digit. The
    low nibble of the highest-addressed byte must contain a sign. The
    representation for the digits and sign is indicated as follows:

    Digit
    or
    Sign  Decimal        Hexadecimal

    0     0              0
    1     1              1
    2     2              2
    3     3              3
    4     4              4
    5     5              5
    6     6              6
    7     7              7
    8     8              8
    9     9              9
    +     10,12,14, or   A,C,E, or F
    -     15             B or D
          11 or 13

    The preferred sign representation is 12 for plus (+)  and 13 for
    minus (-). The length L is the number of digits in the packed
    decimal string (not counting the sign); L must be in the range
    0 to 31. When the number of digits is odd, the digits and the
    sign fit into a string of bytes whose length is defined by the
    following equation: L/2(integer part only) + 1. When the number
    of digits is even, it is required that an extra 0 appear in the
    high nibble (bits 7:4) of the first byte of the string. Again,
    the length in bytes of the string is L/2 + 1.

    The address A of the string specifies the byte of the string
    containing the most-significant digit in its high nibble. Digits
    of decreasing significance are assigned to increasing byte
    addresses and from high nibble to low nibble within a byte.
    Thus, +123 has a length of 3. The packed decimal number -12
    has a length of 2.

3  –  Example

        .PACKED -12,PACKED_SIZED        ; PACKED_SIZE gets value of 2
        .PACKED +500
        .PACKED 0
        .PACKED -0,SUM_SIZE             ; SUM_SIZE gets value of 1
Close Help