Can we dynamically increase the size of occurs clause? i.e
In case I an not sure of the size of array and want to
increase the size at run time.If yes , how?



Can we dynamically increase the size of occurs clause? i.e In case I an not sure of the size of ar..

Answer / lu

yes, ...you declare an array like this:
77 ws-counter pic 9(04) value zeroes.
01 ws-array.
07 ws-field pic x (01) ouccurs 1 to 1000
depending on ws-counter.

Procedure Division.
Perform Read-file until ws-end-of-file = 'y'.
Read-file.
Read file at end
move 'y' to ws-end-of-file.
if ws-end-of-file not = 'y'
add 1 to ws-counter
move aa of file to ws-field (ws-counter).

the maximun is 1000 occurrences and minimun is 1...

Is This Answer Correct ?    14 Yes 0 No

Post New Answer

More COBOL Interview Questions

Without using move verb how to move one variable to another.

5 Answers  


what is S04E error in jcl?

11 Answers   IBM, L&T,


Write some characteristics of cobol as means of business language.

0 Answers  


How can you declare the file ?

1 Answers   Wipro,


01 ws-p pic 9(2). 01 ws-q pic 9(2) value 01. 01 ws-r pic 9(2) value 99. p.d. compute p = q + r what will be result of p ans(00) but my question is that how i got 10 on the place of 00. (truncation will ocuure on right side not left). please tell me ?

6 Answers   L&T,






is it possible to declare index in cobol program? if it is not why its tell me pls

3 Answers  


Can a Search can be done on a table with or without Index?

0 Answers  


How many variables can be declared in w-s section.?

2 Answers  


in cobol i have one file it contains records like 10,4,23,98,7,90..... total records 100. iwant 10 to 20 in reverse order in cobol environ ment any one please give the answer......

2 Answers   IBM,


What is tne need to use sub programs in Cobol?

3 Answers   HSBC,


) How do u handle errors in BMS macro

0 Answers   IBM,


How can you pass values from COBOL program to non-COBOL programs?

2 Answers  


Categories