|
Thanks to all who helped with a response to the above subject. My summary of the answers and further research so far is:
..............no mention of the static attribute............
In the same section they provide some example code and so I created two C programs (copied from H1-1 in the users guide), one called TESTRTRN (with a return;) and the other TESTEXIT(with the return replaced by an exit() with test harnesses as follows:
#include <stdio.h>
int invocation_count=0;
int main(void)
{
invocation_count++; /* increment counter */
printf("Exit called: "); ..........for the TESTRTRN program......printf("Return called: ");
printf("%d\n", invocation_count);
getchar(); /* this holds the screen open */
exit();..........for the TESTRTRN program........... return;
}
I set up a 3 tier calling structure with CL programs:
TEST 1 TEST 2
Activation Activation
TProgram Group Group
TESTBOTHCL (calls) *NEW *NEW
TESTEXITCL (calls) *CALLER *CALLER
TESTEXIT *NEW named
TESTEXIT " "
TESTEXIT " "
TESTEXIT " "
TESTEXIT " "
TESTRTRNCL (calls) *CALLER *CALLER
TESTRTRN *NEW named
TESTRTRN " "
TESTRTRN " "
TESTRTRN " "
TESTRTRN " "
TEST 2 worked as I wanted. The value of I was retained between invocations for the TESTRTRN program The TESTEXIT program also worked correctly with I being output as 1 on each call.
TEST 1 printed I=1 each time it was called. Correct for the TESTEXIT program but not for the TESTRTRN program.
I thought perhaps that *NEW and named would work in the same way but unfortunately no! I'm still unsure about the difference. More manual bashing I think.
This TEST 2scenario seems like it will solve my problem, as the return corresponds to the RPG return, as does the exit() to SETON *INLR as long as the activation group is named.
I thought this issue might of interest to others approaching C from a mainly RPG frame of reference. Any further comments would still be appreciated
Mike Pantzopoulos
As an Amazon Associate we earn from qualifying purchases.
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.