× 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 used to use the record Look Ahead (NS  **) on my S36 RPG programs
when it was the best method to do certain processing.  As, you cannot
use Look ahead with externally defined AS400 files.  Has anyone found
any real neat replacements for this function?  I would appreciate a
nudge in the correct direction. <<

Tim,

I don't know about "real neat" or "correct", but you could simulate
lookahead processing by declaring an externally described multiple
occurrence data structure with two occurrences, based on the input
record. Allow the cycle to populate occurrence 1 and test the
"lookahead" field, then use the occur operation to point to occurrence
2, which contains the previous input record and process it. At the end
of the detail cycle, move the input record in occurrence 1 to a work
field or data structure, possibly defined LIKE the multiple occurrence
data structure, change to occurrence 2 and move the work values to it.
The only place special processing would be required would be at last
record time, where you'll need to do the detail processing for the
values in occurrence 2. If you use level breaks, you'll always need to
save them and handle them at detail time in the next cycle. You could
dispense with the work field and copy operations if you want, by just
toggling the current DS occurrence between 1 and 2 at the appropriate
point.

Or, maybe you could do your lookahead processing at total time and
define the lookahead field as a level break.

Or, you could use a program defined field with an externally described
data structure based on the input record. Specify the data structure
name as if it were a field in the input record. You should be able to
use a real lookahead this way. If you need to update, you can use the
WRITE or UPDAT(E) operations, specifying the data structure name in
factor 2.   HTH Pete


+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to "MIDRANGE-L@midrange.com".
| To unsubscribe from this list send email to MAJORDOMO@midrange.com
|    and specify 'unsubscribe MIDRANGE-L' in the body of your message.
| Questions should be directed to the list owner/operator: david@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.