The CA Datacom Multi-user (MUF) CBS startup option allows you to code a heuristic DBID. Have you ever wondered what this is or why you should consider using it? What is the benefit of using the heuristic database? If you use CA Ideal or CA MetaCOBOL+ or have user written programs that issue set-at-a-time commands (SELxx), this knowledge document will be of interest to you.
CBS has used Heuristics for a long time, so the use of heuristic data is not new. On each SELFR command, CBS goes through optimization processing. This is a process of key elimination to determine the key that provides the most efficient path to the data.
Sometimes there is no direct path to the data and there are multiple keys that could be used. When this occurs, CBS does population counting. To do population counting, CBS looks at the number of rows in the index for each key and makes a determination on which key is best, based on the actual number of entries in the index. The index contains different levels of information; the most detailed being the DXX level. This level contains pointers to actual data records. If CBS can determine the best key to use by checking only the highest level index blocks, the key is not selected as a heuristic key. However, if CBS goes to the DXX (or data) level, the name of the key selected is saved. If the same key is selected 8 out of 10 times, CBS stops doing population counting and uses the saved heuristics key.
When a separate heuristic DBID is not specified, heuristic data is stored in the CBS Index. This means that each time a MUF with a virtual CBS index gets cycled or a physical CBS index gets cleared, the heuristic data is lost and population counting must again be performed.
Both CA Ideal and CA MetaCOBOL+ format the request qualification area for set-at-a-time requests to allow CA Datacom to save heuristic data. In addition, user written LE-based programs, such as COBOL, that issue set-at-a-time requests may also format the request qualification area to allow heuristics data to be saved. Specifying a heuristic DBID in the Multi-User CBS startup option could result in better performance by allowing the use of a virtual CBS index without loss of heuristic data.
An additional benefit is the ability to access the heuristic data. CBS is normally very efficient in selecting the best key for a set-at-a-time request. Occasionally, due to data dependencies, the user may know a different key is a better choice than the key selected by CBS. Having a separate database in which to store heuristic data provides the user with the ability to query or update heuristic data.
This is a rewrite of TEC419043.