The catalogue rescue
An operating-system upgrade wiped the mainframe's catalogue of every file on every tape. Reloading the tapes would have destroyed them. One traversal and one generated script put them back.

Photo: Marc_Smith, CC BY 2.0
A mainframe's catalogue is its memory of every file it has ever held, on every disk and every tape, mounted or not. An operating-system upgrade wiped ours. The disks could be reloaded safely. The tapes could not: there were tens of thousands of them, old enough to tear on the streamer, and running them all back through the machine would have cost us a good part of the archive we were trying to save. Nobody quite knew what to do, which in a computer centre is the moment the junior person starts reading manuals.
One traversal, one script
In the system manuals I found a utility that walked the old catalogue structure and raised an event for every stored object, handing back a reference number. A control-language script decoded that number into the file's properties, its name, type and tape volume, and passed them to a small BASIC program that formatted each into a command line and appended it to a growing file. BASIC was chosen for one unglamorous reason: it could keep a single file open across thousands of invocations. At the end of the walk we had one script that, run once, re-introduced every tape file to the new catalogue without a single reel being mounted.
Why it held
It separated decoding from formatting, it coped with the awkward reality of multi-file tapes and libraries spanning reels, it reported progress as it ran, it logged both a summary and a detailed event list, and it could only be run by the system administrator. I did not know the words for any of that at the time. I have called myself an architect ever since, mostly to make up for it.