Dynamic Array using ODO.

This is a Mainframe COBOL forum - you can post your queries on Mainframe COBOL, VS COBOL II, COBOL/370 , Enterprise COBOL

Moderators: dbzTHEdinosauer, Moderator Group

Post Reply
mpawan
Member
Posts: 9
Joined: Mon Jan 18, 2010 2:06 pm
Location: Hyderabad

Dynamic Array using ODO.

Post by mpawan » Mon Feb 24, 2014 2:11 pm

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.
Thanks & Regards
M Pawan

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Mon Feb 24, 2014 5:36 pm

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.
Regards
Nic

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Mon Feb 24, 2014 10:41 pm

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.
Have a good one

mpawan
Member
Posts: 9
Joined: Mon Jan 18, 2010 2:06 pm
Location: Hyderabad

Post by mpawan » Wed Feb 26, 2014 7:53 pm

Thank You Guys !!
Thanks & Regards
M Pawan

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others