If you have VSAMSTAT installed, you can get basic VSAM space information by entering the line command VSAMSTAT against a VSAM component on a '3.4' ISPF listing. Results will typically look like below. The Total Free Space includes free space within the used portion of the dataset, either freespace coded for CI/CAs, or from deleted records. So Total Free Space is usually more than Allocated Space - Used Space.
SAP.VSAMCICS.INSACW21:
Allocated Space : 30 tracks 2 Cylinders
Used Space : 15 tracks 1 Cylinders
Total Space Free : 29 tracks 1 Cylinders
LISTCAT
Probably the most useful VSAM information command is LISTCAT. The full syntax to list out a dataset is
TSO LISTCAT ENTRY(datasetname) ALL
Most people have installed a clist to shortcut this, but if your site hasn't got one, then
add a member to any clist library in your logon procedure called LC (command 'tso lista' will display your logon libraries), then inside it, put
PROC 1 MEMBER
LISTC ENT(&MEMBER) ALL
EXIT CODE(0)
Now when you want to display the structure of a VSAM file, just use the line command 'LC' from a 3.4 file list. You will see lots of output from the command, some of which will look like
This lot is about the physical chunks in the file. It has a 18k blocksize, which fits three to a track. The CA size is 1 cylinder, so there are 45 CIs in a CA. Both the CIs and the CAs have 5% freespace reserved for growth.
Allocation information. The file is allocated in Cylinders, and has a 5 cylinder primary and a 1 cylinder secondary. It can have up to 119 extents on a single volume, and up to 255 if it can span volumes. The High-Used-Relative Byte Address is only about 800k, while the High-Allocated-Relative Byte Address is about 4m, so the file has lots of free space available for growth
INDEX:
LEVELS-----------------1
Single level index, so no performance issues
How can you tell if a VSAM file is full?
Is the HI-U-RBA is the same as the HI-A-RBA?
No - the file is not full
Yes - the allocated part of the file is full but it may be able to get more extents.
Does the file have between 251 and 255 extents?
Yes - the file is definitely full.
No - Is there room on the volume for the file to get another extent?
Yes - the file has room to expand so it is not full
No - does the file have any unused candidate volumes defined?
Yes - the file can expand onto another volume
No - The file is full.
Your options are to re-organise it to give it a bigger allocation, or to add candidate volumes. A reorg. is disruptive. You can add candidate volumes in flight, but you must close the file before they are picked up.
EXAMINE
Examine is used to check that the index and data components of a KSDS are synchronised.
Typical syntax is
Verify is used to check for, and fix, VSAM files which have not been closed properly after an error. The command basically adds correct End-Of-Data records to the file. Syntax is
VERIFY DS(TPXP.MONVAZP.EMXSRTV)
Initialising VSAM files
VSAM files often need to be initialised with high or low values before data can be added by programs. To initialise a VSAM file copy the JCL below to a PDS job library, then switch into HEX mode by typing 'HEX' on the command line, then after the INDD line type two rows of zeros as shown below. Note that x'40' is a blank space, '00' is hex low values. For high values, type in 'FF'.
Type HEX OFF on the command line and you will see the JCL as below. The x'00' low values looks exactly like the x'40' blank spaces, and so does x'FF', which can be confusing. You need HEX ON to see what is really there.