HOW ACM DATA IS ORGANIZED:
- ACM feature uses two files - ROOT and XREF.
- ROOT holds element entries. The root entry includes element location, so if there are two elements with the same name but in different locations, there will be two ROOT entries.
- XREF holds element relations, or more precisely, relations between root entries. When a ROOT entry-1 (let's say a program) references a ROOT entry-2 (a copybook), an XREF entry gets created. Location of the elements again matters.
- ROOT entry is created only when there is some XREF entry to be created as well, i.e. when the corresponding element has references or is referenced. Creating an element without components does not create a ROOT entry (nor XREF entry of course).
Example: If you add A copybooks and B programs, each of the programs using all of the copybooks, you will get:
- A+B root records
- A*B xref records
HOW REORG WORKS:
- ACM files have a sorted area for fast searching. However, new entries are inserted to the end of the file (true for both ROOT and XREF) which is unsorted.
- When the unsorted area in either ROOT or XREF file reaches or exceeds certain number of entries (threshold settable thru AUTO_ACMQ_FILE_REORG in the ENCOPTBL), the REORG is triggered.
- When the reorg is triggered, both ROOT and XREF files are reorganized, no matter which of those two files hit the trigger. Also, the following WTO messages appear in the job log:
ACMQ500I AUTO ACMQ FILE REORG STARTED.
ACMQ500I AUTO ACMQ FILE REORG ENDED.
- Reorg will sort all unsorted records and merge them into the sorted area. After the reorg, the number of unsorted records will be zero.
- Auto reorg only occurs when using Batch Processing.
- Auto reorg only occurs upon the batch job termination. Let's say the threshold is set to 10 and you are running multiple actions in a single job that will create 20 new ROOT entries. Then the REORG does not occur in the middle of the job when 10th new root entry was inserted, but only after all actions are finished.
- REORG will also be triggered when threshold is exceeded by every 25% of its value. So for example if the threshold is 1000, and it was exceeded during foreground or QE actions (which never triggers reorg), then the REORG will be triggered later (in batch) once any of values 1250, 1500, 1750, 2000, 2250 etc. is exceeded.
- If ACMQ_REORG_BY_WTO is turned on in ENCOPTBL, the same rules apply, but instead of doing a REORG, a WTO message is issued.