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 symbols, and credit balance indicators.
The edit word can also be used to suppress leading zeros and to provide asterisk fill protection.
An edit word consists of three parts: the body, the status, and the expansion.
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 may 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 various possible characters are:
Blank
A blank is replaced with the character from the corresponding position in the data field. A blank position is referred to as a digit position.
Ampersand (&)
An ampersand causes a blank in the edited field. The ampersand is not displayed.
Zero
A zero stops zero suppression. Place it in the farthest right position where zero suppression is to stop.
The zero is replaced with the character from the corresponding position in the data field, unless that character is a zero.
Any zeros in the data that appear to the right of the stop-zero-suppression character are displayed.
The stop-zero-suppression character is considered a digit position; however, when it is the first character, it may not represent the digit position.
At least one leading zero is suppressed, unless it is the first character of the edit word. Then it does not count as a digit because the number of blanks equals the number of digits in the field.
Each zero that is suppressed is replaced by a blank.
An asterisk replaces zeros with asterisks (asterisk protection). Place the asterisk in the farthest right position where zero suppression is to stop. Each zero that is suppressed is replaced by an asterisk.
Whitespace followed by a zero at the start of the edit word
For Visual Adelia and Adelia Web programs, a whitespace character followed by a zero can be placed at the start of the edit word, followed by as many whitespace characters as there are digits in the data field to edit. In this case, if the field value is not zero, then the zero characters are not deleted; if the field value is zero, nothing is displayed in the field.
Asterisk (*)
An asterisk preceding a zero is interpreted as representing asterisk protection, and in this case, the zero prints as a constant. Any asterisks or zeros to the right of the stop-zero-suppression character are constants.
Decimals and Commas
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.
Currency Symbol
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.
Important: The currency symbol only concerns ADELIA programs generated on the AS/400.
CR or minus symbol (-)
If the sign in the edited output field is plus (+), these positions are blanked out.
If the sign in the edited output field is minus (-), these positions remain undisturbed.
Examples
Edit Word |
Internal Value |
Value Displayed |
' b 0 b b b b b b b b ' |
0000135678 + |
00135678 |
0000135678 - |
00135678 |
|
' * b b b b b b b b b – ' |
0000135678 + |
*000135678 |
0000135678 - |
*000135678 - |
|
' b b , b b b , b 0 b . b b & – ' |
0000000005 - |
0.05 - |
0000135678 + |
1,356.78 |
Note: In the array above, the character "b" corresponds to a blank.
*LOCFMTDAT special edit word
In the specific case of numerical fields with a length of 8 or 6 digits and 0 decimals, the *LOCFMTDAT(InternalFormat) edit word can be defined, where InternalFormat must correspond with the following values: YMD, DMY or MDY.
The internal format indicates that the value of the field is managed in the program as a date in Year/Month/Day (YMD), Day/Month/Year (DMY) or Month/Day/Year (MDY) format.
For numerical fields with a length of 8, the year is managed using 4 digits, whereas for numerical fields with a length of 6, it is managed using 2 digits.
Whatever the internal format, the format of the value displayed will correspond to the format of the dates defined in the regional settings on the machine (Visual Adelia applications) or to that of the language defined in the browser (Adelia Web applications). This edit word is not compatible with ADELIA source programs (iSeries applications).
Example: In a Visual Adelia window, you define a ZDATE numerical extended input field with a length of 8 and 0 decimals with the *LOCFMTDAT(YMD) edit word.
If, in the program, the ZDATE field takes the value 20120930, it will be displayed as 30/09/2012 on a PC whose regional settings use the DD/MM/YYYY date format.