|
I've a program, PROGRAMA, that accepts two entry-parms. This programlist
calls PROGRAMB, which in turn calls PROGRAMC. I've a need to change
PROGRAMC to now call PROGRAMD. However, PROGRAMD, which is an existing
program, already has code to call PROGRAMA. Of course, the causes the
recursive call problem.
I've a wild idea to resolve this recursive problem and want to see
what's your opinion about this:
The reason that PROGRAMD needs to call PROGRAMA is becuase it needs a
value on the PROGRAMA's entry-parms, which is already populated by
PROGRAMA by the time PROGRAMD is called.
My idea is to create an export procedure in a service program. This
procs will accepts the PROGRAMA's two entry-parms by reference. The
main code in this service program is to create a static references to
these two entry-parms. I can then change PROGRAMD to call this proc to
get the value it needs thru these static references. I know is a bit
confusing. May be code below and clear up a bit:
The code for this proc would looks something like this:
*************************************************************
P cumPROGRAMAParms...
P B export
D pi n
D piAction 1
D piPgmAParm1 likeds(PGMAParm1)
D piPgmAParm2 likeds(PGMAParm2)
D myPgmAParm1 ds likeds(PGMAParm1)
D based(myPgmAParm1_p)
D myPgmAParm2 ds likeds(PGMAParm2)
D based(myPgmAParm2_p)
D myPgmAParm1_p s * static
D myPgmAParm2_p s * static
/free
select;
when piAction = 'set';
myPgmAparm1_p = %addr(piPgmAParm1);
myPgmAparm2_p = %addr(piPgmAParm2);
return @SUCCESSFUL;
when piAction = 'release';
myPgmAparm1_p = *null;
myPgmAparm2_p = *null;
return @SUCCESSFUL;
when piAction = 'get';
if myPgmAparm1_p <> *null and myPgmAparm2_p <> *null;
piPgmAparm1 = mypiPgmAparm1;
piPgmAparm2 = myPgmAparm2;
return @SUCCESSFUL;
else;
return not @SUCCESSFUL;
endif;
endsl;
return not @successful;
/end-free
P cumPROGRAMAParms...
P E
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
To post a message email: RPG400-L@xxxxxxxxxxxx06/12/11
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
-----
Geen virus gevonden in dit bericht.
Gecontroleerd door AVG - www.avg.com
Versie: 10.0.1382 / Virusdatabase: 1513/3697 - datum van uitgifte:
06/12/11
-----
Geen virus gevonden in dit bericht.
Gecontroleerd door AVG - www.avg.com
Versie: 10.0.1382 / Virusdatabase: 1513/3697 - datum van uitgifte:
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.