The ZD (zoned decimal) format specification is usually used for maximum portability with other computers. It can be used only with FORM statements for internal and external files.
The ZD format specification is now valid for use with display files (PRINT). This was done mainly for S/36 compatibility.
- Input characteristics
The decimal point is not stored with a ZD-formatted number. (It is similarly only implied with PD- and B- formatted numbers.) Therefore, the same format specification must be used to retrieve the number as was used to write it. Reading a field with a ZD 5 that was written with a ZD 5.2 results in a number 100 times larger than was written.
- Output Characteristics
When ZD is used for numeric output to disk, the number is rounded to the specified number of decimal positions before writing. Each digit is stored in its own byte and has the values 0-9. The last byte also contains the sign, and if the number is negative has the values ), J, K, L, M, N, O, P, Q, R which correspond to -0 through -9, respectively. For example:
00010 WRITE #1,USING 20: 23.1,-23.1 00020 FORM 2*ZD 4.2
- Output would be as follows