IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Mamixum number of occurrence of an array


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ppandey07

New User


Joined: 27 Nov 2008
Posts: 51
Location: Delhi, India

PostPosted: Tue Nov 17, 2009 12:24 pm
Reply with quote

May I know, what is the maximum number of occurrence of an array that we can define in a COBOL program?
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Tue Nov 17, 2009 12:26 pm
Reply with quote

It depends on the length of each occurrence. The answer is in the Language Reference manual. See Appendix B - Compiler limits.
Back to top
View user's profile Send private message
ppandey07

New User


Joined: 27 Nov 2008
Posts: 51
Location: Delhi, India

PostPosted: Tue Nov 17, 2009 12:48 pm
Reply with quote

Terry Heinze wrote:
It depends on the length of each occurrence. The answer is in the Language Reference manual. See Appendix B - Compiler limits.



Thanks Terry for the prompt reply.
Each occurrence is of 62 bytes and the file that I have to load into this array has around more then half million records. So I am getting compilation error for that. Would ODO work over here?
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Tue Nov 17, 2009 1:18 pm
Reply with quote

Hi Pandey,

Assuming your table size as half million records, I guess your table size is exceeding the max limit.

Am referring this link for calculation...
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Nov 17, 2009 8:38 pm
Reply with quote

Hello,

Quote:
Would ODO work over here?
ODO is to "limit" the processing in an array not make it larger. When an ODO is specified, the full amount of memory has to be allocated regardless.

Again, complete info is in the Labguage Reference manual (previously linked by Binop B or available via the "IBM Manuals" link at the top of the page).
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


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

PostPosted: Tue Nov 17, 2009 8:51 pm
Reply with quote

A "True" ODO is when the array is defined to LINKAGE and dynamic-storage is allocated, based upon the number of records in the file.

For COBOLer's, LE Callable Service routine "CEEGTST" can be used to acquire dynamic-storage.

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

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Tue Nov 17, 2009 8:51 pm
Reply with quote

Binop's link is for older releases of COBOL. Enterprise COBOL has a much higher limit, so check which compiler you're using.
Back to top
View user's profile Send private message
jctgf
Currently Banned

Active User


Joined: 04 Nov 2006
Posts: 109

PostPosted: Wed Nov 18, 2009 4:48 am
Reply with quote

By talking in ODO, I have a question, please.

What would be the advantage in using it considering that the amount of memory allocated is the same that in a non-ODO array?

Is there any performance gain?

Thanks.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Wed Nov 18, 2009 5:07 am
Reply with quote

OCCURS DEPENDING ON tells a serial SEARCH when to stop searching and a binary SEARCH ALL where to start searching. Please read about ODO in the Language Reference manual.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Nov 18, 2009 5:07 am
Reply with quote

search the forum for ODO.
It has been discussed many times and the reasons have been rather expansive.

if you are too lazy to search the forum, look at the application programmers guide for cobol - button at top - manuals.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


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

PostPosted: Wed Nov 18, 2009 5:43 am
Reply with quote

Here's a recent posting regarding Dynamic arrays and their benefits -

www.ibmmainframes.com/viewtopic.php?p=209663&highlight=#209663

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

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Nov 18, 2009 6:31 pm
Reply with quote

There's good reasons to use ODO, such as tables where you don't know how big they are until run time, and variable length files but saving memory is not one of the reasons.

Reasons, apart from what others has pointed to, would include using SSRANGE to prevent going past the defined boundary, copying a variable file to working storage (if the file has occurs depending on, it's easiest to just code the structures the same), and replicate a structure being passed from another language (C for example) which does allow variable length data.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Increase the number of columns in the... IBM Tools 3
No new posts Cobol program with sequence number ra... COBOL Programming 5
Search our Forums:

Back to Top