|
It might be easier to use a array of five indicator to do the checking. See below (haven't tested/compiled, but you got the idea): DUDFS DS D FTSUDF1 1S 0 D FTSUDF2 1S 0 D FTSUDF3 1S 0 D FTSUDF4 1S 0 D FTSUDF5 1S 0 D UDF Like(FTSUDF1) Dim(5) D overlay(UDFS) D UDFChkAry n dim(5) for LoopCount = 1 to 5; if UDF(LoopCount) > %elem(UDFChkAry) or UDFChkAry(UDF(LoopCount)); error occurred.... else; UDFChkAry(UDF(LoopCount)) = *on; endif; endfor; -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Pete Helgren Sent: Friday, May 05, 2006 12:54 AM To: RPG Midrange Discussion Subject: Efficient validation of array contents I have a set of five values that come in from a prompt screen that can be from 1 to 5 and can only occur once. That is, if a value is entered (not 0) , it must be a value from 1 to 5 and there cannot be duplicate values. The fields are loaded into an array: DUDFS DS D FTSUDF1 1S 0 D FTSUDF2 1S 0 D FTSUDF3 1S 0 D FTSUDF4 1S 0 D FTSUDF5 1S 0 D UDF Like(FTSUDF1) Dim(5) D overlay(UDFS) and then I loop through them: for LoopCount = 1 to 5; if UDF(LoopCount) <> 0; // Check to make sure the value is between 1 and 5 if UDF(LoopCount) > 5; //Error occurs endif; // Check to make sure the number only occurs once ?? endif; endfor; I can't think of an easy way to check the occurrence of the number in the array. The brain is just a wee bit stretched tonight. A quick solution? Thanks, Pete Helgren -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.