|
... and the lights came on... - thanks. I was using a fixed length screen entry field to let users select records to see (and my scan to select was not working). thanks again - jim > The two code fragments should work exactly the same > IF variable "lib" is declared as VARYING. > > If "lib" is a fixed length string, then the statement > "lib=%trim(lib)" would only have the effect of removing > left-most blanks. The %TRIM function removes blanks > from both ends, but the assignment pads the rest of the > variable with blanks. > > The bottom line is this: It is best to use varying > length character variables for general character string > manipulation (such as this). > > Cheers! Hans ----- Original Message ----- From: <boldt@ca.ibm.com> To: <rpg400-l@midrange.com> Sent: Tuesday, May 01, 2001 7:44 AM Subject: Re: SCAN in RPG > > Jim wrote: > >Just to add another solution with %scan here. > >I spent many hours reading/debugging this thread, and 2 diff rpg iv books, > >and ibm reference manual (none of the books had a > >decent example beyond scanning for a constant, like 'XYZ') > >Had my own scanning problem with data fields, but am > >using a tool that gens the rpg, and it will only gen %scan! > > > >the following line works (at v4r4) > >C EVAL Pos=%scan(%trim(lib): string:1) > >but the following will NOT work > >C EVAL lib = %trim(lib) > >C EVAL Pos=%scan(lib: string:1) > > > Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com > > +--- > | This is the RPG/400 Mailing List! > | To submit a new message, send your mail to RPG400-L@midrange.com. > | To subscribe to this list send email to RPG400-L-SUB@midrange.com. > | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. > | Questions should be directed to the list owner/operator: david@midrange.com > +--- +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.