Hi guys I'm confused how to use the edit code. For example I have an amount in a field, let's say 12000000
what is the edit code for zero decimal place? for 1 decimal? 2 decimal? 3 decimal?
I only know 2 decimal: ' ,.'
any ideas?
Here's the reference:
Edit Words
Edit words are patterns or masks that are specified in RPG output specifications. They are used to create ad hoc edits for numeric values, such as phone numbers, social security numbers, sales figures, and the time of day. Table 2.23 lists various edit-word masks.
Edit Word
The number of blanks plus the zero suppression control code (i.e., the leading zero or asterisk) within an edit word must be greater than or equal to the number of digits for the field or named constant being edited.
Because editing a numeric value often changes the overall size of the value, RPG uses ending positions for the output location of fields in the output specification. This allows the right sides of numeric values to be aligned properly after editing.
Edit words consist of four optional elements:
Body. The body is the area of the edit word where the numeric value is positioned.
Status. The status is the area of the edit word consisting of the letters CR or a - (minus) sign. The status is used to indicate whether the value is negative or positive.
Expansion. The expansion area follows the body and status (usually literal values).
Literal values. Literal values can appear anywhere in the edit word. Literal values are included in the output only when significant digits appear to the left of the literal value. Note: While a named constant can be used as an edit word, named constants cannot be used within (i.e., as part of) the edit word itself.
Edit Word Control Codes
There are several control codes that can be inserted into an edit word to control zero suppression, leading asterisks, floating currency symbol, blanks, and decimal notation. The first occurrence of a control code is used as the control code. Except for the ampersand (&), which is always used as a control code, subsequent occurrences are treated as literal values. Table 2.24 contains a description of the edit word control codes that can be used in an edit word.
Tip Be careful when using literal values in an edit word. Literal
values can be any characters, including the letters CR. The first
occurrence of the letters CR, however, is interpreted as the
status code and will not appear when the number is greater
than or equal to zero.
Edit Words and Named Constants
To use an edit word, place the desired edit word—left justified—
into output constant/edit word positions of the output specification
for the field being edited. The RPG output specification accepts
edit word literal values of up to 48 positions. For edit words that
exceed 48 positions, the entry can be continued onto a second
output line or a named constant can be used. Edit words can be
up to 115 positions in length and can be specified—left justified—
into output constant/edit word positions of the output specification.
Figure 2.20 contains examples of edit-word usage.
what is the edit code for zero decimal place? for 1 decimal? 2 decimal? 3 decimal?
I only know 2 decimal: ' ,.'
any ideas?
Here's the reference:
Edit Words
Edit words are patterns or masks that are specified in RPG output specifications. They are used to create ad hoc edits for numeric values, such as phone numbers, social security numbers, sales figures, and the time of day. Table 2.23 lists various edit-word masks.
Edit Word
Code:
Description *...v....1....v... Unedited Value Edited Output Large value ' ,.' 00654321 6,543.21 Stop zero suppression ' , 0 . ' 00000027 0.27 Time of day '0 : :' 071223 07:12:23 Social Security number '0 - - ' 023456789 023-45-6789 Phone number '0( )& - ' 8005551212 (800) 555-1212 Floating currency symbol ' , , $0. ' 000009402 $94.02
Because editing a numeric value often changes the overall size of the value, RPG uses ending positions for the output location of fields in the output specification. This allows the right sides of numeric values to be aligned properly after editing.
Edit words consist of four optional elements:
Body. The body is the area of the edit word where the numeric value is positioned.
Status. The status is the area of the edit word consisting of the letters CR or a - (minus) sign. The status is used to indicate whether the value is negative or positive.
Expansion. The expansion area follows the body and status (usually literal values).
Literal values. Literal values can appear anywhere in the edit word. Literal values are included in the output only when significant digits appear to the left of the literal value. Note: While a named constant can be used as an edit word, named constants cannot be used within (i.e., as part of) the edit word itself.
Edit Word Control Codes
There are several control codes that can be inserted into an edit word to control zero suppression, leading asterisks, floating currency symbol, blanks, and decimal notation. The first occurrence of a control code is used as the control code. Except for the ampersand (&), which is always used as a control code, subsequent occurrences are treated as literal values. Table 2.24 contains a description of the edit word control codes that can be used in an edit word.
Code:
Table 2.24: Edit Word Control Codes Control Code Description $ Currency Symbol If the currency symbol is followed immediately by a zero, the currency symbol precedes the first significant digit. This is referred to as a floating currency sign. If the currency symbol is not followed by a zero, the currency symbol's position is fixed. When using the floating currency symbol, an available blank position is displaced. Typically, the displaced blank is shifted to the left of the currency symbol. The character used as the currency symbol is specified by the CURSYM keyword on the header specification. * Asterisk. Leading zeros are replaced with asterisks to the position of the asterisk. Zero suppression ends at the position of the asterisk. & Ampersand. Always replaced with a blank when output. 0 Zero. Ends zero suppression at the position of the zero. The zero is used as one of the output positions for digits to appear. (period) , (comma) Decimal Notation. These characters are not actual control codes; they are treated as literal values. They are traditionally used for decimal notation and thousands notation. b Blanks. Identifies available positions for the numeric value. CR Status. The literal value CR is output if the value is negative. - Status. The - (minus) sign is output if the value is negative.
values can be any characters, including the letters CR. The first
occurrence of the letters CR, however, is interpreted as the
status code and will not appear when the number is greater
than or equal to zero.
Edit Words and Named Constants
To use an edit word, place the desired edit word—left justified—
into output constant/edit word positions of the output specification
for the field being edited. The RPG output specification accepts
edit word literal values of up to 48 positions. For edit words that
exceed 48 positions, the entry can be continued onto a second
output line or a named constant can be used. Edit words can be
up to 115 positions in length and can be specified—left justified—
into output constant/edit word positions of the output specification.
Figure 2.20 contains examples of edit-word usage.





I like Jamie's solution
Comment