Rules for search verb, COBOL Programming

Assignment Help:

RULES FOR SEARCH VERB:

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.


Related Discussions:- Rules for search verb

Example of on size error option, ON SIZE ERROR OPTION: Whenever a size...

ON SIZE ERROR OPTION: Whenever a size error occurs, the contents of the result field after the operation is unpredictable.  Though, the processing is not-terminated and the co

Example of condition names, Example of condition names: The illustrati...

Example of condition names: The illustration below is of the use of the condition names  77  MARITAL-STATUS     PIC    9   88  SINGLE    VALUE    IS     ZERO   88  MA

Close statement, CLOSE STATEMENT: When the processing of a file is com...

CLOSE STATEMENT: When the processing of a file is completed, then the file may be closed. This is completed with the help of the CLOSE-verb. The form of the CLOSE statement is

Picture specification - picture clause, PICTURE specification: The siz...

PICTURE specification: The size of a group item is equivalent to the total of the sizes of all the subordinate elementary items. The group item class is alphanumeric. The i

Data record clause - and code-set clause, DATA RECORD CLAUSE: The DATA...

DATA RECORD CLAUSE: The DATA RECORD clause, documents the record names defined for the file. For illustration, DATA RECORDS ARE REC-1, REC-2, REC-3 that means there are 3diffe

Introduction to cobol, Introduction to COBOL: In the year 1959, a new ...

Introduction to COBOL: In the year 1959, a new language named the COBOL ( CO mmon B usiness O riented L anguage) was introduced remembering the business purpose application

#verbs, Display control verbs in Cobol

Display control verbs in Cobol

Program for renames clause, PROGRAM FOR RENAMES CLAUSE: identification...

PROGRAM FOR RENAMES CLAUSE: identification division. program- id. environment division. data division. working-storage section. 01 emp.      02 empdet.

Illustration of perform statement, Illustration of perform statement: ...

Illustration of perform statement: PERFORM    CALCUALTE-TAX. In this illustration, the CALCULATE-TAX is either a section name or paragraph name. Assume that it is a section

Program for subtract verb, PROGRAM FOR SUBTRACT VERB: We have to write...

PROGRAM FOR SUBTRACT VERB: We have to write a simple program to elaborate the SUBTRACT verb. You can also use edit characters in the program. Identification division. Pr

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd