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



Carel,

Thanks, but #Limit is a global variable that is only set after the Load All
subfile is, well, loaded. It is set to the value of RRNA, which is the
subfile's relative record number.

Plus, I can see the code running the FOR loop, just not getting a successful
hit on the CHAIN. STRDBG does show that 'x' has the proper value on both
the FOR line and the CHAIN line.

Jerry C. Adams
IBM i Programmer/Analyst
All that's necessary for the forces of evil to win is for enough good men to
do nothing. -Edmund Burke
--
A&K Wholesale
Murfreesboro, TN
615-867-5070


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Carel Teijgeler
Sent: Tuesday, February 28, 2012 2:22 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Can't See the Difference

Jerry,

Do you reset #limit to zero before strting the loop in the subroutine.
In the subprocedure it is automatically reset as a local variable.

Regards,
Carel Teijgeler


*********** REPLY SEPARATOR ***********

On 28-2-2012 at 13:13 Jerry C. Adams wrote:

I am thoroughly bamboozled by this one.

I have code in two places in my program that loop through a subfile.
The
code is essentially the same. The first set is in a subroutine and the
second set is in a subprocedure. The subprocedure set works; the
subroutine set doesn't. It's the latter that's got me puzzled (obviously).


I have stared at this all morning and can't see any difference between
the two sets of code, but I've only got one eye and it's aged and often
blurry after staring at a terminal most of the day. Maybe someone else
can point
out what is probably an obvious flaw that I can't see.

Subroutine code (not working):

IF #limit > *Zeros;

FOR x = 1 to #limit;

CHAIN x DTU020A;

IF %found();

(some code)

Subprocedure code (working):

IF #Limit > *Zeros;

FOR x = 1 to #Limit;

CHAIN x DTU020A;

IF %found();

(different code)

In the interest of full disclosure: the definitions of the variables are:

D #Limit S Like(rrna)
D X S Like(rrna)

And rrna is the relative record number of the subfile record (DTU020A).
The >debug of the subroutine code on the CHAIN 'x' has a value of '1'.
After the IF %found(), the subroutine bypasses all of the "some code"
stuff. The FOR
loop runs for as many records as there are in the subfile; it's the
CHAIN
in the subroutine that doesn't find the subfile record.


--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx 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.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.