COBOL 42 DBINFO Revisited (August 1997)

This time around I am going to delve back into the DBINFO intrinsic a little bit. First I want to mention an awesome little tool in the Interex CSL called DBSAME. This little tidbit was written by Chuck Glenn back in 1990, and what it does is make extensive use of the DBINFO intrinsic to compare two databases. It will report on virtually every difference it finds, including item number and item names not matching between the two database. I have personally found this to be invaluable as a tool for rolling in database structural changes.

Chucks program is rather large, so I thought I would use a new one of mine which I call DBTPATHS. Let me give you the scenario that gave me the idea. How often have you tried to delete a Master record in an Image database, either through QUERY or your own program, only to be stymied by non-empty detail chains? Well this happened once too often for me, so I wrote this program to take a key item, and a value, and search all path’s for existing entries.

This program is based on another DBINFO program that I used in this column a couple of years ago. The original program was meant to give structural information about a database. All those original features were left, but this new feature was added.

So let’s take a look at figure 1, keep in mind that we have already gotten the base and data set and data item names from the user at this point. We first are going to issue a DBINFO mode 301 call to find all the data item paths that are linked to this dataset/item combination. These are returned to a table that we will then loop through after we get a key value from the user.

The call to DBINFO mode 205 returns all the data set information including any DDX information. This is an enhanced version of mode 202 which just returned capacity information basically. The main purpose here is to get the actual data set name for each data item number in the table.

Next we call DBINFO mode 102 to retrieve the data item information, specifically the data item number, for the item number returned in mode 301. This set’s us up perfectly for the final call to DBFIND. By checking the chain length in the status array we are able to find out how many entries exist on each path for the key value specified.

Take a look at figure 2 to see a sample dialog. I find this tool to come in handy more and more often as time goes by, and I hope you enjoy making use of it.

I want to wrap up by telling you how hard this column was to write. I had the entire thing written, and then due to the wonder that is Microsoft Windows, I lost the whole thing because their incredibly stable so called O/S locked up before I had a chance to save it. So with no printouts I had to reproduce it again from scratch, which will probably explain why it’s not that good now. Go Netscape.