Based on your assessment, I can confirm the following:
1. ARCMA1 is not empty (our customer master file)
2. No other leave in the DO loop
3. No other read of ARCMA1
4. WSPRMS=0
Based on that, this program should exit after reading all records in ARCMA1.
I'm examining this because a CL that runs this pgm on Saturday morning (08/02), didn't end until Sunday Morning when the system IPL'd. This normally takes 20 minutes. But this "new" version of the program put in place on 08/01.
The last message in the joblog for the CL referenced this program (simple Override to QPRINT message).
The very next program called by the CL has a last-used date of 08/01, which points to this program not completing for over 24 hours.
I can't see any other messages in the job log.
Stumped.
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of John Yeung
Sent: Monday, August 4, 2025 12:03 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: confusing coding?
On Mon, Aug 4, 2025 at 11:46 AM Greg Wilburn
<gwilburn@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
c dow '1'
c read arcma1
c if %eof
c or wsprms>0
c and (accom#<>p1com# or acent#<>p1ent#)
c leave
c endif
Specifically, the condition where no parameters (p1com# and p1ent#) are passed in... If %eof occurs, the "AND" in the above applies when WSPRMS=0, correct?
No. If %eof is true, then the condition is true and the loop is exited.
If %eof is false, then you check the rest:
wsprms>0 and (stuff)
When WSPRMS = 0, that condition is false, regardless of "stuff". So if
WSPRMS = 0, then the LEAVE is skipped over. So, it *might* be an
infinite loop if WSPRMS = 0.
Other conditions that all have to be met for it to be infinite:
1. ARCMA1 is not empty.
2. There is no other (reachable) LEAVE in the DO loop.
3. There is no other (reachable) read of ARCMA1 in the DO loop.
John Y.
--
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.
Greg Wilburn
Director of IT
301.895.3792 ext. 1231
As an Amazon Associate we earn from qualifying purchases.