Editor's Intro: Steve Myers brings us a very useful TSO function -- the ability to retrieve a dataset name (or names, if a concatenation) allocated to a known DD name from within a TSO session. This could be very useful in situations where you needed to know the full dataset name with an absolute generation number of a GDG entry allocated to your TSO session or in other, similar situations.
Plus, Steve has provided two different versions of the same function. One written as a TSO CLIST. The other providing the same functionality but written as a High-Level Assembler TSO Command.
Steve has packaged the Assembler source code as a formal SMP/E installation job stream. If you are familiar with SMP/E and want to use the entire installation package, go right ahead. If you're not in a position to do this, it is a trivial exercise to copy-and-paste the Assembler source code, upload and then assemble it as a stand-alone program.
Even though bleeding-edge, new stuff is always a kick to learn, going a little retro every so often can be just as fun. Thanks to Steve for this fine and useful contribution to the world of TSO/E software.
By Steve Myers
The QUERYDD command displays information about the data sets allocated to a specified DD name. Two forms of the QUERYDD function are provided. One is implemented as a TSO CLIST. The other is implemented as a TSO command processor written in Assembler. There are some differences. The command processor accepts multiple DD names, where the CLIST accepts only a single DD name.
The output is basically identical. For example:
The two commands have a different response to errors. For example, the command processor version prompts the terminal operator for a valid DD name if the requested DD name is not allocated. The CLIST just prints a message.
The CLIST is an example of using output trapping. The CLIST "traps" the output from a LISTA STATUS command and then analyzes the output. It is a little complex because TSO uses more than one method to display information about a DD name.
The command processor uses what I call the extended RDJFCB macro to obtain all of the JFCBs for a DD statement. A JFCB is an MVS control block that describes an allocation. A "regular" RDJFCB returns information only for the first JFCB of concatenated data sets. The extended RDJFCB returns information for all of the DD statements in a concatenation. However, the output from the extended RDJFCB is much different than for a regular RDJFCB, so it is not used very much. The command processor uses features available in recent High Level Assembler releases to simplify the task of analyzing the output from the extended RDJFCB macro.
The Command Processor is presented as a sequence of SMP jobs in an unloaded partitioned data set. Use the following steps to load the program to your system.
- Download QUERYDD.TXT from the TSO Times web site to your personal computer. It is an ordinary ASCII text file.
- Allocate a userid.QUERYDD.IEBUPDTE data set using the DCB attributes RECFM=FB, LRECL=80, BLKSIZE=a multiple of 80. One track should be enough.
- Transfer the QUERYDD.TXT file from your personal computer to the mainframe system as an ASCII file to the userid.QUERYDD.IEBUPDTE data set.
- Use JCL like the following to create a partitioned data set.
//A EXEC PGM=IEFBR14
//Q DD DISP=(MOD,DELETE),UNIT=SYSALLDA,SPACE=(TRK,0),
//B EXEC PGM=IEBUPDTE,PARM=NEW
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD DISP=(,CATLG),UNIT=SYSDA,SPACE=(TRK,(1,1,5)),
//SYSIN DD DISP=SHR,DSN=&SYSUID..QUERYDD.IEBUPDTE
The PDS data set userid.QUERYDD.CNTL contains a number of members.
- JOB01 - Remove any prior attempt to install QUERYDD.
- JOB02 - Allocate and initialize the SMP CSI data set, and allocate the non-VSAM data sets.
- JOB03 - Initialize the CSI zones for QUERYDD.
- JOB04 - Receive the QUERYDD FMID.
- JOB05 - Perform an APPLY CHECK for the QUERYDD FMID.
- JOB06 - Perform an APPLY for the QUERYDD FMID.
- JOB07 - Perform an ACCEPT CHECK for the QUERYDD FMID.
- JOB08 - Perform an ACCEPT for the QUERYDD FMID.
- QDD0100 - The QUERYDD FMID.
- SMP - The SMP proc used when installing QUERYDD.
The jobs will need some minor changes to tailor them to your environment. These changes should be pretty obvious to an experienced MVS programmer.
By making minor changes you can install QUERYDD in your program products SMP CSI rather than the customer CSI used in this example. In addition to the program, the FMID includes help text in the standard help text format.
The QUERYDD command processor is a regular Assembler application program. It uses no authorized services and is not link-edited as an authorized program. It can't hurt anything. In addition, it does not attempt to open any data sets, so it cannot violate your site's security standards.
The QUERYDD CLIST is fairly compact, and it may be easier to read and understand than an equivalent function written in REXX. Although many people denigrate the TSO CLIST language as old-fashioned, this is simply not true. It is not the CLIST language introduced with TSO in 1971. That was a joke. Now, CLIST has all the bells and whistles of a modern scripting language: subroutines, a GOTO free block structure, and a number of internal functions that provide system information and other capabilities. Some capabilities of the CLIST language, string processing as an example, are less elegant than REXX. Other functions seem to work much better than REXX. For example, I/O to external data sets is much easier to use than the equivalent in REXX. CLIST does not have the multiple platform capabilities of REXX. However, how often is a REXX function moved to a different platform and actually works unchanged, anyway?
Steve Myers has been programming since 1965 and writing TSO Command processors since the very beginning of TSO, circa 1971.