The SEARCH statement is used to search a table for a table element that satisfies the specified condition and to adjust the associated index-name to indicate that table element.
Format 1:Search (Serial)
Format 2:Search All (Binary)
In both Formats 1 and 2, identifier-1 must not be subscripted or reference modified,but its description must contain an OCCURS clause with an INDEXED BY phrase.The description of identifier-1 in Format 2 must also contain the KEY IS phrase in its OCCURS clause.
identifier-2, when specified, must be described as USAGE IS INDEX or as a numeric elementary item without any positions to the right of the assumed decimal point.
In Format 1, condition-1 may be any conditional expression.
In Format 2, all referenced condition-names must be defined as having only a single value.The data-name associated with a condition-name must appear in the KEY phrase of the OCCURS clause of identifier-1.Each data-name may be qualified.Each data-name must be subscripted by the first index-name associated with identifier-1 along with other indexes or literals as required, and must be referenced in the KEY phrase of the OCCURS clause of identifier-1. identifier-3 , identifier-4 , or identifiers specified in arithmetic-expr-1 or arithmetic-expr-2 must not be referenced in the KEY phrase of the OCCURS clause of identifier-1 or be subscripted by the first index-name associated with identifier-1.
In Format 2, when multiple keys are defined and a data-name in the KEY phrase of the OCCURS clause of identifier-1 is referenced, or when a condition-name associated with a data-name in the KEY phrase of the OCCURS clause of identifier-1 is referenced, all preceding data-names in the KEY phrase of the OCCURS clause of identifier-1 or their associated condition-names must also be referenced.
The following general rules apply to the SEARCH statement:
The index-name remains set at the value that causes the condition to be satisfied.
A representation of the action of a Format 1 SEARCH statement containing two WHEN phrases is shown in Figure.
SEARCH Statement Examples
COBOL Related Interview Questions
|VSAM Interview Questions||IBM - VSAM Interview Questions|
|IBM-CICS Interview Questions||JCL Interview Questions|
|IBM DB2 Interview Questions||IBM-JCL Interview Questions|
|DB2 Using SQL Interview Questions||IBM-JCL&VSAM Interview Questions|
|IBM Mainframe Interview Questions||COBOL, CICS, JCL, VSAM, DB2 Interview Questions|
|DB2 SQL Programming Interview Questions||IMS/DB Interview Questions|
|Mainframe DB2 Interview Questions|
Procedure Division Statements
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.