Well a nice

dow *on;

is absolutely OK - I tend to use it with embedded SQL.

And for the original post - even risking to sound like a broken record, the answer is most probably SQL - like in 99.7% of all cases where data from tables have to be processed.

exec sql declare csrArcma1 cursor for
select ...
from arcma1
where wsprms <= 0
and accom# = :p1com#
and acent# = :p1ent#;

If I got that right - it should result in exactly those records that the pgmr has intended to read.

I find the SQL logic clearer - you write which records you want - not a mix between "wanted" (the SETLL) and "not wanted" (the IF ... LEAVE).

HTH and kind regards,
Daniel



Am 04.08.2025 um 19:56 schrieb Brad Stone <bvstone@xxxxxxxxx>:

dow '1' is a forever loop. yikes.

I've done stuff like that in the past, but only to be cheeky.

On Mon, Aug 4, 2025 at 10:46 AM Greg Wilburn <
gwilburn@xxxxxxxxxxxxxxxxxxxxxxx> wrote:


I came across this code... (this is not my code!)

The program with this code seemed to never end, and I think this is why.

1. WSPRMS is assigned *PARMS
2. P1COM# & P1ENT# are the possible parameters

c*
c *entry plist
c parm p1com# 3
c parm p1ent# 8
c parm p1wx
c*

code here ...

c*
c if wsprms>0
c move p1com# accom#
c move p1ent# acent#
c ackey setll arcma1
c endif
c*
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?
If so, what's in the parameters?
Could this be a never ending loop?

Greg
[Logo]<https://www.totalbizfulfillment.com/> Greg Wilburn
Director of IT
301.895.3792 ext. 1231
301.895.3895 direct
gwilburn@xxxxxxxxxxxxxxxxxxxxxxx<mailto:gwilburn@xxxxxxxxxxxxxxxxxxxxxxx>
1 Corporate Dr
Grantsville, MD 21536
www.totalbizfulfillment.com<http://www.totalbizfulfillment.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.


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


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