Quantcast
Channel: IBM Mainframe Computers Forums
Viewing all articles
Browse latest Browse all 9405

DB2 :: Refining an SQL

$
0
0
Author: TS70363
Subject: Refining an SQL
Posted: Wed May 25, 2016 3:12 am (GMT 5.5)

Hi...

I have the below SQL as a Cursor declaration in my application (COBOL)

Could any one please help refine it?

Code:
SELECT COLUMN1, COLUMN2 from TABLE1
Where
(COLUMN3 = :input1 value AND "N" = :WS-flag)
Or
(COLUMN4 = :input2 value AND "Y" = :WS-flag)


COLUMN3 and COLUMN4 are 2 different indexes on TABLE1.
When I checked the EXPLAIN, the access type is M, MX, MI.

COBOL logic behind WS-flag derivation
Code:
IF INPUT3 = 'valid value'
MOVE 'Y' TO WS-flag
ELSE
MOVE 'N' TO WS-flag



Thanks...
_________________
TS70363


Viewing all articles
Browse latest Browse all 9405

Trending Articles