View previous topic :: View next topic
|
Author |
Message |
ppandey07
New User
Joined: 27 Nov 2008 Posts: 51 Location: Delhi, India
|
|
|
|
May I know, what is the maximum number of occurrence of an array that we can define in a COBOL program? |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
It depends on the length of each occurrence. The answer is in the Language Reference manual. See Appendix B - Compiler limits. |
|
Back to top |
|
|
ppandey07
New User
Joined: 27 Nov 2008 Posts: 51 Location: Delhi, India
|
|
|
|
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 |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
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 |
|
|
jctgf Currently Banned Active User
Joined: 04 Nov 2006 Posts: 109
|
|
|
|
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 |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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 |
|
|
|