View previous topic :: View next topic
|
Author |
Message |
clarkzx
New User
Joined: 04 Jun 2008 Posts: 7 Location: Rochester
|
|
|
|
Dears,
I got some PLI code like:
Code: |
DCL 1 LDGRTRX_REC STATIC UNALIGNED,
% INCLUDE(APTEMGNC); |
Can anybody explain the usage of ' STATIC UNALIGNED '?
Thank you very much. |
|
Back to top |
|
|
senthilnathanj
New User
Joined: 31 Jul 2007 Posts: 47 Location: chennai
|
|
|
|
Hi,
STATIC is the default storage class for External scope variables. However, STATIC variables can have either Internal or External scope.
For internal variables declared with STATIC storage class, storage is
allocated by the compiler in the Static Internal Control Section for its
compiled procedure. Thus, the storage is pre-allocated and resides
in the program load module (unless it is in a dynamically fetched procedure).
For external variables declared with STATIC storage class, storage is
resolved by the linkage editor and resides as a control section under its
own name in the program load module.
In either case, the storage is considered to have been allocated prior to
execution time and cannot be freed until the program terminates ( or, in the case of a dynamic procedure, until it is released). The programmer has no control over the allocation and freeing of STATIC storage.
STATIC storage is most commonly used in repetitively invoked procedures
for locally declared variables when the value of an identifier will never change the value of an identifier needs to be retained for the next invocation. |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
UNALIGNED is used to avoid 'padding' bytes. In an ALIGNED structure, the compiler will add bytes if needed to align, say, a BINARY FIXED(15) field on a half-word boundary. Typically, you wouldn't want this in an I/O input structure.
Garry. |
|
Back to top |
|
|
clarkzx
New User
Joined: 04 Jun 2008 Posts: 7 Location: Rochester
|
|
|
|
Thank you very much to all |
|
Back to top |
|
|
|