Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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?

Answers were Sorted based on User's Feedback



what is the difference between occurs and occurs depending on? i dont think so there is the differ..

Answer / 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

what is the difference between occurs and occurs depending on? i dont think so there is the differ..

Answer / venkat

when we define cobol table with OCCURS, it is of fixed
storage and length. The program execution will take the
total storage irrespective of utiliztaion. Where as table
degined with OCCURS DEPENDING ON provides flexibility to
the developers to choose length of table dynamically.
Length of below table is based on WS-OBJ value.

WS-SUB OCCURS 1 TO 5 TIMES DEPENDING ON WS-OBJ PIC X(2).

For example if you want to stoge employee detail in an
cobol table and you are not aware of number of employees at
the time of table declaration, you can use variable length
cobol table. During program execution based on number of
employees you can set the length of table

Is This Answer Correct ?    14 Yes 5 No

what is the difference between occurs and occurs depending on? i dont think so there is the differ..

Answer / thilak

yes as for as storage is considered, there is no difference.
Occurs & occurs depending on allocates the maximum memory
specified in the "integer TIMES" CLAUSE.

But there are options of allocating memory dynamically at
the cost of runtime overhead.

for more
http://coding.derkeiler.com/Archive/Cobol/comp.lang.cobol/20
05-05/msg00396.html

Is This Answer Correct ?    4 Yes 0 No

what is the difference between occurs and occurs depending on? i dont think so there is the differ..

Answer / anna.

For hard-coded table we define cobol table with OCCURS,
becouse it is fixed numbers of occurances.

For input-loaded table (varb/l) with OCCURS DEPENDING ON
counter.Loading with perform vayring.
In this case we have exac numbers of entry and table can
easily access.

Is This Answer Correct ?    4 Yes 0 No

what is the difference between occurs and occurs depending on? i dont think so there is the differ..

Answer / ram g

hands off steve!..the answer is absolutely rite...

Is This Answer Correct ?    3 Yes 0 No

what is the difference between occurs and occurs depending on? i dont think so there is the differ..

Answer / ram g

no i cant agree with ur ans..
for eg: ws-var occurs 1 to 5 times depending on ws-cnt
it means that u can store max of 5 entries..
if i wanna store 50 entries instead of 5 at run time...what
could be the code change u can do on this?
ur ans indirectly saying that occurs depending on is
dynamic array isn't ? never is the my ans...
if u hv any idea please explain with simple eg

Is This Answer Correct ?    3 Yes 1 No

what is the difference between occurs and occurs depending on? i dont think so there is the differ..

Answer / sivakumar sekharannair

As ram said the number of occurances stored can be only 5
in either case. it cannot exceed more than that. what i
feel is when the first occurs clause is used regardless of
the number of occurances are loaded in the table the memory
allocation would be 5 bytes but if occurs 1 to 5 times
depending on ws-var, memory allocation will be made based
on the number of occurances loaded.

Is This Answer Correct ?    4 Yes 3 No

what is the difference between occurs and occurs depending on? i dont think so there is the differ..

Answer / piyush mani

hi all...
if ssrange is not spacified in compiler option then the storage will change as per the user dynamically....


giv ur feedback...

Is This Answer Correct ?    0 Yes 0 No

what is the difference between occurs and occurs depending on? i dont think so there is the differ..

Answer / tripti

IF AN INTERNAL TABLE OCCURS 100 TIMES.

I USE OCCURS DEPENDING ON <NUMBER OF RECS IN INPUT FILE>
CLAUSE WHILE DECLARING THE TABLE

MY INPUT FILE HAS 125 ITEMS.

CAN I ACCESS 125TH ITEM IN THE FILE USING THE INTERNAL
TABLE?

MY ANSWER ID YES. IN DEPENDING ON <XX> CLAUSE XX OVERWRITES
THE OCCURS CLAUSE

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More COBOL Interview Questions

1)what is use of linkage section? 2)what is difference between comp and comp-3

1 Answers   Cap Gemini,


How do you fetch current date in normal cobol pgm and in cobol-db2 pgm?

3 Answers   Cap Gemini, CTS,


PERFORM ACCUMULATE-TOTALS VARYING A FROM 1 BY 2 UNTIL A >2 AFTER B FROM1 BY 1 UNTIL B>2 AFTER C FROM 2 BY -1 UNTIL C<2 How many times the paragraph ACCUMULATE-TOTALS would be exicuted?

5 Answers   TCS,


what is S04E error in jcl?

11 Answers   IBM, L&T,


when COMP-3 is preferrable?

3 Answers   Patni,


HOw can I get the negative sign while deduct high value from low value

0 Answers  


How to code fscode 10 in cobol program? Where yoy code in your pgm?give ans for the question.

2 Answers   IBM,


What do you understand by passing by reference and passing by content?

1 Answers  


if someone is using my file,how can i find which user id is using?

4 Answers  


01 b pic +9(4) How many bytes it will take for storage???

2 Answers  


When search all is used in cobol program without sorted input data?

6 Answers   CGI, Principal Finance,


What do you understand by psb and acb?

0 Answers  


Categories