× Home About AS400 Files on AS400 Bit Operations Compile Commands EBCDIC Table Edit Codes Message Subfile Reg. Expressions Sort Contact us


RPG - LANGUAGE

Edit Codes


EDTCDE - EDITC - EDITW

Edit Code
Description
No
Sign
CR
Sign
Sign-
(R)
Sign-
(L)
Commas and zero balances 1 A J N
Commas 2 B K O
Zero balances 3 C L P
No commas or zero balances 4 D M Q
Date edit (4 digit year) W
No edit (suppress sign) X
Date edit Y
Suppress leading zeros Z
User defined edit codes 5 - 9 User defined edit codes are created with the CRTEDTD or WRKEDTD commands. Any user-defined edit code will exist in library QSYS, with the name QEDIT5, QEDIT6. QEDIT7, QEDIT8 and QEDIT9.

Edit Code Positive Negative Zeroes Description
1 12,345.67 12,345.67 .00 No Sign
Commas,
Zero Balances
2 12,345.67 12,345.67   No Sign
Commas,
No Zero Balances
3 12345.67 12345.67 .00 No Sign
Zero Balances,
No Commas
4 12345.67 12345.67   No Sign
No Commas,
No Zero Balances
A 12,345.67 12,345.67CR .00CR
Commas,
Zero Balances
B 12,345.67 12,345.67CR   CR
Commas,
No Zero Balances
C 12345.67 12345.67CR .00CR
Zero Balances,
No Commas
D 12345.67 12345.67CR  CR
No Commas,
No Zero Balances
J 12,345.67 12,345.67- .00Minus on right
Commas,
Zero Balances
K 12,345.67 12,345.67-  Minus on right
Commas,
No Zero Balances
L 12345.67 12345.67- .00Minus on right
Zero Balances,
No Commas
M 12345.67 12345.67-  Minus on right
No Commas,
No Zero Balances
N 12,345.67 -12,345.67 .00Minus on left
Commas,
Zero Balances
O 12,345.67 -12,345.67   Minus on left
Commas,
No Zero Balances
P 12345.67 -12345.67 .00Minus on left
Zero Balances,
No Commas
Q 12345.67 -12345.67  Minus on left
No Commas,
No Zero Balances


Edit codes are generally used in Output Section,
EDTCDE & EDTWRD in DDS Section,
%EDITC & %EDITW in Definition and Calculation Sections.


Output Section.

The edit code is in position 44 on the same line as the field name to be edited. An edit word can be entered in quotation marks for more specific editing.

DDS Section.

EDTCDE() or EDTWRD() on screen and printer dds's is entered in the section against the field name to specify how the field is displayed.
If the EDTCDE() or EDTWRD() is used on a PF dds, the keyword is used to format the field in QUERY reports.

Calculation Sections.

%EDITC in the calculations section formats a numeric field and stores it in a character field.   %TRIM can be used with this to left justify an edited field.


%EDITC has the following formats ...

%EDITC(number: editcode);
where output = 12,345.67
and number is defined as 7,2 and contains 0012345.67 = 0012345.67,
editcode = K

%EDITC(number: editcode: currency);
where output = €12,345.67
and number is defined as 7,2 and contains 0012345.67 = 0012345.67,
editcode = K,
currency = €

%EDITC(number: editcode: *astfill);
where output = ***12,345.67
and number is defined as 7,2 and contains 0012345.67 = 0012345.67,
editcode = K,
*astfill is a constant

%EDITC(number: editcode: *cursym);>
where output = €12,345.67
and number is defined as 7,2 and contains 0012345.67 = 0012345.67,
editcode = K,
*cursym = €.

*CURSYM has a default value of $.
This is defined in the system values at QCURSYM. To change the value of *CURSYM for the program, use CURSYM on the H (control) specification.
e.g. H cursym('€')




This is an example of using %EDITW ...

%EDITW(number: zword);
where output = 12,345Euros 67Cents
and number is defined as 7,2 and contains 0012345.67,
zword contains "    ,   Euros&  Cents".
(There are 4 spaces to the left of the comma, 3 spaces to the right of the comma and 2 spaces after Euros.
The & will force a space to be output, the remaining spaces will be filled with digits from the number field.)



You can email us here or use the Contact Us menu tab.




a mckaysoftware website