Answered Porting Code To Pas That Has Shared Variables

OE 11.6 SP1
Redhat Linux

I'm beginning a project to port client server code to be used on the Pacific App Server to support web services. The programs make heavy use of everything "shared". There are over 50 shared variables and multiple shared temp tables. I would prefer to migrate most of it to OO classes and was considering creating a singleton class to house all the formal shared variables.

My question is when a request is made and returned via PAS will the class be considered out of scope and destroyed or will the values still be sitting there when a second request is made and potentially creating a data collision? Maybe the better question should be is there a better approach to removing that many shared variables (i.e. passing as a temp table/PDS by reference)?

Thanks in advance,

Rod
 

tamhas

ProgressTalk.com Sponsor
There isn't really a good alternative to cleaning up shared variables other than to analyze where they are set and used and to substitute, wherever possible, direct parameter passing. If you do truly have global values that are widely used, it is possible to define an object with static variables and access that from everywhere, but I would only do that if you really had to. Someone else will have to tell you whether that class of static variables would persist. If so, then you would have to use one of the other approaches for a singleton. ABL2DB would help you with the analysis of where used in the static variables.
 

ForEachInvoiceDelete

Active Member
just use compatibilityhandler. Our legacy app seems to work fine on 11.6 PAS and it has shared variables by the bucket load.

Seems to reset the variable values per request.
 
Last edited:
Top