Chapter Contents

Previous

Next
ZD

ZD



Writes zoned decimal data, one digit per byte

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


Syntax
Details
See Also

Syntax

ZDw.d

w
specifies the field width of the output value.

d
specifies a multiplier for the output value. If the format includes a d value, the output value is multiplied by 10d .


Details

The ZD format fills in zeros to the left of the data value. Like 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 written as the EBCDIC characters 0 through 9.

The character written 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 an 'D'x and with the low-order nibble being the last digit of the number. Positive values 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.

Decimal Number Format Zoned Decimal Data Pattern Written Actual Value Value
123 zd8. 'F0F0F0F0F0F1F2C3'x 0000012C
1234 zd8. 'F0F0F0F0F1F2F3C4'x 0000123D
123 zd8.1 'F0F0F0F0F1F2F3C0'x 0000123{
123 zd8.2 'F0F0F0F1F2F3F0C0'x 0001230{
-123 zd8. 'F0F0F0F0F0F1F2D3'x 0000012L
0.000123 zd8.6 'F0F0F0F0F0F1F2C3'x 0000012C
0.00123 zd8.6 'F0F0F0F0F1F2F3C0'x 0000123{
1E-6 zd8.6 'F0F0F0F0F0F0F0C1'x 0000000A

Note:   

  [cautionend]

See Also


Chapter Contents

Previous

Next

Top of Page

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