× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I would say hard code the length and precision since that field will more
than likely not change in size or define constants based off the bifs %LEN()
and %DECPOS()

Here is what I have done in the past;
     D Y1              C                   %LEN(VM3VMIN)    
     D Z1              C                   %DECPOS(VM3VMIN)

     C                   EVAL      VM3VMIN  =  %DEC(VMVCHRMIN:Y1:Z1)

You cannot do this during run time.  

Thank you,
Matt Tyler
WinCo Foods, LLC
mattt@xxxxxxxxxxxxxx


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Dan
Sent: Thursday, July 21, 2005 2:30 PM
To: RPG400-L@xxxxxxxxxxxx
Subject: %DEC problems

Trying to figure out why the following /free code is blowing raspberries at
me:

    cuPD   = %dec( %char( %date : *ISO0 ) 
                 : %len( cuPD ) 
                 : %decpos( cuPD )        );

cuPD is defined as P(8,0) in a database file defined for output.  The
compiler errors I'm getting are related to the 2nd & 3rd parameters of
the %dec BIF:

RNF0328: The second parameter for %DEC or %DECH is not valid.
  The second parameter for built-in function %DEC or %DECH must be a
numeric literal; a built-in function that has a value known at
compile-time; or a numeric named constant. In addition, the value of
the parameter must be between 1 and 30 with no decimal digits. A float
literal is not allowed. The built-in function is ignored.

RNF0329: The third parameter for %DEC or %DECH is not valid.       
  The third parameter for built-in function %DEC or %DECH must be a
numeric literal; a built-in function that has a value known at
compile-time; or a numeric named constant. The value of the parameter
must be between 0 and 30 with no decimal digits. Also, the value must
be less than or equal to the value of the second parameter specified
for this built-in function. A float literal is not allowed. The
built-in function is ignored.

I would have thought that these are "known values at compile-time"
and, therefore, would have satisfied the second condition in the error
messages.  Previous to getting these errors, I had hardcoded the
numeric literals 8 and 0 for the 2nd & 3rd parameters of the %dec BIF,
respectively, and this compiled fine.

I am still playing catch-up after my layoff.  Is this the easiest/best
way in /free to populate an 8-digit numeric with the current date?  It
seems there should be an easier way to do this.

TIA, 
Dan


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.