Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read Multiple files

Status
Not open for further replies.

wimhek

Programmer
Apr 18, 2001
7
NL
I am trying to read multiple files in one subroutine (on Windows). I cannot get it working. Can anybody help ?
I isolated the problem in a small rex program.

path='cmdb.txt'
call doit
path='frits.csv'
call doit

exit

doit:
file=.stream~new(path) /* Create a stream object */
openrc=file~open('read') /* Open the file for reading */
if openrc<>'READY:' then do /* Check the return code */
say 'Could not open' path||'~ RC='||openrc
exit openrc /* Bail out */
end
do while file~lines<>0 /* Loop as long as there are lines */
text=file~linein /* Read a line from the file */
say text
end
file~close
drop file

return



 
Why are you using Object-oriented Rexx rather than traditional Rexx?
 
If openrc is not equal to 'READY:', your Bail out (exit openrc) will treminate the Rexx. If you wish to continue with the next file, change exit to return.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top