Many of my programs are facing overflow issues in table i.e. exceeding the specified array limit. Is there a way to identify the number of trasactions loaded in an array in a particular execution of the program from the log. So that I can monitor the size and increase it, before they actually fail.
I can change my programs to display the index value and monitor the growth but I would want to check if the same can be captured by any other options.
Joined: 14 Jan 2008 Posts: 2504 Location: Atlanta, Georgia, USA
Are you populating the array from a Flat-File or a VSAM-File? I've erroneously suggested in the past that a REXX LISTDSI command would return the number of records on a Flat-File, but that's incorrect.
As far as VSAM, you can obtain the number of records associated with a given file via a SHOWCB Macro in a small Assembler sub-program, called from COBOL.
If you do have a Flat-File, you can REPRO it into a temporary (predefined) EDS file and then use the sub-program which invokes the SHOWCB to obtain the number of records.
Once you know the number of records and LRECL of each, you could acquire the correct amount of dynamic-storage, via the LE Callable Service routine "CEEGTST".
With that, your array definition can be placed in LINKAGE, with a true OCCURS DEPENDING ON maximum.
Using this approach, array-spillover will become almost non-existent.
If you can wait until the program (job/step) has completed, the dynamic-storage will be implicitly freed by the operating system.
Otherwise, you can explicitly free this storage via the LE Callable Service routine "CEEFRST".
This sounds like an array is the wrong data structure to be using. A linked list or tree sounds like a better option because you can grow them dynamically. You could also dynamically reallocate the array (I assume - I don't know COBOL) but that would mean that at some point you have 2 copies of the data in storage. More programming, but the situation sounds like it needs it. What happens next month when this month's numbers prove to be too small?