Sign in

docs RPG Reference

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 CodeCommasDecimal PointSign for Negative Balance’.'',''0,''0.‘Zero Suppress
1YesYesNo Sign.00 or 0,00 or 00,00 or 00.00 or 0Yes
2YesYesNo SignBlanksBlanksBlanksBlanksYes
3YesNo Sign.00 or 0,00 or 00,00 or 00.00 or 0Yes
4YesNo SignBlanksBlanksBlanksBlanksYes
5-91
AYesYesCR.00 or 0,00 or 00,00 or 00.00 or 0Yes
BYesYesCRBlanksBlanksBlanksBlanksYes
CYesCR.00 or 0,00 or 00,00 or 00.00 or 0Yes
DYesCRBlanksBlanksBlanksBlanksYes
JYesYes- (minus).00 or 0,00 or 00,00 or 00.00 or 0Yes
KYesYes- (minus)BlanksBlanksBlanksBlanksYes
LYes- (minus).00 or 0,00 or 00,00 or 00.00 or 0Yes
MYes- (minus)BlanksBlanksBlanksBlanksYes
NYesYes- (floating minus).00 or 0,00 or 00,00 or 00.00 or 0Yes
OYesYes- (floating minus)BlanksBlanksBlanksBlanksYes
PYes- (floating minus).00 or 0,00 or 00,00 or 00.00 or 0Yes
QYes- (floating minus)BlanksBlanksBlanksBlanksYes
X2
Y3Yes
Z4Yes
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 CodesPositive Number- Two Decimal PositionsPositive Number- No Decimal PositionsNegative Number- Three Decimal PositionsNegative Number- No Decimal PositionsZero Balance- Two Decimal PositionsZero Balance- No Decimal Positions
Unedited1234567123456700012␢500012␢5000000000000
112,345.671,234,567.120120.000
212,345.671,234,567.120120
312345.671234567.120120.000
412345.671234567.120120
5-91
A12,345.671,234,567.120CR120CR.000
B12.345.671,234,567.120CR120CR
C12345.671234567.120CR120CR.000
D12345.671234567.120CR120CR
J12,345.671,234,567.120-120-.000
K12,345,671,234,567.120-120-
L12345.671234567.120-120-.000
M12345.671234567.120-120-
N12,345.671,234,567-.120-120.000
O12,345,671,234,567-.120-120
P12345.671234567-.120-120.000
Q12345.671234567-.120-120
X21234567123456700012␢500012␢5000000000000
Y30/01/200/01/200/00/000/00/00
Z412345671234567120120
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 Code34567891011
Unedited0041K1
14.12
24.12
34.12
44.12
5-92
A4.12CR
B4.12CR
C4.12CR
D4.12CR
J4.12-
K4.12-
L4.12-
M4.12-
N-4.12
O-4.12
P-4.12
Q-4.12
X0041K1
Y0/41/2
Z412
Note: 1. K represents a negative 2. 2. These are user-defined edit codes.