1 - Control the status of your Elibs:
Every week you should run the BC1PNLIB utility using the INQUIRE function with the ANALYZE option. The following key fields in this report should be reviewed and compared:
AVG ALLOC/MEMBER - Average number of pages taken up by one member
# DIRECTORY PAGES - Number of directory pages currently in the data set
# DIR OVERFLOWS - Number of times the directory has expanded
# LIBRARY EXTENDS - Number of times the data set has expanded
TOTAL MEMBERS FOUND - Total members found on all directory pages
FRAGMENTED - Number of fragmented members
If the AVG ALLOC/MEMBER is much greater than 1 consider reallocating the file with a larger PAGE SIZE to accommodate your larger members.
You should also review the # DIRECTORY PAGES, # DIR OVERFLOWS and TOTAL MEMBERS FOUND.
If the # DIRECTORY PAGES is greater than the number in the DIRECTORY TARGET PAGES field, consider increasing the number of target directory pages.
If the # DIR OVERFLOWS is greater than 0, consider using the "DIRECTORY REORG" function of the BC1PNLIB utility to specify again the number of pages allocated to the directory. The standard rule of thumb is TOTAL MEMBERS/24 = Directory pages.
To keep the file at its peak efficiency, the # LIBRARY EXTENDS, or the number of times your file has expanded, should be kept to a minimum.
Assuming there are no problems with directory overflows or library extends, how often should you reorganize the file to clean up fragmented members?
When the ratio of fragmented members to total members is greater than your site's desired percentage (for example, 30 to 50%) you should run the BC1PNCPY utility to reorganize the file.
An IDCAMS REPRO cannot be used to reorganize Elib files, because it simply returns the data back to its original fragmented state.
The BC1PNCPY utility is the only way to make fragmented members whole again.
In either situation, allocate a new Elib file with a primary space allocation large enough to hold the current file plus 25 to 50% for growth.
Use the BC1PNLIB utility's INIT function to initialize the new file, calculating the number of pages using the documented formulas (both the primary and the secondary entries can be up to six numeric characters) .
Then use BC1PNCPY to copy from the old file to the new file, and the IDCAMS ALTER command to rename the files accordingly.
Note: When dealing with large VSAM Elibs that are in multiple physical extents, BC1PNCPY can take a long time to run.
Although IDCAMS repro use is discouraged as the permanent resolution to your fragmented file it can be used as an intermediate step to speed up the BC1PNCPY process, by reducing the number of physical extents.
2 - Reorganize your Elibs when necessary:
So following the advice given in point 1, look at the situation that matches your case and follows one of the 2 process below:
2.1 - If the ELIB spans on several volumes(which can't be reduced to a single volume):
a - Allocate 2 new Elibs VSAM, ensuring both are large enough to fit the existing file into a single extent.
b - Do BC1PNLIB to INIT one of the VSAM file.
c - Do IDCAMS to REPRO the fragmented Elib to the second un-initialized VSAM file,
d - Then do BC1PNCPY to copy the second VSAM Elib file to the VSAM Elib initialized in step b.
Note: Even this solution works also for Elibs that spans on a single volume, we recommend to use the solution 2.2 for any ELib containing a large number of members.
2.2 - If the ELIB spans on a single volume only you can use this process that use both VSAM and BDAM format:
a - Rename the VSAM Elib to .OLD, in order to isolate it from unwanted updates.
b - Create two BDAM datasets, BDAM1 and BDAM2. Both require to have the same space than the VSAM Elib.
c - Do IDAMS repro from the VSAM Elib to BDAM1.
d - Do an Elib initialise for BDAM2
e - Run BC1PNCPY from BDAM1 to BDAM2
f - Run IDCAMS DEFINE for new VSAM Elib
g - Run IDCAMS REPRO from BDAM2 to new VSAM
Sample JCL for BDAM file creation:
//DD1 DD DISP=(NEW,CATLG),
Note: BDAM ELIB must be allocated on a single volume.
3 - Define which format of Elib is best for you?
Studies have shown BDAM Elibs to be more efficient and provide better performance than VSAM Elibs.
However, IBM does not allow BDAM files to span volumes.
Therefore, if you can keep your file(s) to a single volume, use BDAM, otherwise use VSAM for multi-volume files.