Page 1 of 2

Dynamically calling LE-conforming assembler

PostPosted: Wed Sep 07, 2016 6:30 pm
by Wildt
I've made a LE conforming assembler program, and it has "persistent working storage" when called statically from a COBOL V5 batch program (it gets the same storage from the CEEENTRY prologue every time).

I want this too if I call it dynamically (also from batch COBOL) , but I don't know how to achieve that. Help!

Re: Dynamically calling LE-conforming assembler

PostPosted: Wed Sep 07, 2016 7:01 pm
by Robert Sample
I want this too if I call it dynamically (also from batch COBOL) , but I don't know how to achieve that.
If you are saying you don't know how to call a subprogram dynamically in COBOL, you can either (1) verify the DYNAM and NODLL options are specified in your COBOL compile, or (2) use CALL <variable-name> where variable-name contains the name of the subprogram. If you are asking how to achieve something else, you'll need to explain more about what you're wanting to do.

Re: Dynamically calling LE-conforming assembler

PostPosted: Wed Sep 07, 2016 7:05 pm
by Wildt
I want the LE conforming assembler program to have persistent "working storage" when called dynamically from COBOL.

Re: Dynamically calling LE-conforming assembler

PostPosted: Wed Sep 07, 2016 8:01 pm
by Robert Sample
Working storage is generally a term reserved for use with COBOL -- as in WORKING-STORAGE SECTION. So it is confusing when you say
persistent "working storage"
- if you're talking about the assembler data areas, that's not "working storage" as the term is commonly used; if you're talking about the COBOL WORKING-STORAGE, then it will be the same when the subprogram returns as when the subprogram is invoked (unless, of course, you changed it in the subprogram).

And it is not clear why you would think a dynamic call would behave differently than a static call =- unless the calling program uses a CANCEL to reset the called program storage.

Re: Dynamically calling LE-conforming assembler

PostPosted: Wed Sep 07, 2016 9:52 pm
by Wildt
Sorry for the confusion. I put the words in quotes, as I wanted to ilustrate that I wanted it to behave like COBOL Working-Storage - i.e. it is persistent across dynamic calls from other COBOL programs in the enclave.

And my problem really *IS* that it DOES behave differently when calling it statically than dynamically - so.. did I BIND/LINK my assembler load module wrongly somehow?

To be clear - I'm talking about the storage given to me by the CEEENTRY prolouge macro. Static call = same storage on every call - Dynamic call = different storage.

Re: Dynamically calling LE-conforming assembler

PostPosted: Fri Sep 09, 2016 7:33 am
by Robert Sample
What option or options are you using in CEEENTRY that are giving you storage? In fact, post the CEEENTRY macro you're using -- it may help clear up what is going on.

Re: Dynamically calling LE-conforming assembler

PostPosted: Fri Sep 09, 2016 11:42 am
by Wildt
CEEENTRY PPA=LEIND,AUTO=WORKSIZE,NAB=YES,MAIN=NO,
EXECOPS=NO,PARMREG=1,BASE=11,AMODE=ANY,RMODE=ANY

CEEPPA LIBRARY=NO,PPA2=YES,EXTPROC=YES,TSTAMP=YES,
PEP=YES,INSTOP=YES,EXITDSA=NOOWNEXM=YES,
VER=1,REL=1,MOD=1,DSA=YES

Re: Dynamically calling LE-conforming assembler

PostPosted: Fri Sep 09, 2016 5:18 pm
by Robert Sample
If you are depending upon the AUTO=WORKSIZE for your storage allocation, you need to be aware of this quote from page 164 of the LE Programming Guide manual:
Automatic data: Automatic data is allocated with the same value on entry and
reentry into a routine if it has been initialized to that value in the semantics of
the language used, for example, data declared using the PL/I INIT() option.
Values of the data at exit from the routine are not retained for the next entry
into the routine. The scope of automatic data is a routine invocation within an
enclave.
Static called subprograms are linked into the calling program and hence the "routine" in the quote would be the calling program; with dynamically called subprograms the "routine" in the quote will be the subprogram since it is independent of the calling program. Hence, you will see different behavior between static and dynamic calls and unless you find another facility in the LE macros to provide storage across calls, you can either (1) provide the subprogram memory from the calling program, or (2) give up your idea of having persistent memory and work within the limitations you have.

Re: Dynamically calling LE-conforming assembler

PostPosted: Fri Sep 09, 2016 5:31 pm
by Wildt
Hmm.. well, that does sound like a plausible explanation indeed - thanks a lot for finding it.

Having the caller provide the storage isn't a viable option, as we have multiple (COBOL) callers in the enclave.

My problem is that we have some widely used legacy non-LE assembler programs that used a different technique to achieve persistent memory - but this technique no longer works reliably under CICS 5.3

Do you think dynamically calling a COBOL program from the assembler program to store the data in it's working storage would work? (I dread the performance overhead though)

Re: Dynamically calling LE-conforming assembler

PostPosted: Fri Sep 09, 2016 7:32 pm
by Robert Sample
Do you think dynamically calling a COBOL program from the assembler program to store the data in it's working storage would work? (I dread the performance overhead though)
I think you would run into the issue still. A COBOL run unit is one or more object programs that are executed together. With dynamic calls, your assembler subprogram and the COBOL routine it calls would be a run unit (as long as they were linked together) and COBOL initializes WORKING-STORAGE when the run unit is invoked. You might be able to use external storage (look at CEEGTST) to achieve what you want.