There must be some peculiarity with our tools setup but if a file is created with file=outfile("filename") then i can write to a file until a run() statement is encountered. Any fprintf() after the run() gives error;
ocean> *Error* fprintf: argument #1 should be an I/O port (type template = "ptg") - "/user/xxxxxxxxxxxxxxxxx/LIB/skill/ArtistKitNetlister.al"
xxxxx - some path
spectre sub-version 220.127.116.110.isr5
A bit of a wild guess, based on what's happened. It would appear that you're using the ST "ArtistKit" integration as part of their "Unicad" environment. My guess is that some trigger code as part of this environment is setting a variable called "file" which has been accidentally left out of the let(), and consequently it is clobbering your variable called "file".
You should report this to ST (I will mention it to my contacts in the team that develops this code), but in the meantime if you change your variable name containing the output port from "file" to something more unique I suspect the problem will go away.
Thank you Andrew, you are exactly right! This is the only lateral thinking i had not thought of! Not using "file" works!
Just a quick followup - my contact has identified some likely places where this may be happening, and is going to correct the code in the ArtistKit package so this should be solved in a future release.