Page 1 of 1

Query regarding Deicde ON EVERY

PostPosted: Tue Feb 22, 2011 10:47 am
by diptisaini
Hi,

I just need to know what is the exact use of Decide ON every statement ?
DECIDE ON EVERY VALUE OF #FIELD

As per my understanding #field contain only one value at a time then how Every will work ?


Thanks

Re: Query regarding Deicde ON EVERY

PostPosted: Tue Feb 22, 2011 11:14 am
by RGZbrog
Here are a couple of examples of EVERY.

In the first DECIDE, the value A is present in several VALUE clauses, so we need to test EVERY value.

In the second DECIDE, we test the contents of a vector, which contains 4 values. Again, we must test EVERY value.

DEFINE DATA LOCAL
1 #S (A1)    INIT <'A'>
1 #V (A1/4)  INIT <'A', 'C', 'D'>
END-DEFINE
DECIDE ON EVERY #S
  VALUE 'A'
        WRITE 'S is A'
  VALUE 'A', 'B'
        WRITE 'S is A or B'
  VALUE 'A', 'C'
        WRITE 'S is A or C'
  ANY
        WRITE '=' #S
  NONE
        WRITE 'S not found' #S
END-DECIDE
SKIP 1
*
DECIDE ON EVERY #V (*)
  VALUE 'A'
        WRITE 'V contains A'
  VALUE 'B'
        WRITE 'V contains B'
  VALUE 'C'
        WRITE 'V contains C'
  ANY
        WRITE '=' #V (*)
  NONE
        WRITE 'V not found' #V (*)
END-DECIDE
END


Page     1                                                   02/21/11  21:35:11
 
S is A
S is A or B
S is A or C
#S: A
 
V contains A
V contains C
#V: A C D