VSAM Macros

The history of these macros is that my TAPEMAN3 utility tools use a keyed VSAM database, and I was effectively copying the VSAM file access code from utility to utility without any real changes being made to it, which was a wasted overhead.

Add to that the two issues of (1) the code was not working 100% correctly anyway and and me not really wanting to try to fix multiple programs, plus (2) I have started working on another application that needs a keyed VSAM database that would result in the same code being effectively copied again.

Obviously it was time to replace all that common code in each of the many programs with a simple one-line macro invocation that would generate all the code and data areas required for keyed VSAM I-O operations on a single VSAM file. As a bonus I have fixed the code so it is now functioning 100% as expected.

Much of the program code used in this macro has been copied from from Jay Moseleys cobol/vsam interface code (v1) but I retained only the code needed for keyed access, and got it working correctly for my needs thanks to the VS1 VSAM programmers manual available on bitsavers.
In making sure the link was still valid so I could correctly attribute the code I see that Jay has now updated his code to allow multiple VSAM files to be used from a cobol program so if you have a requirement for more that one VSAM file to be opened by your program you may want to look at that. The origional (and now updated to v2) code link is http://www.jaymoseley.com/hercules/vsam_io/vscobol.htm
But I only currently only need one VSAM file per program so that is all the macro here supports at present.

My VSAMCODE macro

My implementation of a macro to generate all code needed by an assembler program to perform keyed I-O is currently provided as a JCL deck here which will

The test program and example test job provide enough functionality to be able to perform batch database maintenance on any keyed VSAM file, just by changing the record definition at the start of the test program (as long as the keyoffset is at 0), so may be a useful download for you even if you do not need the macro for programming use.

Enhancements planned, and not planned