× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



MichaelQuigley@xxxxxxxxxx wrote:
Do the values of variables in an ILE CL program get refreshed on
every call to it if it is run within a named activation group? e.g.,
The following program is created with the parameters DFTACTGRP(*NO)
and ACTGRP(EXAMPLE). If it is called repeatedly from another program
in the same activation group, is the value of &LOCAL reset to
'Initial' every time this program is called?

PGM PARM(&ACTION)
DCL VAR(&ACTION) TYPE(*CHAR) LEN(4) DCL VAR(&LOCAL) TYPE(*CHAR) LEN(10) VALUE('Initial')
<<SNIP>>

If a variable will establish a new initial value on each invocation, versus only on the initial activation, depends on "whether the variable is an automatic variable or a static variable. The difference between the two is in the storage for the variables. For automatic variables, the storage is associated with the call of the program. Every time a program is called, a new copy of the variable is placed in automatic storage. A change to an automatic variable remains in effect only for the program call."
http://publib.boulder.ibm.com/infocenter/systems/scope/i5os/topic/apiref/MIprosto.htm

There is no declarative feature for *STATIC storage in a CLLE or CLP. There is only *AUTO storage that is available for the STG() parameter of the DCL command. The given DCL for variable &LOCAL will default to STG(*AUTO), and will be initialized to 'Initial' on each invocation:
http://publib.boulder.ibm.com/infocenter/systems/scope/i5os/topic/cl/dcl.htm#DCL.STG

This nature of storage for declared CL variables holds, irrespective of the choice of either ILE [with activation group] or OPM.

Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.