What are various search techniques in COBOL? Explain
Detailed Explanation
There are 2 searching techniques in COBOL.
1. Serial search: It is a process of finding a particular value in a given list.
The search is implemented by checking each element in the list, one at a time and in sequence.
This process is continued until the desired element is found.
SEARCH is used for serial search.
2. Binary Search: It is a process of finding a particular element in a sorted list.
The binary search starts by comparing the middle element of the array.
The comparison determines the element’s location – either in the first half of the list or in the second half of the list.
This process continues until the search element is equal to the middle element of the list
SEARCH ALL is used for binary search.
The list must be sorted by using ASCENDING / DESCENDING KEY clause, which loads. The default key is ASCENDING KEY
Discussion (0)
No comments yet. Be the first to share your thoughts!
Share Your Thoughts