So let's go through the code, to end all confusion:

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


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*

I think there is no explanation needed. Only that all parameters, including P1COM# and P1ENT#, seem to be optional - otherwise wsprms = *PARMS might not be needed.

c*
c if wsprms>0
c move p1com# accom#
c move p1ent# acent#
c ackey setll arcma1
c endif
c*

The SETLL positions the file to (right in front of) the first record, that matches p1com# and p1ent# - as I can't see the definition of the ackey KLIST I assume, that those fields are "leading keys" of the file arcma1.

The positioning is only done, if at least 1 parameter was gives to the program - which is odd, because if only 1 parameter is given, it would result in a MCH3601 message for p1ent#.

c dow '1'
c read arcma1

An infinite loop reading arcma1

c if %eof
c or wsprms>0
c and (accom#<>p1com# or acent#<>p1ent#)
c leave
c endif

The loop ending conditions are defined in an IF with LEAVE - a typical construct. The LEAVE-conditions are:

a) if %EOF() is reached
OR
b) if pgm parameters are given and accom# or acent# differ from that pgm parameters

If accom# and acent# are leading keys of the file arcma1 a loop with READE might have worked - but for this we would have to see the LF definition and the KLIST.

But as I already said - anytime I find such a construct, I would always refactor and use SQL - instead of "negative" logic (for LEAVE) a SQL SELECT uses "positive" logic (which records are needed).

Am 05.08.2025 um 09:13 schrieb Patrik Schindler <poc@xxxxxxxxxx>:

Honestly, even I avoid using implicit cycling, because it's function not represented by code, which confuses me.

I have to disagree Patrik ;-) the cycle is of course explicitly coded by coding the file as a primary (or secondary) by that single "P" (or "S") in position 19 (ILE) of the traditional file specification. That might not be so obvious - but it is explicitly coded.

Of course I know - the compiler is doing a lot implicitly and under the covers - but that's not really a bad thing - Python, Perl, Java, C# - all modern languages do something "under the hood" - even if it's only implicit type conversion.

The problem with the cycle is that one really has to learn how it works - including L1 to L9 and MR. That means some (like a lot of) reading, some testing - and that kind of "slow learning" isn't en-vogue since the early 2000's - Learn-XYZ-in-21-days books and 5-15 minute YouTube videos have done a lot of harm.

In Japan they say that you need 7 years to learn something well - and another 7 years to master it. In our world today any 3-years-out-of-college is called a "Senior Software Architect".

That said - as always - the answer (again) is most probably SQL.

Kind regards,
Daniel



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.