× 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 believe it was yesterday that I sent out an e-mail to list for this 
topic that showed your exact code compiled and in debug on v5r1. With the 
receiver message. 

 Never saw where you posted compile time array. What does it look like and 
how is it defined? That is probably the compile problem since it does OK 
with out it and with what you showed list.


Set up that way for testing so that you could look at what it was doing when 
data did not get a hit(%scan,%size,%len).

Also about the VARYING "Using variable-length fields for temporary variables 
can improve the 
performance of string operations, as well as making your code easier to 
read since you do not have to save the current length of the field in 
another variable for %SUBST, or use %TRIM to ignore the extra blanks. "   You 
don't need it if your array uses all 10a
but if not you will have to %trim the blanks within %len in order to get 
the correct value to replace. "The fourth parameter represents the number of 
characters in the source 
string to be replaced"


D ObjectName      S             10A inz('Object')

1)%Len(ObjectName) would return 10 and %replace that much

%len(%trim(ObjectName) would return  6 and %replace that much

and with 

D ObjectName      S             10A  inz('Object')
D                                    VARYING
%Len(ObjectName) would return 6

If all your data uses all 10A no problem but if it dosen't?? Would it not 
replace with trailing blanks?
"The fourth parameter represents the number of characters in the source 
string to be replaced"



Hope you get everything working.
Bill Hopkins





"M. Lazarus" <mlazarus@xxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
08/26/2003 12:15 PM
Please respond to RPG programming on the AS400 / iSeries

 
        To:     RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
        cc: 
        Subject:        Re: %Len vs. %Size in %Replace


Bill,

At 8/26/03 08:58 AM, you wrote:
>I'm on v5r1 and they both work for me with your code.

  That's odd.  Note that I was using the %SIZE and %LEN directly in the 
%Replace BIF, not with an intermediate variable.  That's what didn't work 
for me.


>The only problems I see is when your
>
>"%Scan( 'qqqqqqqqqq': String ) :" dosen't get a hit on anything you get 
>"The target for a numeric operation is too small to hold the result"

  That's not a problem in this case, since it's coming from a compile time 

array.  Also, there are no VARYING fields to contend with.

  -mark

_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.




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.