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



      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  used                           N   Dim(5)

          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: Number too high
              else;
                if used(UDF(LoopCount));
                  //Error: Number already used
                else;
                  used(UDF(LoopCount)) = *on;
                endif;
              endif;
            endif;
          endfor;

Joep Beckeringh


Pete Helgren wrote:
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.