IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Can we use 'OR' in Search statement like AND


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vijayamadhuri

Active User


Joined: 06 Apr 2005
Posts: 180

PostPosted: Tue Dec 19, 2006 2:47 am
Reply with quote

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
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Tue Dec 19, 2006 11:06 am
Reply with quote

Did you get any problem using that...

I never used, but what I see in manual for a SEARCH statement ... Complex conditions also falls under the Conditional expressions can be used with a WHEN phrase (serial search)...
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Dec 19, 2006 11:07 am
Reply with quote

Hi

You can surely use OR also

Thanks
Arun
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Tue Dec 19, 2006 11:10 am
Reply with quote

Hi ,

I dont thk there is ne problem in using OR
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Tue Dec 19, 2006 8:11 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts first column truncated in search result IBM Tools 13
No new posts ISRSUPC search utility - using high l... TSO/ISPF 2
No new posts To search DB2 table based on Conditio... DB2 1
Search our Forums:

Back to Top