Hi all,
I'm a newbie using easytrieve and i created one recently but is encountering invalid file reference problem. The program i created is reading a sequential file and then search the read record in another sequential file until found or eof and then read the next record in first file and search again in he second file. If the record is not found in second file then i just write the first file to output file an read the next record in first file. If the record read in first file is found in second file, replace the cust-id field in first file position 4-8 with the master cust-id field in second file position 10-14 and then write th record read. Both files have same length. Below is the pseudocode of my program:
job input(null)
do while not eof file-a
get file-a
if eof file-a
stop
else
search read file-a record in file-b until eof or found
if not found and reached eof of file-b
write file-a to output file
else
if found
replace cust-id of file-a with master cust-id of file-b then write the record in output file
end-if
end-if
end-if
end-do
when i run the job running the easytrieve, it went thru the first record in file-a and search in file-b, the first record was not found in file-b and so it was written to the output file as is (without replacing the cust-id), and then the program read the next record in file-a and then when it search in file-b it got terminated with invalid-file-reference error due to i think that file-b is already in eof. Is there anything i could do to reset the pointer to read again at the beginning of file-b? or is there any other option i can use like let's say icetool who could perform the same logic this easytrive suppose to do?
Thanks and appreciate your help on this.