In The Spotlight
Output editing refers to formatting output values by suppressing leading zeros and adding special characters—such as decimal radix characters, thousands separators, and currency symbols—to make the values easier for people looking at the output to comprehend
By Brian Meyers and Jim Buck
Editor's Note: This article is excerpted from chapter 3 of Programming in ILE RPG, Fifth Edition.
Output editing refers to formatting output values by suppressing leading zeros and adding special characters—such as decimal radix characters, thousands separators, and currency symbols—to make the values easier for people looking at the output to comprehend. RPG and DDS allow you to edit numeric fields (but not character fields). Editing is used in part because of the way numbers are stored in the computer. For example, if Amount, a six-byte field with two decimal positions, is assigned the value 31.24, the computer stores that value as 003124. Although the computer keeps track of the decimal position, a radix character is not actually stored as part of the numeric value. If you print Amount without editing, the number prints as 003124—the nonsignificant zeros appears, and there is no indication of where the decimal should be.