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



Check out using FOR-EACH to accomplish the "multiple scans".

Yours truly,

Glenn Gundermann
Email: glenn.gundermann@xxxxxxxxx
Cell: (416) 317-3144

---

On Fri, 3 Jun 2022 at 12:05, Vinay Gavankar <vinaygav@xxxxxxxxx> wrote:

Hi,

I was trying to write a routine to get a value of a field from a string.
The field starts with an identifier, which is x'1c' + 2 characters. The
field ends when either a new field starts with either x'1c', x'1d' or
x'1e', or if it is the last field in the string, it would have all spaces
after it.

Would it be more efficient to use %scan to find the start and end positions
and then %subst to extract the value, or use some sort of pointer code to
go thru the string character by character to do my own search? Or use a
combination of both?

My first scan to find the start of the field is simple. But to get the end
of field, I will have to do multiple %scans for each of the 3 possible
characters (unless I am missing something).

So would it be better to use %scan to find the start of the field, and then
use pointers to find the end.

I have never used pointers for this kind of thing, but I think it should be
possible.

Any thoughts or suggestions would be appreciated.
TIA
Vinay
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.