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
The LENDER Bank offers mortgages on homes valued up to $500,000. The required down payment is calculated as follows: 4% of the first $60,000 borrowed 8% of the next $30,000 borro

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

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

LEVEL NUMBERS: The COBOL makes use of the level number concept to explain the hierarchical data structure. A level number is a 2 digit number. The permitted level numbers a

Example of Sign condition: The illustration below describes the use of the sign condition. Illustration:     77  BALANCE  PIC  S9 (6) V99.       .       .     I

File- Section &Working-Storage Section: a) FILE SECTION: The FILE SECTION includes the explanation of all data items that must be read from or written onto some external

Can u please let me know how can i use SSA''s in IMS while fetching segments. Thanks, Rajesh

DELETE STATEMENT: The format of the delete statement is as shown below: DELETE   file-name RECORD   [  ;   INVALID   KEY  imperative-statement  ] Whenever the ACCESS MOD

PROGRAM FOR INVENTORY  We have to write a program to update the inventory file. Consider 2 files,viz, invfile an tranfile. Invfile has 3 fields pno,name,qty. Tranfile has 3 fil

PROGRAM FOR IF :   We have to write a program to check whether the given number is ODD or EVEN. Identification division. Program- id. Ifst. Environment division.