Use this field-level keyword to edit output-capable numeric fields.
The format of the keyword is:
EDTCDE(edit-code [* |floating-currency-symbol])
Editing includes the following changes to the appearance of displayed fields, depending on which edit code is specified:
EDTCDE covers most editing requirements. Use EDTWRD when the EDTCDE keyword is not sufficient.
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.
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: OS/400 edit codes and user-defined edit codes.
OS/400 edit codes:
The OS/400 edit codes are the following:
1 through 4
A through D
J through Q
W through Z
Optionally specifying asterisk fill or floating currency symbol:
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 does not have to match when the file is used.)
The following table summarizes the functions provided by OS/400 edit
codes.
Table 6. Summary Chart for OS/400 Edit Codes
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 OS/400 edit code. For example, you may 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 OS/400 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.
The following table shows edit codes, unedited source data, and edited
output. Zero suppression and decimal characters are determined by the
system value QDECFMT. The date separator character is determined by the
job attribute DATSEP. In this figure, QDECFMT is assumed to equal x
(blank), and DATSEP is assumed to equal / (slash).
Table 7. Valid Edit Codes, Source Data, and Edited Output
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:
|
Example:
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
The display length for PRICE is 7 because the J edit code is specified, causing the field to contain a decimal point and an ending minus sign. It is edited as:
ddd.dd-
where d represents a digit.
The display length for SALES is 11 because the K edit code and floating currency symbol are specified. It is edited as:
$dd,ddd.dd-
The display length for SALARY is 10 because the edit code 1 is specified with asterisk fill. It is edited as:
ddd,ddd.dd
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.