MVS ALLOCATE DDNAME to apply to multiple jobs

94 Views Asked by At

I have a number of different JCL jobs that all need to refer to a specific DDNAME. Rather than editing every single JCL job to include this DDNAME I would like to set it up so that it is available for all of them.

I know I can use the MVS command ALLOCATE DDNAME(my-ddname) DSN(my-dataset-name) SHR but from where do I issue this command to have it picked up by all my JCL jobs when I submit them?

3

There are 3 best solutions below

0
Steve Ives On

You can't do it. There is no 'global' data set allocation feature available (unless for very specific purposes e.g. programs that can reside in the linklist).

The TSO ALLOCATE command you mention can be executed in TSO or a REXX (or clist) but the dataset will only be available to the address space (job, TSO user etc.) in which the command was issued.

What you could do however is to possibly combine those jobs into fewer jobs or have that DD name and other common JCL statement in a JCL procedure, reducing the number of places in which the DD name is coded.

Adding a specific DD name to multiple jobs is quite trivial with an edit macro run either in batch or in ISPF against those JCL members.

0
KevinF On

The bottom line is that this could be done but would require a rework of your JCL.

If you set up your JCL correctly you could use a // INCLUDE MEMBER= that contains the valid JCL statement for your dataset, but the downside is that the DDNAME would have to be the same in every JOB using it. Please see: https://www.ibm.com/docs/en/zos/2.1.0?topic=description-examples-include-statement

The ALLOCATE command you mentioned is actually a TSO command not an MVS command.

2
Hogstrom On

The challenge you are highlighting is that dataset allocation implies an ENQ on a dataset. TSO is only one runtime in the z/OS domain. There are also CICS, IMS, WebSphere, USS, ... each of those "domains" have their own ways of accessing datasets.

@SteveIves brings out a critical point in that what kind of dataset are you wanting to share? Is it a VSAM file, PDS/E, sequential, loadlibrary, ...

You are referring to a DDNAME but what you're asking for is the ability to dynamically name a DDName AND the dataset related to that DDName as well as the needed DISP for GRS purposes.

If it is possible you could write a program that is generally available to do a dynamic allocation of the dataset when called. This would at least enable any program you have to "dynamically" allocate the resource in question.

Look into DYNALLOC which is commonly referred to as SVC 99 for dynamic allocation.

This allows you to make the resource available dynamically without having to moduly all the JCL, but, it does require the using program to make a call to allocate the needed dataset.

There is no prescribed way in JCL or otherwise to do what you want but the facilities exist for you to implement your solution.