× 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 think what you're looking for is SETLL and checking using %EQUAL.SETLL (custNo: dateField) myFile;IF %EQUAL(myFile);  // It existsENDIF;Yours truly,Glenn Gundermannglenn.gundermann@xxxxxxxxx(416) 317-3144--
-------- Original message --------From: "James H. H. Lampert via RPG400-L" <rpg400-l@xxxxxxxxxxxxxxxxxx> Date: 2022-06-03 1:38 p.m. (GMT-05:00) To: RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxxxxxxxx> Cc: "James H. H. Lampert" <jamesl@xxxxxxxxxxxxxxxxx> Subject: Checking for existence of a record Suppose I have a file that is keyed on a customer number and a date, both keys ascending.And I want to check for the *existence* of at least one record with the specified customer number and a date *no earlier than* a specified cutoff. The *contents* of that record are of no interest; all I care about is the *existence* of at least one.I have a KLIST on my file. I plug the customer number into the first field of the KLIST, and the cutoff date into the second.In my test program, I look for two different customer numbers, one which *does* have at least one record meeting the cutoff date, and one which *does not* have one.If I SETLL on the KLIST, without actually reading anything, and only looking at %FOUND, then both come back with %FOUND = true, since the customer number *without* a record-of-interest just falls through to the next customer number.If I CHAIN on the KLIST, then they both come back with %FOUND = false, since the customer number *with* a record-of-interest doesn't have one that exactly matches the date.I *could* do a READ after the SETLL, and check to see if the customer number matches. Or I *could* do a READE on it, specifying only the customer number, and check %EOF.Is there anything else that I'm missing?I'm looking for maximum efficiency on this check, as it's going to have to be run for a few thousand different customer numbers.--JHHL-- This is the RPG programming on IBM i (RPG400-L) mailing listTo post a message email: RPG400-L@lists.midrange.comTo subscribe, unsubscribe, or change list options,visit: https://lists.midrange.com/mailman/listinfo/rpg400-lor email: RPG400-L-request@lists.midrange.comBefore posting, please take a moment to review the archivesat https://archive.midrange.com/rpg400-l.Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.