How to create summaries based on the HLQ of DSNINDEX records in a CA Disk Datacom FDB using SQL?
book
Article ID: 189664
calendar_today
Updated On:
Products
DISK BACKUP AND RESTOREDatacom/ADDatacom/DB
Issue/Introduction
How to create summaries based on the HLQ of DSNINDEX records in a CA Disk Datacom FDB using SQL, that means without Vantage? The SQL command should count all data set index records by HLQ and also summarize the used bytes by HLQ processing all DSNINDEX records in a CA Disk Datacom FDB.
Environment
CA Disk with CA Datacom Files DB (FDB)
Resolution
Use the new SUBSTRING_INDEX function to extract the HLQ from the dsname. SUBSTRING_INDEX allows to search a source-string for a specified delimiter and returns a substring of leading or trailing characters.
Here a sample SQL command where - SUBSTRING_INDEX is used to extract the HLQ of the data set name - SUBSTRING_INDEX used as base for grouping by HLQ - COUNT and SUM are used to count the records and to summarize the bytes per HLQ SELECT SUBSTRING_INDEX(DSNDSNAM,'.',1) as HLQ, COUNT(*) as Number, SUM(dsnbytes) as Bytes FROM CADISK.dsnindex_650 WHERE DSNDSNAM LIKE '%' GROUP BY SUBSTRING_INDEX(DSNDSNAM,'.',1);
Note: The SUBSTRING_INDEX function is new. It has been introduced by CA Datacom SQL 15.1 PTF SO10328. So above SQL command will fail on with Datacom/AD 14.0 and AD 15.0. There is no other function in Datacom/AD 14.0 or AD/15.0 to resolve the request. The SUBSTR function cannot be used as the length of the HLQ can vary.