× 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.



Wouldn't SQL be better? You would have lazy open and close.

On Fri, Oct 8, 2021, 5:27 PM Vern Hamberg <vhamberg@xxxxxxxxxxxxxxx> wrote:

Without knowing more, I suggest setting the controlling file to USROPN,
rather than define it IN a subprocedure, if there will be a lot of calls
to a subprocedure, it is probably not going to perform well - with
USROPN, you handle the opening and closing in the program, wherever.

Now are maybe there issues of maintaining the position where you left
off in one of the files?

Cheers
Vern

On 10/8/2021 6:08 PM, Reeve wrote:
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


--
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 thread ...

Replies:

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.