Data and storage management on z/OS
Previous topic | Next topic | Contents | Glossary | Contact z/OS | PDF


SPZAP (a.k.a. Superzap): Dynamically update programs or data

Data and storage management on z/OS

The SPZAP service aid has several aliases, including AMASPZAP and Superzap, the latter being the most commonly used. SPZAP allows you to patch or fix volume table of contents (VTOCs), executable programs, or almost any other disk record. In practice, it is used most frequently to patch executable programs.

The functions of SPZAP provide many capabilities, including:
  • Using the inspect and modify functions of SPZAP, you can fix programming errors that require only the replacement of instructions in a load module member of a PDS or a program object member of a PDSE without recompiling the program.
  • Using the modify function of SPZAP, you can set traps in a program by inserting incorrect instructions. The incorrect instructions will force abnormal ending; the dump of storage provided as a result of the abnormal ending is a valuable diagnostic tool, because it shows the contents of storage at a predictable point during processing.
  • Using SPZAP to replace data directly on a direct access device, you can reconstruct VTOCs or data records that may have been destroyed as the result of an I/O error or a programming error.

As an example of the first function, modifying a programming error, suppose your company has just purchased a new release of product XXX. The new release may have been sent on tape to hundreds or thousands of customers. After shipping all these tapes the product developers may have discovered a minor bug that could be fixed by changing a few instructions. Instead of creating new distribution tapes and shipping them to all the customers (a massive and expensive undertaking for a major software product), the developers could create an SPZAP solution and mail, fax, or ftp it to their customers.

The SPZAP solution might look something like this:
//AMYS15   JOB  1,AMYS,MSGCLASS=X
//STEP1    EXEC PGM=AMASPZAP
//SYSPRINT DD SYSOUT=*
//SYSLIB   DD DISP=OLD,DSN=LANDER.LIB.LOAD
//SYSIN    DD *
 NAME QSAM1
 VERIFY 004E 4780
 REP 004E 4700
/*
In the example:
  • The EXEC statement identifies SPZAP as the program to run, using Superzap's program name (AMASPZAP).
  • The SYSLIB DD statement points to the data set containing the load module to be modified.
  • The SYSIN DD statement contains the control statements that tell SPZAP what actions to perform:
    • The NAME control statement identifies the executable module (which is the PDS member name) to be altered.
    • The VERIFY statement says to look at offset x'004E' in the module and verify that it contains x'4780'.
    • If the verify is correct then change the module to contain x'4700' at this same offset. This action changes a Branch Equal instruction to a No Operation and changes the logic of the program.
An SPZAP patch like this is easily constructed when you have an assembly listing of the program and can see the exact offset within the module containing the instruction you want to change. Creating a patch is more difficult without a listing, although it can be accomplished by reading hexadecimal storage dumps and reconstructing machine language operation from the dumps. Note that the format of executable programs on disk is complex and is not a simple image of the program when it is loaded into memory. (Relocation data, external symbols, and an optimized disk loading format form part of the complexity.) SPZAP understands this disk format and allows users to zap an executable program as if it were a memory image.




Copyright IBM Corporation 1990, 2010