View previous topic :: View next topic
|
Author |
Message |
vijayamadhuri
Active User
Joined: 06 Apr 2005 Posts: 180
|
|
|
|
hello
Can we use OR in a search stATEMENT AS SHOWN BELOW.
OR IS IT THAT ONLY AND CAN BE USED.
pLEASE CLARIFY.
Code: |
SEARCH TABLE XYZ
AT END
MOVE 'Y' TO EOF
WHEN
WS-STRT-MODEL-YR (SUB1) <= WS-INPUT-MODEL-YR AND
WS-END-MODEL-YR (SUB1) >= WS-INPUT-MODEL-YR AND
WS-START-TERM-MM (SUB1) <= WS-INPUT-OPT-TERM OR
WS-END-TERM-MM (SUB1) >= WS-INPUT-OPT-TERM AND
WS-START-MILG (SUB1) <= WS-INPUT-OPT-MLG AND
WS-END-MILG (SUB1) >= WS-INPUT-OPT-MLG OR
WS-EFFECT-DATE (SUB1) <= WS-OPT-SALE-DTE AND
WS-END-DATE (SUB1) >= WS-OPT-SALE-DTE AND
WS-PRC-OPT-CODE (SUB1) = WS-OPTION-CODE |
|
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Hi
You can surely use OR also
Thanks
Arun |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi ,
I dont thk there is ne problem in using OR |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
The compiler will let you use 'OR', however, the way you have it stated may not yield the result you expect. Mixing ?AND?s and ?OR?s together without grouping them together with ?(? ?)? is not a good practice. Is below what you wanted? Probably not, but is one interpretation.
Code: |
SEARCH TABLE XYZ
AT END
MOVE 'Y' TO EOF
WHEN
((WS-STRT-MODEL-YR (SUB1) <= WS-INPUT-MODEL-YR AND
WS-END-MODEL-YR (SUB1) >= WS-INPUT-MODEL-YR)
AND
(WS-START-TERM-MM (SUB1) <= WS-INPUT-OPT-TERM OR
WS-END-TERM-MM (SUB1) >= WS-INPUT-OPT-TERM))
AND
((WS-START-MILG (SUB1) <= WS-INPUT-OPT-MLG AND
WS-END-MILG (SUB1) >= WS-INPUT-OPT-MLG)
OR
(WS-EFFECT-DATE (SUB1) <= WS-OPT-SALE-DTE AND
WS-END-DATE (SUB1) >= WS-OPT-SALE-DTE))
AND
(WS-PRC-OPT-CODE (SUB1) = WS-OPTION-CODE)
|
|
|
Back to top |
|
|
|