Use this field-level keyword to edit output-capable numeric fields.
The format of the keyword is:
EDTCDE(edit-code [* |floating-currency-symbol])
EDTCDE covers most editing requirements. Use EDTWRD when the EDTCDE keyword is not sufficient.
You cannot specify both EDTCDE and EDTWRD for the same field. If a field previously defined in a database file has EDTCDE specified, you need not specify EDTCDE for that field in the display file. You can specify R in position 29 to refer to the previously defined field. The editing specified for the referenced field is included in the display file. However, if you also specify length, data type, or decimal positions for a display file field, editing specified for the referenced field is not included in the display file, and you must specify editing again in the display file.
The DFT and DFTVAL keywords cannot be specified with the EDTCDE keyword.
Option indicators are not valid for this keyword.
The rules for specifying edit codes and edit words are the same in all types of files. You can specify two kinds of edit codes: i5/OS™ edit codes and user-defined edit codes.
The EDTCDE keyword is valid only for fields with Y or blank in position 35 (Data Type/Keyboard Shift). The use of this keyword changes the default used for position 35 to a Y.
The i5/OS edit codes are:
1 through 4
A through D
J through Q
W through Z
You can optionally specify asterisk fill or floating currency symbol with edit codes 1 through 4, A through D, and J through Q.
When you specify asterisk fill, an asterisk (*) is printed for each zero that is suppressed. A complete field of asterisks is printed for a zero balance field.
When you specify floating currency symbol, the symbol appears to the left of the first significant digit. The symbol does not print on a zero balance when an edit code is used that suppresses the zero balance. (The symbol that you specify must match the system value for the currency symbol (QCURSYM). The symbol must match when the file is created. It need not match when the file is used.)
Edit codes | Commas1 displayed | Decimal points1 displayed | Sign displayed when negative value | Blank value of QDECFMT system value | I value of QDECFMT system value | J value of QDECFMT system value | Leading Zero suppressed |
---|---|---|---|---|---|---|---|
1 | Yes | Yes | No sign | .00 or 0 | ,00 or 0 | 0,00 or 0 | Yes |
2 | Yes | Yes | No sign | Blanks | Blanks | Blanks | Yes |
3 | Yes | No sign | .00 or 0 | ,00 or 0 | 0,00 or 0 | Yes | |
4 | Yes | No sign | Blanks | Blanks | Blanks | Yes | |
A | Yes | Yes | CR | .00 or 0 | ,00 or 0 | 0,00 or 0 | Yes |
B | Yes | Yes | CR | Blanks | Blanks | Blanks | Yes |
C | Yes | CR | .00 or 0 | ,00 or 0 | 0,00 or 0 | Yes | |
D | Yes | CR | Blanks | Blanks | Blanks | Yes | |
J | Yes | Yes | -(Minus) | .00 or 0 | ,00 or 0 | 0,00 or 0 | Yes |
K | Yes | Yes | -(Minus) | Blanks | Blanks | Blanks | Yes |
L | Yes | -(Minus) | .00 or 0 | ,00 or 0 | 0,00 or 0 | Yes | |
M | Yes | -(Minus) | Blanks | Blanks | Blanks | Yes | |
N | Yes | Yes | -(Minus) | .00 or 0 | ,00 or 0 | 0,00 or 0 | Yes |
O | Yes | Yes | -(Minus) | Blanks | Blanks | Blanks | Yes |
P | Yes | -(Minus) | .00 or 0 | ,00 or 0 | 0,00 or 0 | Yes | |
Q | Yes | -(Minus) | Blanks | Blanks | Blanks | Yes | |
W2 | Yes | ||||||
Y3 | Yes | ||||||
Z4 | Yes | ||||||
Notes:
|
Edit codes 5 through 9 are user-defined edit codes. A user-defined edit code can do more editing than an i5/OS edit code. For example, you might need to edit numbers that include hyphens (such as telephone numbers) or more than one decimal point. You can use user-defined edit codes for these functions. These edit codes are named QEDIT5, QEDIT6, QEDIT7, QEDIT8, and QEDIT9, and can be referred to in DDS or a high-level language program by number (5, 6, 7, 8, or 9).
A user-defined edit code is an i5/OS object and must exist before display file creation. It is created using the Create Edit Description (CRTEDTD) command. When you create a display file in which a user-defined edit code is specified, editing information is extracted from the previously created edit description. Changing a user-defined edit code after display file creation does not affect the display file unless the display file is re-created.
Edit codes | Positive number with two decimal positions | Positive number with no decimal positions | Negative number with three decimal positions1 | Negative number with no decimal positions1 | Zero balance with two decimal positions1 | Zero balance with no decimal positions1 |
---|---|---|---|---|---|---|
Unedited | 1234567 | 1234567 | xxxx.125– | 125– | xxxxxx | xxxxxx |
1 | 12,345.67 | 1,234,567 | .125 | 125 | .00 | 0 |
2 | 12,345.67 | 1,234,567 | .125 | 125 | ||
3 | 12345.67 | 1234567 | .125 | 125 | .00 | 0 |
4 | 12345.67 | 1234567 | .125 | 125 | ||
A | 12,345.67 | 1,234,567 | .125CR | 125CR | .00 | 0 |
B | 12,345.67 | 1,234,567 | .125CR | 125CR | ||
C | 12345.67 | 1234567 | .125CR | 125CR | .00 | 0 |
D | 12345.67 | 1234567 | .125CR | 125CR | ||
J | 12,345.67 | 1,234,567 | .125- | 125- | .00 | 0 |
K | 12,345.67 | 1,234,567 | .125- | 125- | ||
L | 12345.67 | 1234567 | .125- | 125- | .00 | 0 |
M | 12345.67 | 1234567 | .125- | 125- | ||
N | 12,345.67 | 1,234,567 | -.125 | -125 | .00 | 0 |
O | 12,345.67 | 1,234,567 | -.125 | -125 | ||
P | 12345.67 | 1234567 | -.125 | -125 | .00 | 0 |
Q | 12345.67 | 1234567 | -.125 | -125 | ||
W2 | 1234/567 | 1234/567 | 0/125 | 0/125 | 0/000 | 0/000 |
Y3 | 123/45/67 | 123/45/67 | 0/01/25 | 0/01/25 | 0/00/00 | 0/00/00 |
Z4 | 1234567 | 1234567 | 125 | 125 | ||
Notes:
|
The following example shows how to specify the EDTCDE keyword.
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 00010A PRICE 5 2 1 10EDTCDE(J) 00020A SALES 7 2 2 10EDTCDE(K $) 00030A SALARY 8 2 3 10EDTCDE(1 *) A
ddd.dd-where d represents a digit.
$dd,ddd.dd-
ddd,ddd.dd