Page 1 of 1

Dynamic Array using ODO.

Posted: Mon Feb 24, 2014 2:11 pm
by mpawan
Hi,
Can we create a dynamic array and pass the ODO value using copybook?
I want to create a table, but the rows in the table can vary.

01 TEST-VARIABLE OCCURS 1 TO 100 TIMES DEPENDING ON MAX-VALUE.

1) Can I dynamically control the value of MAX-VALUE using copybook?
2) Can I override the MAX-VALUE to 10 and more than 100 for the COBOL table?

Please let me know how can we achieve above condition.

Posted: Mon Feb 24, 2014 5:36 pm
by NicC
What happened when your little test program to test these things was compiled/executed?


What do you mean by "using copybook" (used twice in your post)? A copybook is only a place to store common code. That code can be most valid COBOL - just depends where the pre-compiler finds the copy statement.

Posted: Mon Feb 24, 2014 10:41 pm
by DikDude
Keep in mind that COBOL will allocate the table to the maximum size. The table does NOT change size.

To change the size you would recompile.

Suggest you define the code for the max and set the specific value you want to use ar run-time.

Posted: Wed Feb 26, 2014 7:53 pm
by mpawan
Thank You Guys !!