Ignoring the fact that this is bed practise... sorry Tom et al...
Is there a way of programatically determining if a shared variable has been created yet? I'm trying to write a procedure to tidy up a handle on AppServer disconnect, but not all AppServer procedures NEW the shared var, so I get the errors in the AppServer logs until a NEW has happened.
Shared variable gv-fes-manager-Handle has not yet been created. (392)
Thread created by James PalmerIgnoring the fact that this is bed practise... sorry Tom et al...
Is there a way of programatically determining if a shared variable has been created yet? I'm trying to write a procedure to tidy up a handle on AppServer disconnect, but not all AppServer procedures NEW the shared var, so I get the errors in the AppServer logs until a NEW has happened.
Shared variable gv-fes-manager-Handle has not yet been created. (392)
Stop receiving emails on this subject.Flag this post as spam/abuse.
Yeah but I'm running the code on the AppServer and that fills up the AppServer logs with errors.
Reply by James PalmerYeah but I'm running the code on the AppServer and that fills up the AppServer logs with errors.
Stop receiving emails on this subject.Flag this post as spam/abuse.
So long as you are NOT depending upon the difference between "shared"
and "global shared" you can just always declare it "new global shared"
and not worry about who creates it first.
If you are depending on the behavior of multiple layers of plain old
shared then you should probably be begging for mercy.
(Just in case anyone is unaware... with "plain old shared" there is a
"stack" of multiple values that is driven by the order in which NEW
definitions occur. With "global shared" there is only ever one instance
of the variable.)
--
Tom Bascom
603 547 9043 (office)
603 396 4886 (cell)
tom@wss.com
Even with no-error. I get the error in Procedure Editor too.
DEFINE SHARED VARIABLE gv-fes-manager-Handle AS HANDLE NO-UNDO. /* ******************** Preprocessor Definitions ******************** */ /* *************************** Main Block *************************** */ DEFINE VARIABLE lv-handle AS HANDLE NO-UNDO. ASSIGN lv-handle = gv-fes-manager-Handle NO-ERROR.
Why do you even need the shared variable?
I would just walk the procedure handle tree and remove all of them on a disconnect. Or check which ones you want to delete.
Not a bad shout Mr Mad.
:-)
Just saw your other thread regarding tons of persistent procedures... if this is what you are trying to clean up you have to walk the procedure list. It is really likely those shared variables will not hold all of the handles that you are looking for.
Yep indeedy it certainly makes life a lot easier. Just didn't go through my mind to do it like that. *fingers crossed*
This KB will give you the code to clean up all of the dynamic objects/procedures. Just change the messages to delete and put it in your disconnect procedure(s).
Thanks for that! :)