Search verb, COBOL Programming

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. 

 

Posted Date: 10/18/2012 1:55:52 AM | Location : United States







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

Write discussion on Search verb
Your posts are moderated
Related Questions
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

PERFORM STATEMENT:   The PERFORM statement can be used to execute the group of consecutive statements written elsewhere in the program. We refer to this group of statements a

Illustration of nested if statement: Consider the nested sentence which is as shown below: The IF-ELSE pairs in this sentence can be detected by applying the rule whic

PROCEDURE DIVISION statements for the relative files: The statements OPEN, CLOSE, READ, WRITE and REWRITE that are available for sequential files are also available for the re

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

Example of If- else statement Illustration:   IF   QUANTITY IS NUMERIC AND QUANTITY IS POSITIVE          MOVE ZERO TO ERROR-CODE. COMPUTE SALES VALUE=QUANTITY*RATE

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

Major difference between file and array how does record read from array and file why we are not preparing array for real time

Floating Insertion   The currency symbol ($) can emerge in multiples on the left-hand side of the picture. In this situation the character will be treated in similar way as t

Minus sign - edit characters for numeric data: The minus sign can appear either at the leftmost or rightmost location of the picture. If an item is negative, a minus sign will