|
IIRC you can define and open files in a subprocedure. V7R1 or V7R2, I
think.
On Fri, Oct 8, 2021 at 3:59 PM James H. H. Lampert via RPG400-L <
rpg400-l@xxxxxxxxxxxxxxxxxx> wrote:
We have a module containing a single subprocedure, (I'll call it "FOO"
here) that is designed to be called recursively.
But part of what governs this is a file:
In any given call of FOO, we SETLL this controlling file (I'll call it
"BAR"), and the key for the SETLL and READE "BAZ") and then loop through
a READE of the file, making potentially many recursive calls of FOO for
every record in BAR that matches BAZ.
But since the F-spec declaring BAR is at program level, each recursive
call of FOO returns with BAR in an EOF state, short-circuiting the
previous level's trip through BAR.
The obvious solution to this would be to declare and open BAR locally to
each invocation of FOO, but can this be done in RPG? And if so, how?
--
JHHL
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
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.