Skip to main content

[archive] Separate instances of called module in memory

  • March 9, 2007
  • 1 reply
  • 0 views

[Migrated content. Thread originally posted on 05 March 2007]

I have a a main module called 'uwcmgr' which calls multiple sub-modules called 'uwcmgraaaa', 'uwcmgrbbbb', etc.

Each of the sub-modules calls a common module called 'uwcilog' which is initialised the first time it is called by each sub-module.

Now, it looks like all the sub-modules are 'sharing' one instance of the same module instead of having their own copy. In this instance, parameters passed to 'uwcilog' by one sub-module are turning up when it is called by another sub-module.

Is there a setting somewhere that will ensure that each of the sub-modules has it's own copy of the 'uwcilog' module?

I know INITIAL would do it, but that would mean that the sub-modules would have to pass the initialisation parameters on each call rather than the first call to 'uwcilog'.

1 reply

[Migrated content. Thread originally posted on 05 March 2007]

I have a a main module called 'uwcmgr' which calls multiple sub-modules called 'uwcmgraaaa', 'uwcmgrbbbb', etc.

Each of the sub-modules calls a common module called 'uwcilog' which is initialised the first time it is called by each sub-module.

Now, it looks like all the sub-modules are 'sharing' one instance of the same module instead of having their own copy. In this instance, parameters passed to 'uwcilog' by one sub-module are turning up when it is called by another sub-module.

Is there a setting somewhere that will ensure that each of the sub-modules has it's own copy of the 'uwcilog' module?

I know INITIAL would do it, but that would mean that the sub-modules would have to pass the initialisation parameters on each call rather than the first call to 'uwcilog'.
What you are describing is exactly what I understand and have experienced to be true.

I believe you are correct in what the INITIAL function will do/cause for you, but I have not ever experimented with it.

What we have done in the past is push the responsibility of initialization onto the calling program by making the working storage area of the common subprogram into a copybook which is then initialized by each calling program before it's first call, then maintained afterward because each caller has it's own memory space.

brad