Joined: 14 Jan 2008 Posts: 2504 Location: Atlanta, Georgia, USA
You could either write a callable REXX routine, which issues a LISTDSI command or write a small callable Assembler sub-program, which issues a SHOWCB Macro.
In either case, the number of records on the file is returned to you.
Then, in your COBOL program, calculate the amount of storage you'll need by multiplying the NUMBER OF RECORDS by the file's LRECL. Use this calculated storage amount as a parameter to call LE Callable Storage routine CEEGTST and dynamically obtain the required storage.
Note that the table would have to be moved to LINKAGE, but, dynamically allocating the storage will potentially remove the possibility of the internal table from ever being too small.