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

i declare a Table as OCCURS 2000 TIMES.If the input file has more than 2000 records will the COBOL program fail?

12 Answers  


in the TIME parameter we r giving hours r minutes

4 Answers   IBM,


How do you code Cobol to access a parameter that has been defined in JCL?

3 Answers  


Explain sorting techniques in cobol program? Provide the sort file definition, the sort statement, its syntax and meaning

0 Answers  


where do we use dyanamic call ? and where do we use static call pls give any example pls ?

3 Answers   Patni,


Consider the below example call a-test1. -- -- -- a-test1. if a=b perform a-test through a-exit next sentence else if b=c perform c-test through c-exit. if a=d perform d-test through d-exit. a-test. -- -- a-exit. exit. can u tell me what will happen if a=b after looping into a-exit will the control go back to a- test1. will the condition a=d be checked???

5 Answers   IBM,


What is diff between vsam and db2?what is advantage of db2 over vsam?which is best suited one?

1 Answers   Fidelity,


Will the variable POS in the following code have a value of 2 or not? 01 POS PIC S9(4) COMP VALUE 2. 01 FIRST-NAME PIC X(10) VALUE 'ABC'. 01 LAST-NAME PIC X(10) VALUE 'XYZ'. 01 NAME PIC X(20) VALUE SPACES. STRING FIRST-NAME DELIMITED BY SPACES ' ' DELIMITED BY SIZE LAST-NAME DELIMITED BY SPACES INTO NAME WITH POINTER POS

2 Answers  


What are the differences bitween cobol and cobol-2?

1 Answers   Wipro,


can u plz expain me how to declare dynamic array? what is the meaning of depending on clause in dynamic array?

3 Answers   IBM, Satyam,


what are the diferences b/w sub-script and index?

4 Answers  


what is meant by binary search?

4 Answers  


Categories