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: 685
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. Full Time COBOL Software Development ... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:24 am
This topic is locked: you cannot edit posts or make replies. COBOL Software Development Lead at Fi... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:21 am
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm


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