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



Hi Pete,

Not tested but...

For x = 1 To (%Elem(UDF)-1);
   If UDF(x) <> 0;
      If %LookUp(UDF(x):UDF(x+1)) > 0;
        // Duplicate Value
      EndIf;
   EndIf;
EndFor;

Regards
 
Paul Tuohy
ComCon
www.comconadvisor.com 
 
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Pete Helgren
Sent: 05 May 2006 06:54
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


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.