Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Dynamic Array in Cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
sibi Yohannan

New User


Joined: 15 Apr 2009
Posts: 47
Location: Bangalore

PostPosted: Mon Aug 31, 2009 8:40 pm    Post subject: Dynamic Array in Cobol
Reply with quote

I have a need to declare an array of 100, but in the furture there is a chance to increase that as per the need, how flexible I can declare the array in dynamically?

Is it possible to declare an array dynaically so that it can accomodate any number of data.

I am aware of below type of Dynamic array

Code:
01 PAYROLL.
 02 PAYROLL-WEEK PIC 99.
 02 PAYROLL-HOURS PIC 999 OCCURS 1 TO 52
                             DEPENDING ON PAYROLL-WEEK.


Where the maximum size of the array is 52 and the space allocated to this array depends on the PAYROLL-WEEK variable defined. Is the advatage of defining a dynamic array is only with Saving the space allocation or is there any other advantage over that?

Please advice and correct me
Back to top
View user's profile Send private message

Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Mon Aug 31, 2009 8:51 pm    Post subject: Reply to: Dynamic Array in Cobol
Reply with quote

Are you building the array based upon number of records in a file that you read into your program?

Bill
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 686
Location: Earth

PostPosted: Mon Aug 31, 2009 9:29 pm    Post subject:
Reply with quote

Quote:
space allocated to this array depends on the PAYROLL-WEEK variable defined.

Not quite correct. Actually, space will be allocated for all occurences regardless of DEPENDING ON clause.
Check below URL if you need more information-

ODO Old topic

If you are looking for dynamic memory allocation then you should look at LE services CEEGTST and CEEFRST for starters.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Mon Aug 31, 2009 11:47 pm    Post subject: Reply to: Dynamic Array in Cobol
Reply with quote

The following might be the more effective approach -

http://www.ibmmainframes.com/viewtopic.php?p=176368&highlight=#176368

Bill
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm
No new posts Dynamic split of files under groups sril.krishy DFSORT/ICETOOL 4 Mon Apr 17, 2017 1:09 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us