22.02.2015 Views

HLASM Language Reference

HLASM Language Reference

HLASM Language Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

DC Instruction—Decimal Constants<br />

| Remember that commas separate operands. For readability, use spaces instead,<br />

| as shown in this example:<br />

| TWOCONS DC F'123,445' Two constants<br />

| ONECON DC F'123 456' One constant<br />

Decimal Constants—P and Z<br />

The decimal constants let you introduce data in a form suitable for operations on<br />

decimal data. The packed decimal constants (P-type) are used for processing by<br />

the decimal instructions. The zoned decimal constants (Z-type) are in the form<br />

(EBCDIC representation) you can use as a print image, except for the digit in the<br />

rightmost byte.<br />

The nominal value can be a signed (plus is assumed if the number is unsigned)<br />

decimal number. A decimal point may be written anywhere in the number, or it<br />

may be omitted. The placement of a decimal point in the definition does not affect<br />

the assembly of the constant in any way, because the decimal point is not<br />

assembled into the constant; it only affects the integer and scaling attributes of the<br />

symbol that names the constant.<br />

The specified digits are assumed to constitute an integer (see ▌1▐ in Figure 43).<br />

You may determine correct decimal point alignment either by defining data so that<br />

the point is aligned or by selecting machine instructions that operate on the data<br />

correctly (that is, shift it for purposes of decimal point alignment).<br />

Decimal constants are assembled as follows:<br />

Packed Decimal Constants: Each digit is converted into its 4-bit binary coded<br />

decimal equivalent (see ▌2▐ in Figure 43). The sign indicator (see ▌3▐ in<br />

Figure 43) is assembled into the rightmost four bits of the constant.<br />

Zoned Decimal Constants: Each digit is converted into its 8-bit EBCDIC<br />

representation (see ▌4▐ in Figure 43). The sign indicator (see ▌5▐ in Figure 43)<br />

replaces the first four bits of the low-order byte of the constant.<br />

The range of values that can be assembled into a decimal constant is shown<br />

below:<br />

Type of<br />

decimal<br />

constant<br />

Packed<br />

Zoned<br />

Range of values that<br />

can be specified<br />

1031−1 to −1031<br />

1016−1 to −1016<br />

For both packed and zoned decimals, a plus sign is translated into the hexadecimal<br />

digit C, a minus sign into the digit D. The packed decimal constants (P-type) are<br />

used for processing by the decimal instructions.<br />

If, in a constant with an implicit length, an even number of packed decimal digits is<br />

specified, one digit is left unpaired because the rightmost digit is paired with the<br />

sign. Therefore, in the leftmost byte, the leftmost four bits are set to zeros and the<br />

rightmost four bits contain the unpaired (first) digit.<br />

Chapter 5. Assembler Instruction Statements 151

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!