Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 COBOL - EXIT statement weird behavior anthony.pangestu COBOL Programming 0 Fri Oct 27, 2017 9:57 am
No new posts HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
No new posts Search for a string in many PDS KARTHIGADEVI CLIST & REXX 5 Fri Sep 08, 2017 2:32 pm
No new posts WER268A OUTREC STATEMENT : SYNTAX E... frozenblood87 SYNCSORT 12 Sat Aug 26, 2017 9:45 pm
No new posts Suppress value reported by BREAK in D... Learncoholic DFSORT/ICETOOL 3 Wed Aug 16, 2017 6:03 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us