i'm opening a program defined printer file in SQLRPGLE..
i get error file is already open....
if that is the case, then i'm trying to write in that file but now this gives me exception that attempting to write in closed file...
Please help
Software/Hardware used:
SQLrpgle
ASKED:
August 24, 2009 8:12 PM
UPDATED:
October 11, 2009 9:48 AM
yeah…i did that..Thanks….
also to be on the safer side, in my RPG i check if the file is %Open in initialize routine. If yes then i Close the file first and then open…but that sounds weird to me…….I’m thinking of a scenario at client site…wat if such kinda mystery happens…i dun want my program to bomb…
The RPG %open() BIF will report whether this program opened the file and has not yet closed it. That’s not the same as reporting if the file is open or closed. There are ways for other programs to close files. If your program opens a file, %open() will return ‘true’ until your program closes the file — even if the file was closed by a different program.
Note that actions such as RCLRSC can close files. With recent Java Toolkit distributed transactions, the server program can close all files after transaction completion (potentially causing trigger programs problems if they expect secondary files to remain open; PTFs are available to control this).
Make sure that you use features that are appropriate. RCLRSC buried somewhere in a job using ILE activation groups, for example, is not appropriate.
Tom