RPGLE %eof, %equal, %found – whats the difference?

  • Home
  • /
  • Blog
  • /
  • RPGLE %eof, %equal, %found – whats the difference?

October 7, 2009

ILE RPG – has wonderful built in functions to replace the smelly old *indicator techniques in old RPG3. The modern generation of RPGLE %eof, %equal, %found %BIFS let us accurately and clearly handle native file IO.

The trouble is; using the wrong built in function can be easy to do and sometimes not easy to spot an obvious error. It’s not as annoying as coding an indicator on the wrong column in old style RPG3 or RPG400, but it’s still thoroughly frustrating when you stare at a CHAIN statement and cant figure out why its not working. Only to realise that you should have checked for %FOUND rather than %EOF  🙂

RPGLE %eof, %equal, %found

So whats the difference between (hint this code is wrong!):

Chain (keyfields) filename;
If Not %eof( filename );
--- do something ---

and Code (hint this code is correct!):

Chain (keyfields) filename;
If %Found( filename )
--- do something ---

And why would you use one over the other?


if you are using CHAIN then use %FOUND if your using READ then use %EOF

  • Chain – %Found
  • Check – %Found
  • CheckR – %Found
  • Delete – %Found
  • LookUp – %Equal, %Found
  • Read – %Eof
  • ReadC – %Eof
  • ReadE – %Eof
  • ReadP – %Eof
  • ReadPE – %Eof
  • Scan – %Found
  • SetGT – %Found
  • SetLL – %Equal, %Found
  • Write (subfile only) – %Eof

and there you have it

If you want to see a code example have a look here


IBM i Software Developer, Digital Dad, AS400 Anarchist, RPG Modernizer, Shameless Trekkie, Belligerent Nerd, Englishman Abroad and Passionate Eater of Cheese and Biscuits. Nick Litten Dot Com is a mixture of blog posts that can be sometimes serious, frequently playful and probably down-right pointless all in the space of a day. Enjoy your stay, feel free to comment and remember: If at first you don't succeed then skydiving probably isn't a hobby you should look into.

Nick Litten

related posts:

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

    Start your
    7-day free trial

    Take This Course with ALL ACCESS

    Unlock your Learning Potential with instant access to every course and all new courses as they are released.
     [ For Serious Software Developers only ]

    IBM i Training For Technology Experts


    Successfully Work Remote 

     $ 129.00  $59.00

    By adding new skills in information technology, employers will be confident that you have the necessary skills and tools needed to successfully work remotely


    Snug CBD

     20% Discount

    I have partnered with SNUG CBD givING you Organic CBD
    20% discount code "NL20"