Chapter Contents

Previous

Next
ZD

ZD



Reads zoned decimal data

Numeric
Width range: 1- 32
Default width: 1
Decimal range: 0- 31
CMS specifics: IBM zoned decimal format


Syntax
Details
See Also

Syntax

ZDw.d

w
specifies the field width of the input value.

d
specifies a divisor for the input value. If the informat includes a d value, the input value is divided by 10d.


Details

Like numbers stored in standard format, zoned decimal digits are represented as EBCDIC characters. Each digit requires one byte of storage space. The rightmost byte represents both the least significant digit and the sign of the number. Digits to the left of the least significant digit are represented as the EBCDIC characters 0 through 9. The character printed for the least significant digit depends on the sign of the number.

In the least significant byte, negative numbers are coded with the high-order nibble being a 'D'x and with the low-order nibble being the numeric value. Positive numbers are represented with the high-order nibble being a 'C'x. For example, compare the zoned decimal data for 123 and -123 in the following table.

Data Pattern Read Actual Numeric Value Informat Resulting Numeric Value
'F0F0F0F0F0F1F2C3'x 123 zd8. 123
'F0F0F0F0F1F2F3C4'x 1234 zd8. 1234
'F0F0F0F0F1F2F3C0'x 1230 zd8.1 123
'F0F0F0F1F2F3F0C0'x 12300 zd8.2 123
'F0F0F0F0F0F1F2D3'x -123 zd8. -123
'F0F0F0F0F0F1F2C3'x 123 zd8.6 0.000123
'F0F0F0F0F1F2F3C0'x 1230 zd8.6 0.00123
'F0F0F0F0F0F0F0C1'x 1 zd8.6 1E-6


See Also


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.