Query regarding Deicde ON EVERY



Software AG's platform-independent programming language with full support for open-source and Internet applications

Query regarding Deicde ON EVERY

Postby diptisaini » Tue Feb 22, 2011 10:47 am

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
diptisaini
 
Posts: 90
Joined: Sun Mar 14, 2010 5:12 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Query regarding Deicde ON EVERY

Postby RGZbrog » Tue Feb 22, 2011 11:14 am

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
User avatar
RGZbrog
 
Posts: 101
Joined: Mon Nov 23, 2009 1:34 pm
Location: California, USA
Has thanked: 0 time
Been thanked: 0 time


Return to Natural

 


  • Related topics
    Replies
    Views
    Last post