What is the relationship between Share Subroutine and padding and why would padding be disabled when the setting is No?
CA 2E 8.7.x
The main objective of shared subroutines is to optimize the generation of internal functions that are implemented as subroutines.
The first instance of generated source for the function is reused for all subsequent calls to the function within an action diagram instead of being repeatedly regenerated. To allow for seamless passing of values to this shared subroutine, the function's parameter interface is externalized.
When the internal function is defined to NOT be a Shared Subroutine, the interface to the subroutine is inside the subroutine. Also, each time it is called a new version of the subroutine is generated.
When the internal function is defined to be a Shared subroutine, the function interface needs to be externalized.
To allow for this, unique internal work fields are assigned for each parameter field and the interface is generated as MOVEL(P) statements for character type fields, before and after the shared subroutine call.
Since this internal function's subroutine is generated only once and can be invoked from multiple places, the possibility of data corruption exists.
To prevent this and to ensure only the actual value is passed in, the MOVEL(P) statements are generated in the code to load the parameter interface of such shared subroutines.