I have a service program that ends with *INLR but it does not close the files after its procedure is called. It is compiled with ACTGRP(*CALLER) the program that uses it is also compiled with ACTGRP(*CALLER). However, if I use the CLOSE op code, the file closes. Is this natural or should this be corrected with a PTF from IBM?
Also, when you submit a job using SBMJOB, what will be the activation group of the program that is submitted?
Software/Hardware used:
ASKED:
July 15, 2009 9:09 AM
UPDATED:
July 18, 2009 11:21 AM
Hi Wilson,
Thanks for your answers.
I think the shop I work for are not intentionally terminating the service program. They just want to close the files so that they can change the library list with new libraries that contain the same files but having different records. What I know is if you close the file, the ODP will destroyed. (I just don’t know if the storage used for that is reclaimed. As stated in the IBM PDFs, the working storage is not reclaimed for service programs even if the LR indicator is set on. With that statement, can I say that the memory used for the ODP has not been reclaimed yet? )Then when the library list is changed and the procedure in the service program is called once again, the service progam will be opening the “new” files. They do this using
If Not %Open(<File>)
Open <File>
EndIf
If you do not close the files, the service program will still be accessing the old files. These “different” library list represent different parts in the US. So if they are proceesing records for, say CA and then they want to process records for PA next, they would change the environment, i.e., the library list.
You could actually do the same thing with activation groups, but the overhead is lower since only particular files are needed to change – majority of the files are not environment dependent and can remain open.
So, my question remains…is it natural for the files not to close even if you set LR on?
Hope to hear from you and maybe others soon! Thanks
Allan
And if you CLOSE the file in the service program, does the system reclaim the memory it used for building the ODP?
Oh , I get your answer. You are saying I must use CLOSE…thanks Wilson.
One problem with this is if you use the srvpgm in a batch application and you call it repeatedly (which they do here), you Open and Close all the time. That’s a lot of overhead!
Hi Allan,
If you intend to change library list in every call, you will have this overhead. You must Open and close the file in each call.
Of course, you can ask if State change (from CA to PA for example) then close, change libl and re-open the file otherwise let it open.
If the number of files to close/open is too important, may be it’s time to review the DB design and put all repeated files in one big file with keys.
Regards,
Wilson
Thanks Wilson!
If you’re feeling lazy, you can use Close *all; prior to exit.