View previous topic :: View next topic |
Author |
Message |
sinduja Beginner
Joined: 20 Jun 2005 Posts: 29 Topics: 14
|
Posted: Tue Jun 28, 2005 12:41 am Post subject: easytrieve - invalid file reference error |
|
|
hi all
i am new to easytrieve.
i need some help.
my requirement is to read records from a file and check if it is trailer record.
code is as follows
get ipfile
do when not eof ipfile
if record-data EQ trailer-record
.....
.......
end if
end do
this one worked but
for some reason i dont want to check the end of fie in this way
so i used a flag to check eof condition
eof-flag eq 'n'
do while eof-flag = 'n'
get ipfile
if record-data EQ trailer-record
........
.........
end-if
if EOF ipfile
eof-flag EQ 'y'
end if
end do
is this right?
when i run this code i get error invalid file reference at the first IF condition
i dont know what could be the possible problem
can anyone help me with this
thank you.
regrds,
sinduja. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Tue Jun 28, 2005 5:38 am Post subject: |
|
|
sinduja,
You get an invalid file reference if you reached your end-of file. Your first DO statement has got the eof condition and you are once again checking it which would cause an EOF condition.
It is always a good idea to let easytrieve control the EOF
Code: |
JOB INPUT INFILE
IF record-data EQ trailer-record
.....
...
END-IF
|
By coding like this you don't have to worry about the EOF. easytrieve will automatically take care of it
Hope this helps...
Cheers
Hope this helps...
Cheers
Kolusu
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
|
|