|
At v5r2, the number of key fields to be specified in %kds must be a constant (which the help doesn't' say, but I've always gotten errors when I tried to use a variable). I wish it allowed for a variable - that would open up the potential for some cleaner code. Kurt Anderson Application Developer Highsmith Inc -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of AGlauser@xxxxxxxxxxxx Sent: Thursday, March 01, 2007 9:22 AM To: RPG programming on the AS400 / iSeries Subject: Re: CHAIN Versus SETLL and READ When Data Needed I also thought of another way that this could lend itself to being better than a list of key fields. Consider: for numToCheck = NUM_KEY_FIELDS down to 1; chain %kds(keyDS : numToCheck); if (%found()); leave; endif; end for; Firstly, if the number of key fields changes, all that is required is to change the NUM_KEY_FIELDS constant. Perhaps there is even a way to determine the number of key fields programmatically? Secondly, just to fan the flames again ... maybe this is a good case for the leave opcode?
:)
As an Amazon Associate we earn from qualifying purchases.
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.