Search verb, COBOL Programming

Assignment Help:

SEARCH VERB:

The SEARCH verb is used to position elements in one-dimensional tables. Let us consider the following problem. Assume that each element of a table consists of three fields, viz., the account number of a person, name of that and the amount that he has deposited. There are 400 such elements in the table and we want to find out whether a specific name is present in the table or not. The preferred name is given in the field is termed as NAME and if this name appears in an element of the table, we would like to show the name as well as the corresponding account number and amount. The DATA DIVISION entries for this trouble are as shown below:

1612_SEARCH VERB.png

The PROCEDURE DIVISION statements below can be a solution to the above problem. 

1381_SEARCH VERB1.png

In the above SEARCH statement, there are two sections- the AT END section and the WHEN section. If the condition NAME= NAME-OF-THE-PERSON (A1) is satisfied for some value the index name A1, the statement DISPLAY ACCOUNT-NUMBER (A1), NAM AMOUNT (A1) is executed. The AT END section is executed only when the whole table searched and the condition is not satisfied for any value of A1. The increment of A1 is take care by the SEARCH verb. 

 


Related Discussions:- Search verb

Subscript and index, What is the difference between subscript and index

What is the difference between subscript and index

Program for sequential file creation & rewriting , Program for Sequential F...

Program for Sequential File Creation & Rewriting  We have to write a program to create a Length file with just two fields: l (Length) and l-c (Length-Code). Add a few records.

Example of file-control, Example of File-control: The assign clause as...

Example of File-control: The assign clause assigns a specific physical peripheral device name to a file. The physical peripheral device are machine-dependent. We use the devic

Program of occurs clause, OCCURS CLAUSE - PROGRAM: We have to write a ...

OCCURS CLAUSE - PROGRAM: We have to write a program to elaborate occurs clause. Get names and marks of the students and show them on the screen.   identification division.

Kirat da satikar, bal majduri ik kanuni apradh hai is de bavjud bache ,ghra...

bal majduri ik kanuni apradh hai is de bavjud bache ,ghra,hotla,road, kam karn lai majbur han bacheya te mapeya nu parhai val prerit karn lai ik bashan teyar kro

Declarative and file status clause, DECLARATIVE and FILE STATUS Clause: ...

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

Transaction file - file updation, Transaction file : A transaction file...

Transaction file : A transaction file is a file which contains new records those changes to old records which are used to update the master file. The problem of file updatio

Compound condition, COMPOUND CONDITION: The two simple conditions can ...

COMPOUND CONDITION: The two simple conditions can be connected by the logical operators AND or OR to form a compound condition (also termed as combined condition). When two co

Giving file-name - simple merge verb, GIVING    file-name-5. The input...

GIVING    file-name-5. The input files to be merged through the MERGE statements which are specified in the USING phrase. These files should be sequential files and should be

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