IBM i Global

IBM i 

A space for professionals working with IBM’s integrated OS for Power systems to exchange ideas, ask questions, and share expertise on topics like RPG and COBOL development, application modernization, open source integration, system administration, and business continuity.


#Power


#IBMi
#Power
 View Only
  • 1.  Regarding *RNF8004

    Posted Fri September 22, 2023 11:39 AM

    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
    ------------------------------



  • 2.  RE: Regarding *RNF8004

    Posted Fri September 22, 2023 12:53 PM

    Hi,

    the message means, that your edit word is simply to short.

    Lets say, fld1 is defined as zoned(9:2) - then your edit word das to have 9 digit replacement chars - like this:

           '######0.00'    -> replace # with space

    The quantity of the spaces and zeros has to be at least the number of digits in your field definition.

    HTH



    ------------------------------
    Daniel Gross
    ------------------------------



  • 3.  RE: Regarding *RNF8004

    Posted Mon September 25, 2023 07:31 AM
    Edited by Barbara Morris Mon September 25, 2023 07:32 AM

    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
    ------------------------------