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



I don't think $equal should be set here as it used to indicate that it detected a record in the file with a key equal to that of the value specified. But no valid key was specified!

Remember that SETLL is attempting to position the read cursor _before_ the first record with the desired key. Telling you that it was able to exactly match (i.e. %equal) is basically just a useful courtesy. If you think of it that way the failure to set %equal may make more sense.

As to the second part of your question, I'm not sure where it is documented - but as a general rule parens mean "this key may not be in the exact right format - please deal with it." - so a packed number will be accepted for a zoned key for example. In the case of *Start they are meaningless.


Jon P.

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

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
pdow@xxxxxxxxxxxxxx

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