Rules for search verb, COBOL Programming


The rules apply for the SEARCH verb is as shown below:

(1) The SEARCH verb can be applied only to a table that has the OCCURS clause and INDEXED phrase. The identifier-1 specifies the table to be searched and it should not be indexed or subscripted.

(2) Before the use of the SEARCH verb, the index should have some initial value. The initial value should not exceed the size of the table. If it exceeds, the search is finished instantly. Then if the AT END clause is identified, statements after AT END will be executed; or else the control passes to the next sentence.

(3) If the AT END condition is identified, as in the case of the first illustration, and if the element that is being searched is not found in the table, the statement subsequent to the AT END clause will be executed if statements after AT END do not transfer the control somewhere else in the program. On another hand, if AT END is not used and the end of the table is arrived, the control will be automatically transferred to the next sentence.

(4) The SEARCH verb begins with the initial value of the index and tests whether the conditions stated in the WHEN clauses have been satisfied or not. If not any of the conditions are satisfied the index is incremented automatically by 1. The procedure is continued until the index values exceed the size of the table, the statements subsequent the condition in the relevant WHEN clauses are executed. If such statements do not transfer the control somewhere else, after their execution, it is transferred to the later sentence. The value of the index remains set at the point where the condition has been satisfied.

(5) Connected with the VARYING option, the identifier-2 can be a data, an integral elementary item or the index data item (explained with USAGE AS INDEX CLAUSE). The aim of specifying the VARYING clause is that the identifier-2 is also incremented each time the index of the table is incremented.

Posted Date: 10/18/2012 1:57:49 AM | Location : United States

Related Discussions:- Rules for search verb, Assignment Help, Ask Question on Rules for search verb, Get Answer, Expert's Help, Rules for search verb Discussions

Write discussion on Rules for search verb
Your posts are moderated
Related Questions
FILE CHARACTERISTICS: The task of file handling is the responsibility of the system software termed as IOCS (Input-Output control system). Record Size: We know that th

Data Division: The Data Division is a part of the COBOL program where every data item processed by the program is described. It is very important to note that unless a data

DELETE STATEMENT : The file should be opened in the I-O mode. If the access is SEQUENTIAL, the INVALID KEY phrase must be specified. Rather than, the last input-output state

Identification Division: The Identification Division is the first division of each and every COBOL source program. The paragraph PROGRAM-ID is necessary in most of the mac

DECLARATIVE and FILE STATUS Clause: The input-output exception condition in the situation of a direct access files can be handled by a declarative procedure in a manner simila

MOVE CORRESPONDING: It is frequently required to move some of the data items of one group to some other data items in the other group. If the names of the equivalent data item

we have input file ,record layout is EMP ID (6 char) , EMP NAME (20 char), Designation (3 char),Salary (5 digit) Base Branch (10char) Grade (3 Alphanumeric). This is the input file

Picture Clause: The picture clause explains the general characteristics of an elementary data item. These characteristics are elaborated below: Class: In COBOL the

PERFORM WITH TIMES OPTION: The format of a PERFORM TIMES statement is as shown below: Illustration:   A)  Perform the para-2 5 times. In this situation the specifie

WRITE statement: The WRITE statement for tape and sequential-disk files has the syntax shown below. WRITE            record-name      [  FROM    identifier   ] As a resu