Stop Failing Fetches! Safely Modifying the z/OS Linklist

Steven Perva
Theropod
Published in
5 min readJul 13, 2022
“Data set is in use” z/OS laughs, as it crushes your hopes of a simple task.

🖥🖥🖥

We’ve all been there, we’re slicing and dicing through a product update or install and bam! We hit the proverbial wall: a data set has run out of space. “No big deal, I’ll just allocate a bigger one!” you foolishly think to yourself, as you create a .NEW version with twice the space. You copy the old members over, attempt to rename or delete the old one, and that’s when you realize the system has more sinister things in mind for you.

Not so fast! Time for a quick lesson in the basics…

So you take a quick look to see what task is standing between you and glorious success. Is it your colleague, changing the ISPF stats on all the members to make it look like HCKRMN was the last user to update everything? Not this time! XCFAS and LLA have their gnarly little claws in your data set, and they won’t let go.

You’ve been thwarted again by the lovely little nuances that make z/OS such a resilient operating system! Fear no more, this brief little how-to will get you safely on your way without giving you a bunch of fetch failures costing you an IPL. A healthy warning though: you probably ought not do this in production. If you do, you would be doing so at your own risk!

When XCFAS and LLA have an allocation on a data set, chances are that data set resides in the linklist. Don’t believe me? Rip this command and you’ll see what I mean:

D PROG,LNKLST

Yep, there it is. Okay, so you got a linklisted data set that you want to perform maintenance on. There are a whole lot of ways you can do this, but this is how I do it — and I think it’s pretty safe and sound.

Removing the Data Set from the Linklist

First things first, let’s give our friend LLA the boot. Stopping LLA won’t cause any problems itself, but it will degrade system performance until you restart it.

P LLA

While LLA kicks the bucket, let’s go ahead and get a new linklist created to take care of that XCFAS allocation. The trick here is to define a linklist and copy the contents from the current one:

SETPROG LNKLST,DEFINE,NAME=LNKLST0,COPYFROM=CURRENT

This command defines a new linklist named LNKLST0 and copys the contents from the current linklist. Be aware, this doesn’t activate the new linklist quite yet. We still have some surgery to perform on this newly minted fella.

Having trouble defining a linklist? Take a look at what names are already out there with this handy little command:

D PROG,LNKLST,NAMES

Now that we have a new linklist, let’s yank that data set out of there:

SETPROG LNKLST,DELETE,NAME=LNKLST0,DSNAME=MY.LNKLST.DSN

Make certain you swap “MY.LNKLST.DSN” from this command with the data set you’re trying to fiddle with. Otherwise, this whole article won’t help you much.

Okay, we’ve done it. Your new linklist doesn’t have the offending data set. All’s well that ends well, right? Not so fast! We are still using the old linklist! Let’s flip the switch on this new linklist:

SETPROG LNKLST,ACTIVATE,NAME=LNKLST0

The more naïve among us will simply try changing the data set now, but not you! You know that activating a new linklist doesn’t just make the old one go away. We now need to update the old jobs that were running with the old linklist. This is where things feel scary. As long as none of the jobs running need the library you just took out of linklist, go ahead and flip everything over to the new one:

SETPROG LNKLST,UPDATE,JOB=*

You probably noticed the suspenseful little pause your system just took. That’s it’s way of making sure you’re paying attention. You should now be able to manipulate that data set that gave you enough headache to come read this article. If you’re planning to compress it, reallocate it, or do anything that makes you want to put it back, this next bits for you.

Adding the Data Set Back to the Linklist

Get comfortable, because this can take a while if, like me, you only do this once every 6 months.

Let’s define yet another linklist. This one will be the one with the newly maintained data set:

SETPROG LNKLST,DEFINE,NAME=LNKLST1,COPYFROM=CURRENT

You’ll recall this data set doesn’t have the data set you just maintained in it. Let’s add it back:

SETPROG LNKLST,ADD,NAME=LNKLST1,DSNAME=MY.LNKLST.DSN

NOTE: The folks at head office want me to encourage you to check out the documentation for the LNKLST ADD command and remind you that a search of the linklist for a requested module stops at the first match. The aforementioned add defaults to the bottom of the linklist, you may require a more surgical approach, if so check out the official documentation here. Spoiler alert, there’s an AFTER keyword and ATTOP.

So now this linklist has everything we’ve ever wanted, and more. We can activate this new linklist now:

SETPROG LNKLST,ACTIVATE,NAME=LNKLST1

All new jobs entering the system after this is done will be using this new linklist. You can, but don’t have to, switch everyone over to the new linklist now:

SETPROG LNKLST,UPDATE,JOB=*

Finally, don’t forget to restart LLA. You definitely don’t want to find out three days from now when you’re trying to write a Medium article about how to maintain the linklist that you forgot to start it back up the last time you did this…

S LLA,SUB=MSTR

Looking to dig deeper into some of the concepts of this article? Check out the links below to learn even more!

https://www.ibm.com/docs/en/zos/2.5.0?topic=overview-improving-module-fetch-performance-lla — Improving Module Fetch Performance with LLA

https://www.ibm.com/docs/en/zos/2.5.0?topic=command-updating-lnklst-concatenations — Updating LNKLST Concatenations

https://www.ibm.com/docs/en/zos/2.5.0?topic=command-displaying-lnklst-information-proglnklst — Displaying LNKLST Information

Steven Perva is a Senior Mainframe Innovation Engineer at Ensono, a 2022 IBM Champion for IBM Z, and mainframe enthusiast. He spends a disproportionate amount of time learning, teaching, and tinkering with mainframes. He also is the founder of the System Z Enthusiast Discord, a place where mainframe enthusiasts, professionals, and students alike can collaborate, ask questions, and share information about mainframes.

This article serves development purposes only. Practical deployments of this technology should be challenged to adopt best security and integrity practices. Use of this code and the commands outlined in this article should be done at the reader’s discretion.

If you enjoyed this article, please follow me for more mainframe (probably z/OS) content here and other cool places:

https://discord.gg/rFXEVKK7AH — Join the System Z Enthusiasts Discord Here

https://linkedin.com/in/stevenperva — Connect with me on LinkedIn

https://twitter.com/SteveMPerva — Follow me on Twitter

--

--

Steven Perva
Theropod

Mainframe Innovation Specialist. Amadeus of z/OS. Enterprise Troublemaker. IBM Champion for IBM Z 22-23