Steve - I am the developer Tom was referring to. If I had known he was going to post here, I would have included more details. He sent you the system info; here is my issue:
I have an Adabas file to hold table values to be used as selection criteria when reading another Adabas file. In my program which uses the table, I wanted to save I/O to the file and only read it once, putting all the records into an internally defined array. But since the number of records on the table could change at any time, I want to make sure that my program won’t abend in trying to load the array.
Someone here gave me some code - I have changed the names to be generic, so I hope I didn’t typo anything:
DEFINE DATA LOCAL
- 01 #MAX-ARRAY (N4) CONST <300>
01 #MAX-ARRAY (N4) INIT <300>
01 #INTERNAL-ARRAY (A9/1:#MAX-ARRAY)
01 REDEFINE #INTERNAL-ARRAY
02 #ARRAY-ITEM (A9/1:#MAX-ARRAY)
1 TABLE-VIEW VIEW OF ADABAS-TABLE-FILE
1 TABLE-HIST VIEW OF ADABAS-TABLE-FILE
01 #I (N4)
01 #KEY-START (A16) INIT<‘MY-TABLE’>
01 #KEY-END (A16) INIT<‘MY-TABLE’>
HISTOGRAM TABLE-HIST FOR TABLE-TYPE STARTING #KEY-START
MOVE *NUMBER TO #MAX-ARRAY
READ TABLE-VIEW BY TABLE-TYPE STARTING FROM #KEY-START
ADD 1 TO #I
#ARRAY-ITEM(#I) := TABLE-ITEM
WRITE ‘TOTAL ARRAY ITEMS LOADED:’ #I
If I leave #MAX-ARRAY defined as a constant, the code works. But I want it to be dynamic, so I added the Histogram to count the records, then stored that in #MAX-ARRAY as a variable. Of course it won’t stow because you can’t use a variable to define an array.
So, my options are these:
- Figure out how to make dynamic arrays work
- Leave it defined as a CONST and have my batch job send me an email when the number of records gets within XX% of the MAX-ARRAY value, so I can schedule a migration to increase it before it blows.
- Don’t load an array - just use the Adabas file itself - don’t worry about the I/O. By the way, It is a daily job reading 30 million records and using this table as criteria to select about 200 of those records. There are about 250 records in the table.
So - thanks for your help. I am interested in figuring this out, but if it’s too much work, then I can use one of the other options.