%Found in READE

465 pts.
Tags:
AS 400
RPGLE
Is it incorrect to use %Found with ReadE? I performed READE on a file with 4 keyfields and as there was no exact match found, resulted in EOF. However, I noticed that %Found() returned True. Is there a relation between %found and %eof function when used with ReadE opcode?
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

It is incorrect to use %FOUND with READE Opcode. You should always be using ‘%EOF’.

In your case, %FOUND would have returned the result ‘1’ might be because of ‘SETLL’ or ‘SETGT’ earlier in sequence. 
However, It is suggested to use %EQUAL with SETLL or SETGT
ClickHere for more info on %FOUND

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • ToddN2000
    I agree when using a READE use the %EOF to validate all records have been read. It is cleaner code and what most programmers use. I am assuming you are using the READE inside a DOW loop.
    133,750 pointsBadges:
    report
  • sri8707
    Thanks for clarifying. That helps
    465 pointsBadges:
    report
  • TheRealRaven
    %EOF is used for the matching block of records that are accessed by READE. %FOUND isn't appropriate because READE doesn't seek out any records; it simply accesses sequentially.

    In that sense, it's not different from a simple READ. READ simply accesses the next record that the file pointer is pointed at until... end-of-file. There is no "find" operation involved.
    35,650 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: