CALLX SEPT(4267), QMHSNDMOL, ᑍ;
/ᑍ resume normal array constraint ᑍ/
OVRPGATR 1,4;
/ᑍ and move on to the next entry ᑍ/
ADDN(S) NUM_DONE, 1;
ADDSPP OBJ_ENTRY@, OBJ_ENTRY@, 32;
CMPNV(B) NUM_DONE, SIZE / LO(MORE);
/ᑍ When all entries are processed, end the program. ᑍ/
/ᑍ ᑍ/
/ᑍ Note that this program may not actually display all objects ᑍ/
/ᑍ in QTEMP. If L_BYTAVL is greater than L_BYTPRV, additional ᑍ/
/ᑍ objects were inserted into QTEMP between the time of the ᑍ/
/ᑍ "small" MATCTX and the "large" MATCTX. The processing of these ᑍ/
/ᑍ additional objects is not addressed in this program and is ᑍ/
/ᑍ the responsibility of the user of this program. ᑍ/
/ᑍ ᑍ/
DONE: RTX ᑍ;
PEND;
AS/400 Program Storage
On AS/400 systems, two steps are needed to run a program: program activation
and program invocation. Program activation is the process of allocating and ini-
tializing static storage for the program. Program invocation is the process of allo-
cating and initializing automatic storage.
Program Activation and Static Storage:
Program activation can be done explic-
itly through the Activate Program (ACTPG) instruction or implicitly by using a call
external (CALLX) instruction when the called program has not been previously acti-
vated. Program activation typically occurs only once within a job or process.
Program activation is not reset by an RTX instruction within the called program (the
program is still considered to be in an activated state). This means that all static
storage on subsequent calls (CALLXs) to the program are found in a last-used
state, not in a reinitialized state. If a programmer wants to reinitialize the static
storage associated with a program activation, this can be accomplished through the
deactivate program (DEACTPG) instruction so that the next call (CALLX or ACTPG)
causes a new activation of the program.
Program Invocation and Automatic Storage:
Program invocation, on the other
hand, occurs every time a program is called with a CALLX instruction. Automatic
storage is reinitialized if a discrete INIT value was specified on the declare (DCL)
statement. (If the INIT was allowed to be the default, then whether or not initializa-
tion occurs for the field is determined by an option of the QPRCRTPG API when
the program was created.) If you have not already done so, review all of the option
template values available on the QPRCRTPG API before developing your MI appli-
cations.
7-36 System API Programming V4R1