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
Column and Field in COBOL program: In COBOL there are 2 types of entries termed as margin A and margin B entries. The Margin A entries start from the column 8, 9, 10 or 11 and

PERFORM WITH UNTIL OPTION: The format is as shown below: Illustration:  A) Perform p-3 until i > 5. Here p-3 will be executed whenever i B)  Perform p-2 thru

77 level used for- It is Elementary level item. it Cannot be subdivisions of other items or cannot be qualified, or they can be subdivided themselves.

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

B (Blank Insertion) : The occurrence of a B anyplace in the picture will insert a space character in the edited data. There can be more than one B in the picture. Examples:

How do i write a simple cobol programming that works

FILE-CONTROL ENTRIES FOR THE SEQUENTIAL FILES: The characteristics of each and every files handled in a program are specified in the ENVIRONMENT DIVISION and DATA DIVISION.

ADD and SUBTRACT CORRESPONDING: The CORRESPONDING option can also used with the ADD and SUBTRACT verbs. The following are some of the formats of these verbs with the CORRESPON

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

Example of Accept statement: For illustration, ACCEPT FLAG-A can be specified to read the value of the FLAG_A from the console. It may be keep in mind that no file definition