Page 1 of 1

In REXX, how to know that end of file is reached.

Posted: Sun Oct 13, 2013 5:19 pm
by Akshypal
Hi,

Please can anyone let me know in REXX while reading a file into stack, how can we identify about end of file condition?

Thanks

Re: In REXX, how to know that end of file is reached.

Posted: Mon Oct 14, 2013 10:15 pm
by Anuj Dhawan
With EXECIO when you receive a non-zero return-code, it should serve what you're looking for. Something on these lines should help you:

Code: Select all

         eof = 'no'
         DO WHILE eof = 'no'
           "EXECIO 1 DISKR INDD"
            IF RC = 0 THEN          /*  read successful*/
              DO
                PULL record                
              END
            ELSE eof = 'yes'
         END
         "EXECIO 0 DISKR INDD (FINIS"
         EXIT 0

Re: In REXX, how to know that end of file is reached.

Posted: Thu Oct 17, 2013 6:52 pm
by Akshypal
Great - that did work for me.

Thanks for the help! :D

Re: In REXX, how to know that end of file is reached.

Posted: Sun Oct 20, 2013 1:13 pm
by Anuj Dhawan
Nice to know that it worked for you.

Thanks for the feedback! :)