Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

%FOUND on a READE

863 views
Skip to first unread message

RSBAS400

unread,
Jan 15, 2000, 3:00:00 AM1/15/00
to
Anyone know if, the fact that the %FOUND does not work after a READE on a file,
if this was intentional by IBM or a "glitch"? I would expect that when you
reach %EOF that this would trigger the %FOUND to NOT %FOUND..but it doesn't.
TO me when I am doing a READE, logically I would check for NOT %FOUND but it
nevers leaves the DOW loop. I know that you have to always use the %EOF on a
READE but was just wondering....WHY?

RSLancastr

unread,
Jan 17, 2000, 3:00:00 AM1/17/00
to
You may as well ask why IBM called the indicator on an RPGIII READE "the EOF
indicator"!

I assume they used the %EOF on the RPG IV READE to echo the RPGIII convention.

Thomas

unread,
Jan 19, 2000, 3:00:00 AM1/19/00
to
RSBAS400:

Since %FOUND is documented the way you describe it working, I suspect
it's *NOT* a "glitch". READE and %FOUND are unrelated. If you do find a
working relationship, then that would be a "glitch".

Now, whether it *should* work as you'd expect is an entirely different
question and a matter of opinion.

Tom Liotta

In article <20000115100513...@ng-ce1.aol.com>,

--
Tom Liotta
AS/400 systems programmer


Sent via Deja.com http://www.deja.com/
Before you buy.

C. Robert Jones

unread,
Jan 19, 2000, 3:00:00 AM1/19/00
to

"RSBAS400" <rsba...@aol.com> wrote in message
news:20000115100513...@ng-ce1.aol.com...

> Anyone know if, the fact that the %FOUND does not work after a READE on a
file,
> if this was intentional by IBM or a "glitch"? I would expect that when
you
> reach %EOF that this would trigger the %FOUND to NOT %FOUND..but it
doesn't.
> TO me when I am doing a READE, logically I would check for NOT %FOUND but
it
> nevers leaves the DOW loop. I know that you have to always use the %EOF
on a
> READE but was just wondering....WHY?

I had a similar problem with %eof.

Key reade file
dou %eof(file)

Key reade file
enddo

this reads too far, in fact it reads the last record several times. I don't
know why but here is the way I have found to work


Key reade file
dow not(%eof(file))

Key reade file
enddo


Paul Cunnane

unread,
Jan 19, 2000, 3:00:00 AM1/19/00
to
> I had a similar problem with %eof.
>
> Key reade file
> dou %eof(file)
>
> Key reade file
> enddo
>
> this reads too far, in fact it reads the last record several times. I don't
> know why but here is the way I have found to work
>
> Key reade file
> dow not(%eof(file))
>
> Key reade file
> enddo

This seems to be a misunderstanding of how DOU works. An `until' loop
is guaranteed to execute at least once, and should not be used in the
structure you described. The second version is correct. Note that
`not(%eof(file))' can be rewritten `not %eof(file)' which for my money
is more readable.

____
Paul

Paul Nicolay

unread,
Jan 20, 2000, 3:00:00 AM1/20/00
to
Hi Robert,

Sorry to be hard on you, but I'm always amazed how many people are missing
the knowledge of structured programming.

A DOU executes always 1 to n times, and tests and the end of the block. A
DOW executes always 0 to n times, and tests and the beginning of the block.

Since you can have 0 records, a DOW should be used for reading a file.

Kind regards,
Paul
-------------
C. Robert Jones wrote in message ...


I had a similar problem with %eof.

Key reade file
dou %eof(file)

Key reade file
enddo

this reads too far, in fact it reads the last record several times. I don't
know why but here is the way I have found to work


Key reade file
dow not(%eof(file))

Key reade file
enddo

The contents of this message express only the sender's opinion.
This message does not necessarily reflect the policy or views of
my employer, Merck & Co., Inc. All responsibility for the statements
made in this Usenet posting resides solely and completely with the
sender.

0 new messages