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


  • Subject: Re: Problem with reading a file that does have keys
  • From: Buck Calabro <kc2hiz@xxxxxxxxx>
  • Date: Tue, 23 Oct 2018 17:33:00 -0400
  • Autocrypt: addr=kc2hiz@xxxxxxxxx; keydata= xsDiBEcbaT4RBADqmM9OgXil65pjrxclJpxuAF6vraI3kkmJbEHb5ElL7EquHE3QDuFqFgIB 4NZLHDbVAh0AD5exAX+r+xg//UvtBc2k34HROnCpWTMnIOaSVhhVjpYEbZGLz6wfrRpu4Qyn 45iaKT4F0qcHo+0LrGQPef3xrFkUhxURgzY5zgo6+wCg/XjYJ155witPWB2CbNf6RAm9QT0D /jSp6YhvE3xPE12aBuRYM678JTbaQfuYv4HUfug1Wz/0zH5btfEihWVN4wbKaoQ/H/29v2TP /Lyh8XTVd3Z0rz4iaSD5fGicn81WPANBeIepLB8vpfEik6UhHpN1DJkz6Ryw2mgx8p53LhHV Ck4Jt0HP2TAl3f7QTXGFOiFzJwEqBACsHk/gFpKAHdv7n4vJoHqp0RNgOOyhnTThlulPilt6 tAaSe10FOrrugBuLMn7wXBANQ1ApmIb5yNjhYqPREj65OVv2MUbw8H2HnQs//Z6aodyR/kzU 2q2G9A/YFI1LL0m/gvaVbEj/wE0ybBgFkrcoEFeStkqS5HzLEFGUDFXhD80fQnVjayBDYWxh YnJvIDxrYzJoaXpAZ21haWwuY29tPsKFBBMRAgBFAhsDBgsJCAcDAgQVAggDBBYCAwECHgEC F4AFAkcbdMokGGh0dHA6Ly9rZXlzZXJ2ZXIudmVyaWRpcy5jb206MTEzNzEvAAoJEN7KcclH umuRfngAoNXU6AXqyTR8FRuoXKBGS4k7bPUEAJ912WKSkjpCt0axjrq6j22e5XgWzc7BTQRH G2k+EAgAnLXJ9hOqedgsIYM3LuomBBNN+7WTFSVaJ3Rqz8XVZtJvLL0bIRAvpVK9L9rYXlCR cPAm0YNK6H2DR7sQxWlxEH4mWB+jTCTALpcVq+Kpfbw5qDdn+9DVMS7tBOchtTlPSGgdKgn7 sTObra8cHtX/ddTB6OLzHeTXr4PZbUwVeQdIStdwMmozKBQvgjXWKi1GiuYbwYkCM/zJEUCs J36BIE4li9xohJ5O4iKC20YVckMJfZLbn1a2gVgn6Re8C5ezNewT0qM8ZDCUNENWAxsU/c9J UCFQ2QcMU+25b84D5yPxnEKna5U9Fz2JjRjWy5ZKZx2+WhZj0r2Tw6/kGb28AwADBgf/WBsn JSMHxyVfg+LKLHpdANwa9jdrKOt2WjJbWOiJ9l7SmqD0oi3c22FFxRXKsFfjCikLk9wbLZKH SqqnOePvMMHqNcqQTSv7+ARjxnBH4g6dhqg+zmebKpt8zV2awQzYSSm4YY6IqzkWmPNAN7BU zUtSAfL4UU2PljTnT9m443aVCTXMne5l90HQv/gdJ121owg5KuGE6LodTpoR4hn9nbdKWtfY pDNoykvR+GN5y335yF2Zp/j6QgdxWezjou5Y3/6PUZLEsJagWe9hAcKb1eiO2bmg+1bFYu0T g5Mvb27nqfFeHHFysC7a7sXtxp/pqNLNDcK6j/7Th6vF7/n98cJJBBgRAgAJBQJHG2k+AhsM AAoJEN7KcclHumuR9SgAnRuJWHon4GP58xbqCiFR/jSUfvRgAJ47KZ1UNoXgdftoePnbrZu6 W+poEw==
  • List-archive: <https://archive.midrange.com/rpg400-l/>
  • List-help: <mailto:rpg400-l-request@midrange.com?subject=help>
  • List-id: "RPG programming on the IBM i \(AS/400 and iSeries\)" <rpg400-l.midrange.com>
  • List-post: <mailto:rpg400-l@midrange.com>
  • List-subscribe: <https://lists.midrange.com/mailman/listinfo/rpg400-l>, <mailto:rpg400-l-request@midrange.com?subject=subscribe>
  • List-unsubscribe: <https://lists.midrange.com/mailman/options/rpg400-l>, <mailto:rpg400-l-request@midrange.com?subject=unsubscribe>

On 10/23/2018 1:53 PM, Thomas Burrows wrote:
Here is what I mean from top to bottom on the file.
Using DBU here are the first three variables or columns.
Key 1 is the first column A5 length. Key 2 is the second column A14 length

company Customer National
Account
005 000059 000059
005 000117 000117
005 000125 000117
005 000133 000117
005 000141 000117
005 000158 000117
005 000166 021436
005 000174 074625
005 000182 000182
005 000208 000208
005 000224 000224

Code

setll (cuco: cucuno) arlcu;
dow not %eof(arlcu);
exsr mainloop;
enddo;

begsr mainloop;
read arlcu;
if cunano = ' 000117';
count4 = count4 + 1;
cunano = cunano;
endif;
count1 = count1 + 1;
endsr;

I get 14 for count4. And 36 thousand plus for counter1. Which is the
number of records in ARLCU.

If we can assume that the SETLL uses the lowest CUCO and CUCUNO values,
the DOW would start at the lowest record and run to %EOF. COUNT1 would
then be 36k, right?

And because the DOW doesn't stop when CUNO changes, or CUCUNO changes,
COUNT4 represents every row in the file that is for National Account
000117, regardless of CUNO or CUCUNO.

You might want a READE, to restrict the DOW just to the keys of interest.

One thing I've found personally helpful is my Best and Dearest Friend
QSYSPRT, and I mean that sincerely. I'd put in an EXCEPT at each of the
places where the counts are incrementing and some O-specs that print the
fields that will give me that Aha!. It seems faster for me to reach that
Aha! moment when I WRKSPLF than when I'm in debug.

Oh, one other thing - I used to leave debugging code like that in the
source, conditioned on U8 or some such. Today, I'd wrap it in
conditional compilation like this:

// uncomment below for printed debugging info
// define DEBUG

/if defined(DEBUG)
except prtDetail;
/endif


Which in real life is a LF, but when I copied
the file into my library ARLCU became a PF.
Yep. What you want to do is CRTDUPOBJ the PF, make sure your library is
at the top of *LIBL, then CRTDUPOBJ the LF. Then you'll see the LF in
your lib pointing to the PF in your lib.


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.