On 05/11/2009, at 8:59 AM, jmmckee wrote:

Doing a CHAIN to position and read the first record when multiple records were read just went to end of file, as I recall. Been too long.

Were we doing someting wrong that caused the RPG IV code to fail? This has really been bugging me for a long time. I couldn't find a reason for the bizarre behavior in my searching. It >may< have been an error when only one record with the matching subkey was found. Again, I just don't remember.


The RPG III technique, when transposed literally, will work in RPG IV. However, I suspect you tried a mix of the RPG III and RPG IV code that you showed. I suspect what you had was something like:

xxkey chain xxfmt
dow not %eof(xxfile)

xxkey reade xxfmt
enddo

or perhaps:

xxkey chain xxfmt
dow not %found(xxfile)

xxkey reade xxfmt
enddo

or perhaps:

xxkey chain xxfmt
dow %found(xxfile)

xxkey reade xxfmt
enddo


Forgetting that CHAIN does not set EOF--it sets FOUND, and READE does not set FOUND it sets EOF. Some combination of the above will be the cause of the behaviour your observed.

The RPG III technique is cheating and uses the same indicator (in your case LR) for two different tests: not-found on CHAIN and eof on READE.

Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists

http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------




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.