Summary of Edit Codes
Summary of Edit Codes
Table 1 summarizes the edit codes and the options they provide. A simplified version of this table is printed above positions 45 through 70 on the output specifications. Table 2 shows how fields look after they are edited.
Table 3 shows the effect that the different edit codes have on the same field with a specified end position for output.
Table 1. Edit Codes
| DECEDIT Keyword Parameter | ||||||||
|---|---|---|---|---|---|---|---|---|
| Edit Code | Commas | Decimal Point | Sign for Negative Balance | ’.' | ',' | '0,' | '0.‘ | Zero Suppress |
| 1 | Yes | Yes | No Sign | .00 or 0 | ,00 or 0 | 0,00 or 0 | 0.00 or 0 | Yes |
| 2 | Yes | Yes | No Sign | Blanks | Blanks | Blanks | Blanks | Yes |
| 3 | Yes | No Sign | .00 or 0 | ,00 or 0 | 0,00 or 0 | 0.00 or 0 | Yes | |
| 4 | Yes | No Sign | Blanks | Blanks | Blanks | Blanks | Yes | |
| 5-91 | ||||||||
| A | Yes | Yes | CR | .00 or 0 | ,00 or 0 | 0,00 or 0 | 0.00 or 0 | Yes |
| B | Yes | Yes | CR | Blanks | Blanks | Blanks | Blanks | Yes |
| C | Yes | CR | .00 or 0 | ,00 or 0 | 0,00 or 0 | 0.00 or 0 | Yes | |
| D | Yes | CR | Blanks | Blanks | Blanks | Blanks | Yes | |
| J | Yes | Yes | - (minus) | .00 or 0 | ,00 or 0 | 0,00 or 0 | 0.00 or 0 | Yes |
| K | Yes | Yes | - (minus) | Blanks | Blanks | Blanks | Blanks | Yes |
| L | Yes | - (minus) | .00 or 0 | ,00 or 0 | 0,00 or 0 | 0.00 or 0 | Yes | |
| M | Yes | - (minus) | Blanks | Blanks | Blanks | Blanks | Yes | |
| N | Yes | Yes | - (floating minus) | .00 or 0 | ,00 or 0 | 0,00 or 0 | 0.00 or 0 | Yes |
| O | Yes | Yes | - (floating minus) | Blanks | Blanks | Blanks | Blanks | Yes |
| P | Yes | - (floating minus) | .00 or 0 | ,00 or 0 | 0,00 or 0 | 0.00 or 0 | Yes | |
| Q | Yes | - (floating minus) | Blanks | Blanks | Blanks | Blanks | Yes | |
| X2 | ||||||||
| Y3 | Yes | |||||||
| Z4 | Yes | |||||||
Note: 1. These are the user-defined edit codes. 2. The X edit code ensures a hexadecimal F sign for positive values. Because the system does this for you, normally you do not have to specify this code. 3. The Y edit code suppresses the leftmost zeros of date fields, up to but not including the digit preceding the first separator. The Y edit code also inserts slashes (⁄) between the month, day, and year according to the following pattern: rpgle nn⁄n nn⁄nn nn⁄nn⁄n nn⁄nn⁄nn nnn⁄nn⁄nn nn⁄nn⁄nnnn nnn⁄nn⁄nnnn nnnn⁄nn⁄nn nnnnn⁄nn⁄nn 4. The Z edit code removes the sign (plus or minus) from a numeric field and suppresses leading zeros. |
Table 2. Examples of Edit Code Usage
| Edit Codes | Positive Number- Two Decimal Positions | Positive Number- No Decimal Positions | Negative Number- Three Decimal Positions | Negative Number- No Decimal Positions | Zero Balance- Two Decimal Positions | Zero Balance- No Decimal Positions |
|---|---|---|---|---|---|---|
| Unedited | 1234567 | 1234567 | 00012␢5 | 00012␢5 | 000000 | 000000 |
| 1 | 12,345.67 | 1,234,567 | .120 | 120 | .00 | 0 |
| 2 | 12,345.67 | 1,234,567 | .120 | 120 | ||
| 3 | 12345.67 | 1234567 | .120 | 120 | .00 | 0 |
| 4 | 12345.67 | 1234567 | .120 | 120 | ||
| 5-91 | ||||||
| A | 12,345.67 | 1,234,567 | .120CR | 120CR | .00 | 0 |
| B | 12.345.67 | 1,234,567 | .120CR | 120CR | ||
| C | 12345.67 | 1234567 | .120CR | 120CR | .00 | 0 |
| D | 12345.67 | 1234567 | .120CR | 120CR | ||
| J | 12,345.67 | 1,234,567 | .120- | 120- | .00 | 0 |
| K | 12,345,67 | 1,234,567 | .120- | 120- | ||
| L | 12345.67 | 1234567 | .120- | 120- | .00 | 0 |
| M | 12345.67 | 1234567 | .120- | 120- | ||
| N | 12,345.67 | 1,234,567 | -.120 | -120 | .00 | 0 |
| O | 12,345,67 | 1,234,567 | -.120 | -120 | ||
| P | 12345.67 | 1234567 | -.120 | -120 | .00 | 0 |
| Q | 12345.67 | 1234567 | -.120 | -120 | ||
| X2 | 1234567 | 1234567 | 00012␢5 | 00012␢5 | 000000 | 000000 |
| Y3 | 0/01/20 | 0/01/20 | 0/00/00 | 0/00/00 | ||
| Z4 | 1234567 | 1234567 | 120 | 120 | ||
Note: 1. These edit codes are user-defined. 2. The X edit code ensures a hex F sign for positive values. Because the system does this for you, normally you do not have to specify this code. 3. The Y edit code suppresses the leftmost zeros of date fields, up to but not including the digit preceding the first separator. The Y edit code also inserts slashes (⁄) between the month, day, and year according to the following pattern: rpgle nn⁄n nn⁄nn nn⁄nn⁄n nn⁄nn⁄nn nnn⁄nn⁄nn nn⁄nn⁄nnnn Format used with M, D or blank in position 19 nnn⁄nn⁄nnnn Format used with M, D or blank in position 19 nnnn⁄nn⁄nn Format used with Y in position 19 nnnnn⁄nn⁄nn Format used with Y in position 19 4. The Z edit code removes the sign (plus or minus) from a numeric field and suppresses leading zeros of a numeric field. 5. The ␢ represents a blank. This may occur if a negative zero does not correspond to a printable character. |
Table 3. Effects of Edit Codes on End Position
| Negative Number, 2 Decimal Positions. End Position Specified as 10. | |||||||||
|---|---|---|---|---|---|---|---|---|---|
| Output Print Positions | |||||||||
| Edit Code | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| Unedited | 0 | 0 | 4 | 1 | K1 | ||||
| 1 | 4 | . | 1 | 2 | |||||
| 2 | 4 | . | 1 | 2 | |||||
| 3 | 4 | . | 1 | 2 | |||||
| 4 | 4 | . | 1 | 2 | |||||
| 5-92 | |||||||||
| A | 4 | . | 1 | 2 | C | R | |||
| B | 4 | . | 1 | 2 | C | R | |||
| C | 4 | . | 1 | 2 | C | R | |||
| D | 4 | . | 1 | 2 | C | R | |||
| J | 4 | . | 1 | 2 | - | ||||
| K | 4 | . | 1 | 2 | - | ||||
| L | 4 | . | 1 | 2 | - | ||||
| M | 4 | . | 1 | 2 | - | ||||
| N | - | 4 | . | 1 | 2 | ||||
| O | - | 4 | . | 1 | 2 | ||||
| P | - | 4 | . | 1 | 2 | ||||
| Q | - | 4 | . | 1 | 2 | ||||
| X | 0 | 0 | 4 | 1 | K1 | ||||
| Y | 0 | / | 4 | 1 | / | 2 | |||
| Z | 4 | 1 | 2 | ||||||
| Note: 1. K represents a negative 2. 2. These are user-defined edit codes. |