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 open statement, Example of Open statement: Illustration: ...

Example of Open statement: Illustration: The OPEN INPUT TRANSACTION, OLD-MASTER OUTPUT NEW-MASTER. The illustration represents that there are two input files named the

Program to find interest on bank deposits, PROGRAM TO FIND INTEREST ON BANK...

PROGRAM TO FIND INTEREST ON BANK DEPOSITS: We have to write a program to find interest on deposits. The criteria is given below : identification division. program-

Example of special-names - configuration section, Example of Special-names:...

Example of Special-names: Consider the illustration: Let the SPECIAL-NAMES paragraph be as shown: SPECIAL-NAMES. CHANNEL 1 IS PAGE-TOP. The Channel is related with the t

Indexed sequential files, INDEXED SEQUENTIAL FILES: In the indexed seq...

INDEXED SEQUENTIAL FILES: In the indexed sequential files which are also known as indexed files, the records are stored in the sequence order generally in ascending order. In

Procedure division statements for the indexed files, PROCEDURE DIVISION sta...

PROCEDURE DIVISION statements for the indexed files: All the statements which are available for a relative file are also available for an indexed file. READ STTATEMENT :

Program for perform - thru, PROGRAM FOR PERFORM - THRU: We have to wri...

PROGRAM FOR PERFORM - THRU: We have to write a program to elaborate PERFORM ...THRU statement Identification division. Program- id.  Perfthru. Environment division.

Rules for search verb, RULES FOR SEARCH VERB: The rules apply for the ...

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 phra

Character set - cobol programming, Character Set: To study any languag...

Character Set: To study any language, first one should know the alphabets of the language and they are termed as character set in general. There are 50 different characters in

Illustration of renames clause, Illustration of Renames clause: In the...

Illustration of Renames clause: In the illustration, PAT-OTHER-THAN-BASIC will become a fresh group consisting of DEARNESS-ALLOWANCE, HOUSE-RENT & MTHLY-INCENTIVE. Keep in min

Program for screen section, PROGRAM FOR SCREEN SECTION:  identificatio...

PROGRAM FOR SCREEN SECTION:  identification division.   program- id.   environment division.   data division.   working-storage section.   01  a pic 9(2) value

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