A search condition (WHERE clause) in the SELECT statement can limit the retrieved data to only that which is significant for your purposes.
Problem
Select all columns from table CUSTOMERS, but only retrieve rows where
the value of the column STATE is equal to the value of the host
variable WS-STATE.
Solution
.
.
(COBOL statements)
.
.
1 EXEC SQL
2 DECLARE CUSTLIST CURSOR FOR
3 SELECT *
4 FROM CUSTOMERS
5 WHERE STATE = :WS-STATE
6 END-EXEC.
.
.
(COBOL statements)
.
.
Line 3
All columns are selected for inclusion in the result table.
Line 5
The search condition, STATE = :WS-STATE, limits the number of rows retrieved. Only rows where the column STATE contains a value equal to the value of the host variable WS-STATE are selected. Hyphens can be used in a COBOL item which is referenced in an SQL statement.
|
Copyright © 2014 CA.
All rights reserved.
|
|