Settin on LR indicator not closing files

560 pts.
Tags:
*INLR
RPG
RPG/400
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?

Answer Wiki

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

Hi,

First of all, you can’t terminate a Service Program with *INLR and a Service Program does not close files automatically (only if the job or activation group ends) you must use CLOSE.

For your second question, the answer depends on what you used on ACTGRP parameter on program creation. If it’s *CALLER it will be *DEFAULT, if it’s named it will be the name you have used on ACTGRP.

Regards,
Wilson

Discuss This Question: 7  Replies

 
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
  • bogeybetsy
    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
    560 pointsBadges:
    report
  • bogeybetsy
    And if you CLOSE the file in the service program, does the system reclaim the memory it used for building the ODP?
    560 pointsBadges:
    report
  • bogeybetsy
    Oh , I get your answer. You are saying I must use CLOSE...thanks Wilson.
    560 pointsBadges:
    report
  • bogeybetsy
    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!
    560 pointsBadges:
    report
  • WilsonAlano
    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
    2,485 pointsBadges:
    report
  • bogeybetsy
    Thanks Wilson!
    560 pointsBadges:
    report
  • Splat
    If you're feeling lazy, you can use Close *all; prior to exit.
    7,215 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