MainframeSupports
tip week 24/2009:

Most of us know what the file structure in windows looks like. But do you know what the file structure on the mainframe looks like. I think we do not worry about it in our daily work and that it how it is supposed to be. But sometimes strange thing happens with our datasets and that is why I will tell you about the mainframe file structure.

A dataset is logically located on a volume. On each volume there is a catalog describing the datasets on that volume. If you do not know which volume a dataset is located on you have to try and find it. Fortunately IBM soon discovered that scanning all volumes were a tedious task and they invented the MVS catalog. The MVS catalog is a list of all datasets across all volumes with a reference to the volume where the dataset is located. The location of the dataset on the volume is recorded in the volume catalog.

The MVS catalog consists of a socalled master catalog and zero to many user catalogs. You may run a MVS system with just the master catalog, but it has several disadvantages. First of all it becomes quite large as all dataset names must be recorded in it. Secondly everybody must have update access to the master catalog if everybody must have access to create datasets. And the third thing is that no simultaneous update of the master catalog is allowed. These three things led to the invention of socalled user catalogs. The idea behind a master catalog and a number of user catalogs is to have as few updates to the master catalog as possible and a reduced size of each user catalog compared to one stand-alone master catalog.

A user catalog is a catalog of a subset of all dataset names and their volumes. The subset is controlled by socalled alias entries in the master catalog. An alias is typically equal to the first qualifier (hlq) in the dataset name (hlq is equal to high level qualifier and is the part of the dataset name located before the first dot). When you define an alias in the master catalog you specify the user catalog that the alias points to.

Now we are ready to use the catalog. Imagine that MVS must locate a dataset called MY.BEAUTI.FUL.DATASET. The first action is to scan the master catalog for an alias named MY. If such an alias is not present MVS assumes that the dataset is defined in the master catalog. If the alias is present, MVS assumes that the dataset is defined in the user catalog pointed to by the alias. If a new dataset is to be created in the MVS catalog the process is the same when locating the dataset name and determining whether the dataset name must be created in the master catalog or in a user catalog. If you try to create a dataset with a hlq which is not defined in the master catalog you may receive a RACF error telling you that you do not have update access to the master catalog. More likely you will receive another RACF error telling you that you cannot DEFINE the dataset.

In some respect you are now entitled to say: "This is none of my business". Only if you are curious and wants to know what is going on all the above is good to know. You can collect more knowledge about the MVS catalog by using the command TSO LISTCAT. The starting point is the master catalog which you have to have READ access to. Otherwise you would not be able to access any datasets including your own. And you also have UPDATE access to the user catalog where your own datasets are defined. Otherwise you were not able to create them. If you are able to create datasets with another hlq than your userid you must have update access to the user catalogs where these datasets are defined. It occationally happens that users receive an update RACF error on a user catalog when defining datasets they have been granted alter access to. You have also almost certainly read access to all user catalogs.

In other words you are able to access all MVS catalog information. But it does not help you if you do not know the name of the master catalog or the user catalogs. But TSO LISTCAT may help you out. Before using TSO LISTCAT for the exploration of the MVS catalog you need to execute a TSO PROFILE NOPREFIX. When you have satified your curiosity you execute a TSO PROFILE PREFIX(<your userid>). If you forget the latter you may experience some funny stuff while working with datasets in TSO.

The name of the master catalog is most easily determined by using the command:

TSO LISTCAT ENT(SYS1.LINKLIB)

This dataset must be defined in the master catalog otherwise MVS is not able to start. Any LISTCAT ENT(dataset-name) command prints out the name of the catalog where dataset-name is located. Now imagine that the master catalog is called SYSCAT.MASTER. The command TSO LISTCAT CAT(SYSCAT.MASTER) UCAT will list the names of all user catalogs.

If you work on an installation with more MVS systems grouped into a SYSPLEX (most of us do) then try and issue a TSO LISTCAT ENT(SYS1.LINKLIB) on different MVS systems belonging to the same sysplex. Most likely you will discover that the name of the master catalog is not the same on all these MVS systems. The systems programmers creates a master catalog for each individual MVS system with the same contents in order to speed up access to the master catalog on each MVS system, but also in order to have a running backup if one of the master catalogs is damaged. The problem is that sometimes the catalogs gets out of sync and does not contain the same information. The effect is typically that some datasets are available from one MVS system in the sysplex but not from another. Most likely this happens to datasets defined directly in the master catalog as the user catalogs almost certainly are shared by all MVS systems in the sysplex.

If you want to know all about the possibilities using LISTCAT then try a TSO HELP LISTCAT (or even better a TSO TRAP HELP LISTCAT. Last but not least some examples:

TSO LISTCAT CAT(USERCAT.CAT001)
/* lists all entries in user catalog USERCAT.CAT001
TSO LISTCAT CAT(SYSCAT.MASTER) ALIAS
/* lists all ALIAS'es in the master catalog */
TSO LISTCAT CAT(SYSCAT.MASTER) ENT(MYUSER) ALIAS ALL
/* prints the name of the user catalog which hlq MYUSER is pointing to */

And a final word of warning: If a catalog is huge (many dataset names or alias'es) it will take considerable time to produce a full list. Then it is nice to know that ATTN aborts a TSO LISTCAT, but ATTN will not work if you use TSO TRAP LISTCAT. You may also execute LISTCAT in TSO BATCH. This approach will lead to less problems and you can use the search capabilities in SDSF or SYSVIEW when browsing through the output.

Previous tip in english        Sidste danske tip        Tip list