Advice on keys for 3000s, and KSAM files
October 27, 2017
When building a TurboIMAGE database, is it possible to have IMAGE automatically sort a segmented index for the key field?
Gilles Schipper says
No, but you can create TurboIMAGE b-tree index files which allows generic and range searches on items that are indexed - specifically master dataset key items. Only master dataset key items can be associated with b-tree index files.
You can find out more starting at Chapter 11 of the TurboIMAGE manual.
How can I reduce the size of my existing KSAM files? I have removed lots of records from the system and the KSAM files are consuming lots of magnetic real estate, even though there are few records left.
Chuck Trites says
Make a copy of the KSAM file. Then use the verify in KSAMUTIL to get the specs of the file. Purge the KSAMFIL and the KEYFILE if there is one. Build the KSAM file with the specs. FCOPY from the copy to the new KSAM file and you are done. It won't copy the deleted records to the new file.
Francois Desrochers explains
Do a LISTF,5 to get the current key definitions.
Build a temporary output file with all the same attributes:
:BUILD KSNEW;REC=-80,,F,ASCII;KSAMXL;KEY=(B,1,10)
Copy the records from the original file to the temporary file
:FCOPY FROM=KSTEST;TO=KSNEW
Purge the original file and rename the temporary file:
:PURGE KSTEST
:RENAME KSNEW,KSTEST