Zoned-Decimal

来源:互联网 发布:战龙三国五行进阶数据 编辑:程序博客网 时间:2024/04/26 09:36

 

ILE RPG Reference

Zoned-Decimal Format

 

Zoned-decimal format means that each byte of storage can contain one digit or one character. In the zoned-decimal format, each byte of storage is divided into two portions: a 4-bit zone portion and a 4-bit digit portion. The zoned-decimal format looks like this:

Figure 87. Zoned-Decimal Format


REQTEXT

The zone portion of the low-order byte indicates the sign (positive or negative) of the decimal number. The standard signs are used: hexadecimal F for positive numbers and hexadecimal D for negative numbers. In zoned-decimal format, each digit in a decimal number includes a zone portion; however, only the low-order zone portion serves as the sign.Figure 88 shows what the number 21544 looks like in zoned-decimal format.

You must consider the change in field length when coding the end position in positions 40 through 43 of the Output specifications and the field is to be output in packed format. To find the length of the field after it has been packed, use the following formula:




REQTEXT

You can specify an alternative sign format for zoned-decimal format. In the alternative sign format, the numeric field is immediately preceded or followed by a + or - sign. A plus sign is a hexadecimal 4E, and a minus sign is a hexadecimal 60.

When an alternative sign format is specified, the field length (specified on the input specification) must include an additional position for the sign. For example, if a field is 5 digits long and the alternative sign format is specified, a field length of 6 positions must be specified.


[ Top of Page | Previous Page |Next Page |Table of Contents |Index ]

 

原创粉丝点击