I/O operation was applied to closed file error on AS400

100 pts.
Tags:
AS/400
OVRPRTF
PRTF
RPG
V6R1
I've got a program that outputs to two reports, a summary and a detail. Both printfiles are using the keyword usropn. I open the files at the begining of the program and I close them at the end. The files close after the totals are printed, the totals are only printed when LR is turned on. LR is only on if it's the last record. How then can I be getting an I/O error after the totals were printed? There shouldn't be anything left to write to the files.

Any help would be appriciated, I've been working on this for days.

I can include samples of my code if needed.



Software/Hardware used:
AS400 V6R1

Answer Wiki

Thanks. We'll let you know when a new response is added.

Sample code would be helpful.
First, I would run the program in DEBUG mode. Putting break points at the OPEN, and CLOSE statements for the printer. That should give you the answer.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Lemonjello
    Thanks for your quick response but I solved the problem on my own about 5 minutes after posting my question! To be clear, I did not write this program, I was only modifying it. The program was written in 1988 so you can imagine the kinds of fun code I was coming across. My problem was that I didn't notice the $LR subroutine had a FOR loop in it. I had accidentally put my EXCEPT and CLOSE statement inside that loop. I moved everything after the ENDFOR and it worked fine.
    100 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following