what is the difference between occurs and occurs depending
on? i dont think so there is the difference in
storage..then why we should use occurs depending on?

Answer Posted / steve dipaula

Okay folks, I know it has been a while since this was posted
but here is the answer. (1) The memory allocation is the
same whether or not the depending on clause is used period!
(2) The reason for making it a variable length table is for
sorting purposes. More specifically Binary Searches! For a
large table it will have to split the halves more time that
if you have a smaller table. So when loading the table you
keep count of the number of entries at the end of that
process you can set the depending on variable to that value.
Then when the search is executed it will see the table size
as the exact amount of entries, not the full number of
allocated slots.

Example:

Table is defined to have 100 occurrences. And you load 35
items in the table. If you do a search-all (binary search)
it may have to be tested 7 time before finding the item you
are looking for.

Same scenario 100 occurrences, 35 items loaded. But the
depending on variable is set to 35. It might only have to
search 6 times. I know the difference is negligible but in
a much larger case the difference would be quite significant.

Is This Answer Correct ?    19 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

can you please let me know if there is any walkins for COBOL/PLI/DB2/IMS/JCL in pune other than IBM and ITC infotech

2069


For rewrite, why is it mandatory that file needs to be opened?

712


can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there

2008


how to access the file from prodution from changeman tool and to submit a file to production

6887


explain sorting techniques in cobol program?

784






Explain about different table spaces.

744


What is the difference between structured cobol programming and object alternativelyiented cobol programming?

833


what happens if parmparameter passes zero bytes to the program

1752


what is amode(24), amode(31), rmode(24) and rmode(any)?

789


What is the use of intialize verb?

861


what are decleratives in cobol?

1903


How to get the last record in vsam file in cluster? And how can you get the ksds file records into cobol program?

797


Give some examples of command terminators?

848


What are the various section in data division and briefly explain them.

815


What is the LINKAGE SECTION used in COBOL?

1040