A Few Of My Favourite Things

(Originally posted 2017-03-26.)

We recently went to z/OS 2.1 on our Production system in Greenford. And just last week I threw into Production some JCL that used two of the new z/OS 2.1 JCL changes, plus an oldie that might have escaped your attention.

Now we are firmly on 2.1 we can exploit them, with the certainty of not having to revert them. I expect many of you are in a similar position.

So here they are, with the context in which I’m using them.

The Problem I Was Solving

On z/OS we have a REXX-based tool which – unless we seriously fork it[1] – creates transient[2] data sets of the form:

<userid>.Bnnnnnnn.£TMPnnnn

These typically can be a few tens of cylinders in size so leaving them lying around is not good. Also we don’t know their name.

The question becomes how to delete them in the same step or a follow on step in the same job.

And I want to do this as SYSIN in a PROC, just to make it worse.

Deleting With A Mask

What I hadn’t realised is that z/OS Release 11 APAR OA31526 introduced TSO support for the IDCAMS DELETE MASK capability. This is ideally suited for our case.

I can achieve what I want with

DELETE &MYHLQ..B*.£TMP* MASK

if I can get &MYHLQ to resolve to the userid the job ran under. This is the userid under which all those transient data sets are created.

Of course you want to be careful with the mask.

What I can’t do – which would’ve been perfectly valid is to code

DELETE *.B*.#TMP* MASK

because that requires me to supply the catalog name[3]. I really don’t want to code that in the DELETE command.

SYSIN In A JCL Procedure

This just works. Try it some time.

As you’d expect, you code something like

//SYSTSIN DD *
  EXECUTIL SEARCHDD(YES
  ALLOC FI(BLAH) ...
  %MYREXX ...
  FREE FI(BLAH)
/*

This, obviously, is much better than copying SYSIN to a temporary data set before the PROC gets invoked. Plus it allows for customisation, which brings me to the next capability.

Symbol Substitution In A SYSIN Data Set

Remember I somehow wanted to set variable MYHLQ and have it resolved in SYSIN.

This requires only a small change:

Instead of

//SYSTSIN DD *

I coded

//SYSTSIN DD *,SYMBOLS=EXECSYS

and it works fine.[4]

The one remaining piece of the puzzle is to set MYHLQ. This is standard:

//       EXPORT SYMLIST=(MYHLQ)
//       SET MYHLQ=&SYSUID     

using the built in symbol SYSUID.

I’ll confess I don’t know what happens if I try using SYSUID without setting another variable with its value. Perhaps you’d like to try it.

Conclusion

I’ve long known that it’s difficult to fully appreciate a technology advance until you try using it. And so it was with these.

They solved a real problem. More to the point, I now know how to use them, so I’ll be using them a lot.

And I guess you[5] might use them, too.

By the way, I don’t claim to be a particularly accomplished JCL writer, so some of what I’ve written above you can probably do better another way.

One final point: The fact that TSO DELETE MASK dates back to the R.11 era was a complete surprise to me; Who knows what nuggets lie in z/OS that you hadn’t realised existed?


  1. We don’t even own the copyright, by the way. So forking pro bono publico would be extremely dodgy.  ↩

  2. These are not temporary data sets or there’d be no problem to solve.  ↩

  3. You use the CATALOG(<catalogname>) parameter.  ↩

  4. Read the manual carefully for other semantics than EXECSYS.  ↩

  5. “You” here leans heavily on the (reasonable) assumption you’re a JCL writer or maintainer. Otherwise you wouldn’t’ve read this far. 🙂  ↩

Published by Martin Packer

I'm a mainframe performance guy and have been for the past 35 years. But I play with lots of other technologies as well.

One thought on “A Few Of My Favourite Things

Leave a comment