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

Cobol program, Write a COBOL IF sentence to use the values of numeric var...

Write a COBOL IF sentence to use the values of numeric variables EXAM and COURSEWORK , both assumed to be with format PIC 999 and in the range 0 to 100 and to move the value:

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.

Perform with varying option, PERFORM WITH VARYING OPTION: The format i...

PERFORM WITH VARYING OPTION: The format is as shown below:

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

Structure of a cobol program, Structure of a COBOL Program: Every COBO...

Structure of a COBOL Program: Every COBOL program should have the 4 divisions in the order in which they are specified below: 1. Identification division 2. Environment D

Input-output section - cobol programming, INPUT-OUTPUT SECTION: This s...

INPUT-OUTPUT SECTION: This section holds information regarding the files to be used in the program. There are 2 paragraphs in this section- FILE-CONTROL & I-O-CONTROL. The

Data names and identifiers - cobol program, Data Names and Identifiers:   ...

Data Names and Identifiers:   The Data name provides reference to the storage space in the memory where the real value is stored. This value takes part in the operation whene

#Array, Major difference between file and array how does record read from a...

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

Renames clause, RENAMES CLAUSE: At times re-grouping of an elementary ...

RENAMES CLAUSE: At times re-grouping of an elementary data items in a record may be essential so that they can belong to the original as well as to the latest group. This is o

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

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