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
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