Since you are only doing this if fld1 is greater than zero, then assuming that fld1 has zero decimal positions, %CHAR gives the same result as %TRIM(%EDITW) with that particular edit word.
(After you fix your edit word so it has enough blanks.)
In this little program, I defined fld1 so that it is small enough for your edit word.
dcl-pi *n;
fld1_val packed(15:5);
end-pi;
dcl-s fld1 packed(5) inz(123);
dcl-s fld2 varchar(10);
fld1 = fld1_val;
fld2 = %trim(%editw(fld1: ' 0 '));
dsply ('%trim(%editw): "' + fld2 + '"');
fld2 = %char(fld1);
dsply ('%char : "' + fld2 + '"');
return;
A few calls to my program. When fld1 >= 0, %char gives the same result as %trim(%editw) for your simple edit word.
4 > call test 0
DSPLY %trim(%editw): "0"
DSPLY %char : "0"
4 > call test 1
DSPLY %trim(%editw): "1"
DSPLY %char : "1"
4 > call test 123
DSPLY %trim(%editw): "123"
DSPLY %char : "123"
4 > call test 12345
DSPLY %trim(%editw): "12345"
DSPLY %char : "12345"
4 > call test -123
DSPLY %trim(%editw): "123"
DSPLY %char : "-123"
------------------------------
Barbara Morris
------------------------------
Original Message:
Sent: Fri September 22, 2023 11:31 AM
From: Kevin Steve
Subject: Regarding *RNF8004
Hi,
For below piece of lines i am getting 20 level compilation error *RNF8004 (there are not enough characters in the edit word editing is ignored.') in my SQLRPGLE program :-
[CODE]
If fld1 > *zero;
fld2 = 'Added Qty :' + %trim(%editw(fld1: ' 0 '));
endif;
Any suggestions to resolve this compilation error please ?
Thanks,
------------------------------
Kevin Steve
------------------------------