I have a scenario .. I have program
FColstatlf IF E k Disk FColstatkk O E Disk F C Read colstatlf C Eval *inlr = *on C Dow Not (%Eof(Colstatlf)) C Eval Tablcod = Tablcode C write rstatre C Read Colstatlf C C Enddo C C Eval *inlr = *on
In the above program i have issued EVAL *INLR = *ON AFTER reading the file COLSTATLF. As i know issuing *INLR =*ON closes all the files. But still the program is working and all the records are written in output file?? Can anyone tell me, how the program is works even though after issuing *INLR =*ON all the files will be closed.???
Software/Hardware used:
ASKED:
December 1, 2009 1:00 PM
UPDATED:
December 3, 2009 5:06 PM
A while back in one of the iSeries newsletters the writer discussed setting on LR at the top of the program. The idea was that there may be various reasons a progreammer decides to end a program. That way, LR is on whenever the programs ends without needing to code *INLR = *ON mutiple times.
Be careful about setting on LR early in the *INZSR subroutine – it can prevent files from opening.
Be careful about setting on LR early in the *INZSR subroutine – it can prevent files from opening.
I’m not sure where you got that idea. Files are already opened before *INZSR is run. The location of setting on LR can’t be earlier than when files are already opened.
Tom
Setting on *INLR in *INZSR will cause the program to end at the end of initialization BEFORE any “MainLine” C Specs are run.
If you want the program to end after you set on LR, code a Return.
I “got that idea” when my program acted like the SQL statements were not being executed when *INLR was on *INZSR. As soon as I moved setting on *INLR out of *INZSR, everything worked just fine. I think it was BitCat who set me straight on that one.