Did you ever feel irritated by the fact that you have to make two or more adjustments in your JCL when you want to change the dataset name of a dataset that you delete and then create again. If the answer is no you do not need to read any further.
I have written tips about techniques to delete datasets. I wrote about the old fashioned IEFBR14 technique and later about the IDCAMS technique (recommended). There is a third even more fancy technique, but it can only be used in jobs where the same job deletes a dataset and then creates it again. Furthermore you must have OPC installed.
Let me show you how an ordinary job deletes and recreates a dataset:
There are many jobs with two steps similar to the above. Many of these jobs use IEFBR14 instead of IDCAMS to do the delete. You may rewrite the job to the following piece of JCL which produces exactly the same result:
The EQQDELDS program deletes the MY.BACKUP.DATASET if it is present and does nothing if not. If the dataset is migrated it is deleted using a HDELETE just like IDCAMS does. All situations results in a cond code of zero. The //SYSPRINT DD DUMMY card suppresses the output from EQQDELDS. EQQDELDS works fine without the SYSPRINT DD card, but the output is written to the SYSLOG instead.
If there are other DISP=(NEW,CATLG) allocations in any steps following the EQQDELDS step the accompanying datasets will be deleted if present. I am not sure if datasets with DISP=(NEW,CATLG) before the EQQDELDS will be left untouched, so you better check if you want to use EQQDELDS after the first step.
EQQDELDS is a utility program in the OPC software package. The above steps will only work if OPC is installed and the load library containing EQQDELDS has been placed in the link list. If your insallation does not use OPC then you may build your own program with the same functionality. If OPC is installed and EQQDELDS does not work then you have to contact the OPC systems programmer so he or she can tell you which load library to use in a STEPLIB DD card.
EQQDELDS is not a new invention. The oldest hit on the internet is dated 1998 and bescribed some problems that IBM had to fix. Maybe EQQDELDS is not commonly known because of a bad reputation. Therefore I recommend you to use it only as described in this tip.