Use this field-level keyword to specify an edit word if you cannot obtain the editing that you want by using the EDTCDE keyword.
EDTWRD('edit-word')
An edit word specifies the form in which the field values are to be displayed and clarifies the data by inserting characters directly, such as decimal points, commas, floating- and fixed-currency symbol, and credit balance indicators. The edit word can also be used to suppress leading zeros and to provide asterisk fill protection.
If a field previously defined in a database file has EDTWRD specified, you need not specify EDTWRD 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.
An edit word consists of three parts: the body, the status, and the expansion. Figure 1 shows the three parts of an edit word.
The body is the space for the digits transferred from the data field to the output record. The body begins at the farthest left position of the edit word. The number of blanks (plus one for a zero or an asterisk) it contains is equal to the number of digits of the data field to be edited. If the zero or asterisk is the first character in the edit word, the number of blanks it contains might equal the number of digits in the data field. The body ends with the farthest right character that can be replaced by a digit.
The status positions display the sign (+ or -) of the data field. The status continues to the right of the body to either a CR (credit) or - (minus) symbol. These two symbols print only when the field is negative. Edit words without the CR or - symbol have no status positions.
The expansion positions are not changed by the edit operation. The expansion starts at the first position to the right of the status (or body, if status is not specified) and ends with the farthest right character of the edit word.
The following characters have special meanings when used in the body of an edit word.
If you code a currency symbol immediately to the left of the zero suppression code, a currency symbol is inserted in the position to the left of the first significant digit. It is called the floating-currency symbol when used in this manner.
If you code a currency symbol in the farthest left position of the edit word, it is fixed and prints in the same location each time. When used in this manner, it is called the fixed-currency symbol.
The currency symbol is not considered a digit replace position. This symbol must correspond to the system value QCURSYM.
Decimals and commas are printed in the same relative positions in which they are coded in the edit word unless they are to the left of the first significant digit. In that case, they are blanked out or replaced by an asterisk.
All other characters are printed if they are to the right of significant digits in the edit word. If they are to the left of the high-order significant digits in the edit word, they are blanked out or replaced by asterisks if asterisk protection is being used.
If a constant is to be printed in the left most position, the constant must be preceded by a zero and the field length increased by one.
The following characters have special meanings when used in the status of an edit word.
The characters in the expansion portion of an edit word are always written. The expansion cannot contain blanks. If a blank is required in the edited output field, specify an ampersand in the body of the edit word.
Use the following rules to specify a valid edit word:
EDTWRD('____$0.__)
where _ represents a blank.
Option indicators are not valid for this keyword.
Figure 2 shows sample edit words with the program value of the field and the display value of the field (as edited).
The following example shows how to specify the EDTWRD keyword.
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 00020A FIELDA 7 2 5 2EDTWRD(' $0. ') A