Topic
  • 5 replies
  • Latest Post - ‏2011-11-02T17:34:42Z by SystemAdmin
SystemAdmin
SystemAdmin
535 Posts

Pinned topic Named activation groups and keeping files open

‏2011-11-02T16:03:44Z |
Hi

I am trying to compile a service program with a named activation group, for efficiency I would like to leave my (usropn) files open and have the job close the files when the job ends

Unfortunately, the compiler requires me to have some process that will close down my files (even if it is never called)

Is there a way round this? Or are we trying to do something fundamentally flawed here?

I don't think it makes any difference in this situation, but we are compiling under V5R4 here

Cheers
Updated on 2011-11-02T17:34:42Z at 2011-11-02T17:34:42Z by SystemAdmin
  • JonParis
    JonParis
    115 Posts

    Re: Named activation groups and keeping files open

    ‏2011-11-02T16:30:15Z  
    What message are you seeing? I don't recall ever having to code a close with usropn files.

    Even if the compiler whines just put the close in subr that never gets called.
  • barbara_morris
    barbara_morris
    385 Posts

    Re: Named activation groups and keeping files open

    ‏2011-11-02T16:30:24Z  
    The message is only a sev 10 warning. You can just ignore the message.
  • barbara_morris
    barbara_morris
    385 Posts

    Re: Named activation groups and keeping files open

    ‏2011-11-02T16:31:58Z  
    The message is only a sev 10 warning. You can just ignore the message.
    It doesn't make any difference whether the file is USROPN or not. USROPN only affects how the file is opened.
  • scott_klement
    scott_klement
    244 Posts

    Re: Named activation groups and keeping files open

    ‏2011-11-02T16:55:51Z  
    As Barbara has pointed out, the message is just a severity 10 -- you can ignore it, and your code will work fine.

    However, I usually find myself sticking a "CLOSE *ALL" somewhere in the program (usually somewhere that's called rarely, or not at all) to suppress these warning messages.

    Also, please understand that you do not need to use USROPN to keep the files open. They'll stay open until the activation group ends, or until you end your main procedure with *INLR=*ON. (Or, obviously, until you close them with the CLOSE opcode.) The USROPN doesn't affect whether they stay open or not.
  • SystemAdmin
    SystemAdmin
    535 Posts

    Re: Named activation groups and keeping files open

    ‏2011-11-02T17:34:42Z  
    As Barbara has pointed out, the message is just a severity 10 -- you can ignore it, and your code will work fine.

    However, I usually find myself sticking a "CLOSE *ALL" somewhere in the program (usually somewhere that's called rarely, or not at all) to suppress these warning messages.

    Also, please understand that you do not need to use USROPN to keep the files open. They'll stay open until the activation group ends, or until you end your main procedure with *INLR=*ON. (Or, obviously, until you close them with the CLOSE opcode.) The USROPN doesn't affect whether they stay open or not.
    Thanks guys and gals - your right it is only a level 10 which is good

    PS I've only used usropn because I have A LOT of sub procedures (and files) and I don't want to open lots of files I don't actually need