Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Can we use 'OR' in Search statement like AND

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Can we use 'OR' in Search statement like AND
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: 1452
Location: Chicago, IL

PostPosted: Tue Dec 19, 2006 11:06 am    Post subject: Re: Can we use 'OR' in Search statement like AND
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: 2285
Location: @my desk

PostPosted: Tue Dec 19, 2006 11:07 am    Post subject:
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: 1187
Location: Bangalore,India

PostPosted: Tue Dec 19, 2006 11:10 am    Post subject:
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    Post subject: Re: Can we use 'OR' in Search statement like AND
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Suppress value reported by BREAK in D... Learncoholic DFSORT/ICETOOL 3 Wed Aug 16, 2017 6:03 pm
No new posts ON 2 AND EVERY 1 - Statement ??? UmeySan COBOL Programming 2 Tue Jul 25, 2017 1:20 pm
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us