Error Code 2904
(SQR 2904) File number already opened.
This indicates that the file number you used for reference (e.g. 1) is already in use.
Two common reasons are:
- The procedure you use to do the open is being called more than once
- There is a call to some other code (perhaps in an SQC?) that also opens a file with the same file reference.
The easiest solution is to increment your file reference number and see if it fixes it. So go from 1 to 2. Make sure you update your write statements too!
If you are still having issues, then it might be that your code to open the file is being called multiple times, you may need to move where it is.