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

What are various search techniques in cobol? Explain.

0 Answers  


How do u initialize an array?

2 Answers   CTS,


What does the initialize statement do ?

2 Answers  


What happens in the background of spool when we submit a job for compilation and execution... This is a recent question in ibm...Kindly help me.....

3 Answers   IBM,


01 xxx pic 9(4). 01 yyy pic 9(6). move 123456 into yyy. move yyy to xxx. display yyy. what would be the value of yyy

13 Answers   HSBC,






how many subpgms we can use in a main pgm ? how do u link sub pgm to main pgm ? how can i use the parameters declared in main pgm to sub pgm ?

2 Answers   TCS,


How to increase the logical record length of existing PS file?

7 Answers  


How to remove the spaces at end of each record in the output file Via COBOL program? note: The file has a VB length

2 Answers   IBM, Wipro,


in real time what is the suitable exp where in-stream procedure is better then catalog procedure.

1 Answers  


How did the release of cobol/370 version 1.3 improve the performance of release 1.1?

0 Answers  


what is the difference between Plan & package

3 Answers   IBM,


consider the following FD FILE-1 01 REC-1 PIC X(80) ...... WORKING-STORAGE SECTION 01 W-REC PIC X(90) ........ PROCEDURE DIVISION FIRST-PARA ....... READ FILE-1 INTO W-REC AT END MOVE 1 TO EOF-FLAG which of the following is true with respect to the above? a.REC-1 will contain nothing and W-REC will contain the contains of the record read b.REC-1 and W-REC contain the same data c.syntex is invalid and error will occur d.REC-1 and W-REC must be of same size

1 Answers   TCS,


Categories