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



Hi Peter


SETLL does not position on a record - with *START it positions before the first record. I think %found doesn't have a way to know about what in the file in this case. Someone can help out here.


Vern


On Thu, 16 Mar, 2023 at 5:21 PM, Peter Dow <petercdow@xxxxxxxxx> wrote:


To: rpg400-l@xxxxxxxxxxxxxxxxxx

Yes, I can see that as an explanation for the observed behavior.

A related issue is SETLL *START and %found. The manual says

"The resulting indicators reflect the status of the operation. You can
specify an indicator in positions 71-72 that is set on when the search
argument is greater than the highest key or relative record number in
the file. This information can also be obtained from the %FOUND built-in
function, which returns '0' if no record is found, and '1' if a record
is found."

So I tried

dcl-s wFound ind;

setll *start MyFile;
wFound = %found(MyFile);

and in debug, wFound = '0', even though there are records in the file.

Again, you could say that %FOUND has no meaning when *START is
specified. But I'd argue that if records exist in a file, then the
*STARTing record exists. And *START works for keyed and non-keyed
(arrival sequence) files.


On 3/16/2023 2:55 PM, Therrien, Paul via RPG400-L wrote:
I've never used *START.
But it seems to me the %EQUAL has no meaning when you are not providing key values to the SETLL op code.



-----Original Message-----
From: RPG400-L<rpg400-l-bounces@xxxxxxxxxxxxxxxxxx<mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx>> On Behalf Of Peter Dow
Sent: Thursday, March 16, 2023 5:20 PM
To: rpg400-l<rpg400-l@xxxxxxxxxxxxxxxxxx<mailto:rpg400-l@xxxxxxxxxxxxxxxxxx>>
Subject: SETLL *START and %EQUAL

I have a program that has

SETLL *START MyFile;
IF %EQUAL();
READ MyFile;
ELSE;
do something different;
ENDIF;

In debug, I discovered that it does something different. My first thought was that maybe it's because the file is empty, but it wasn't.

After reading the manual, the closest thing I can see to saying why %EQUAL was *OFF was this:

"You can specify an indicator in positions 75-76 that is set on when a record is present whose key or relative record number is equal to the search argument. This information can also be obtained from the %EQUAL built-in function, which returns '1' if an exact match is found."

I guess there's an argument to be made that *START is not an exact match with whatever is in the first record, but one could also say that the first record is always a match for the first record.

I also noticed that the manual does not say what the effect of () around the search argument is. My assumption there is that the () define a list of values that are converted to match the related key fields, but the manual does not say that.

Where is this stuff actually stated?

--
*Peter Dow* /
Dow Software Services, Inc.
909 793-9050
petercdow@xxxxxxxxx<mailto:petercdow@xxxxxxxxx>
pdow@xxxxxxxxxxxxxx<mailto:pdow@xxxxxxxxxxxxxx>

/
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email:RPG400-L@xxxxxxxxxxxxxxxxxx<mailto: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<mailto:RPG400-L-request@xxxxxxxxxxxxxxxxxx>
Before posting, please take a moment to review the archives athttps://archive.midrange.com/rpg400-l.

Please contactsupport@xxxxxxxxxxxxxxxxxxxx<mailto:contactsupport@xxxxxxxxxxxxxxxxxxxx> for any subscription related questions.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.