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



This should really be on the RPG list.

Both of those statements work in RPG IV. It's hard to say what didn't work because I don't quite understand the problem you're explaining. My guess is that the issue resulted from a confused use of BIFs. CHAIN uses %found and can turn %eof off, but will not turn %eof on. READ uses %eof and not %found. (I apologize if you already know this.)

Style choice: I would never use a Chain in a loop (unless the situation in particular called for it - I can't think of an example although I'm sure there is one, and it would be the exception to the rule).

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of jmmckee
Sent: Wednesday, November 04, 2009 4:00 PM
To: Midrange Systems Technical Discussion
Subject: Difference between RPG III and RPG IV with CHAIN

Where I work, training is something of a dirty word.

To read multiple records using a partial key in RPG III, I do this:

xxkey chain xxfmt LR
*INLR doweq *OFF


xxkey reade xxfmt LR
enddo


On a project a few years ago, written in RPG IV, that code did not work.

The only way we found to make it work was to do this:

xxkey setll xxfmt
xxkey reade xxfmt
dow not %eof(xxfile)


xxkey reade xxfmt
enddo


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.

John McKee

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.