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



Joe, I thought I'd write up the test for you, since you're helping me
out.

D VAR_Scan C '[scan]'
D Data S 1024a
D pos S 5u 0

/free
Data = x'25' + 'test test [scan] test' + x'25';
pos = %scan( VAR_Scan: Data );
*inlr = *On;
/end-free

Well, the test worked - as in the %scan went past the x'25' character as
I would think it should. So then I was wondering what was different
between the test and what I was seeing in my code. Well, I was getting
data from the IFS. And this data was put into a buffer via the read
api, and the field I was scanning was pointing to that address in the
buffer. I don't really know much about the buffer - how it differs
from where a field is stored in memory and whatnot, but I can only
imagine that this is the point of issue.

Once I moved the field that was based on the buffer into a
program-defined variable field, I can scan that new variable field
without the %scan ending at the first x'25' found.


Kurt Anderson
Application Developer
Highsmith Inc

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Joe Pluta
Sent: Monday, July 23, 2007 10:32 AM
To: 'RPG programming on the AS400 / iSeries'
Subject: RE: %scan and the new line character

From: Kurt Anderson

To read the IFS file I'm using C's read API. Well I think it's from
C.
// Read an IFS File
D read PR 10i 0 ExtProc( 'read' )
D filehandle 10i 0 Value
D datareceived * Value
D nbytes 10u 0 Value

To which we have a service program procedure that wraps around it. I
think we're requesting 1024 bytes. The data is much smaller. I'm
getting all of the data in the IFS file returned to me. When in
debug, I can display the returned data and see everything that is in
the IFS file. So I don't believe the read is an issue. In fact only
one read is occuring, and if I %scan starting after the new line
character, everything works as I'd like. So it really can't be a read
issue.

Kurt, I don't have the time to write the test program this second, but I
am 99.99% certain that %scan is completely context-insensitive. By
that, I mean that it reads characters regardless of what they contain,
and so what you're seeing doesn't make sense.

When I get a chance, I'll write a ten line test program, but until then,
here's a question. Are you scanning a varying length field? If so, did
you check the length?

In any case, I'll try to do some more specific testing later today.

Joe




--
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-Ups:
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.