HLASM Language Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Zoned decimal constants

HLASM Language Reference
SC26-4940-06

Each digit is converted into its 8 bit EBCDIC representation (see  4  in Table 1). The sign indicator (see  5  in Table 1) replaces the first four bits of the low-order byte of the constant.

Here are the range of values that can be assembled into a decimal constant:

Type of decimal constant Range of values that can be specified
Packed 1031-1 to -1031
Zoned 1016-1 to -1016

For both packed and zoned decimals, a plus sign is translated into the hexadecimal digit C, a minus sign into the digit D. The packed decimal constants (P-type) are used for processing by the decimal instructions.

If, in a constant with an implicit length, an even number of packed decimal digits is specified, one digit is left unpaired because the rightmost digit is paired with the sign. Therefore, in the leftmost byte, the leftmost four bits are set to zeros and the rightmost four bits contain the unpaired (first) digit.

Table 1. Decimal constants
Subfield Value Example Result
1. Duplication factor Allowed    
2. Type P and Z    
3. Type Extension Not allowed    
4. Program type Allowed    

5. Modifiers
   Implicit length:
   (length modifier
   not present)

As needed

 
Packed:
P  DC  P'+593'
 
Zoned:
Z  DC  Z'-593'

 
 
L'P = 2
 
 
L'Z= 3

Alignment: Byte    

   Range for length:

1 to 16
(byte length)
 
.1 to .128
(bit length)

   
Range for scale: Not allowed    
Range for exponent: Not allowed    

6. Nominal value
   Represented by:

 
Decimal
digits
(0 to 9)

 
Packed:
DC  P'5.5'   1 
DC  P'55'    1 
DC  P'+555'  2 
DC  P'-777'

Zoned:
DC  Z'-555'  4 

 
Object code
X'055C'
X'055C'
X'555C'  3 
X'777D'  3  

 Object code
X'F5F5D5'  5 

Enclosed by: Apostrophes    
Exponent allowed: No    

   Number of values
   per operand:

Multiple

   

  Padding:

Packed:
with binary
zeros at left
 
Zoned:
with EBCDIC
zeros (X'F0')
at left

   

   Truncation of
   assembled value:

At left

   
In the following example, the DC statement specifies both packed and zoned decimal constants. The length modifier applies to each constant in the first operand (that is, to each packed decimal constant). A literal cannot specify both operands.
DECIMALS DC    PL8'+25.8,-3874,+2.3',Z'+80,-3.72'
The last example shows the use of a packed decimal literal.
         UNPK            OUTAREA,=PL2'+25'

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014