Inspecting and modifying a load module or program object

To inspect or modify data in a load module or program object, you need a NAME statement to supply SPZAP the name of the appropriate member of the file. The load module must be a member of the PDS, identified by the SYSLIB DD statement included in the JCL. The program object must be a member of the PDSE or a file in the z/OS® UNIX directory identified by the SYSLIB DD statement included in the JCL.

To inspect or modify a program object that is in a z/OS UNIX file system, use the PATH parameter on the SYSLIB DD statement instead of the DSNAME parameter. Use PATH to identify the directory that contains the file that is the program object. Use the NAME statement to identify the file.

If the load module member of a PDS or program object member of a PDSE contains more than one control section (CSECT), you must also supply SPZAP with the name of the CSECT that is to be inspected or modified. If no CSECT name is given in the NAME statement, SPZAP assumes that the control section to be processed is the first one encountered in searching the load module.

Whenever SPZAP updates a CSECT in a load module member of a PDS or program object member of a PDSE in response to your NAME and REP control statements, it also puts descriptive maintenance data in a CSECT identification record (IDR) associated with the load module or program object. This function will be performed automatically after all REP statements associated with the NAME statement have been processed; any optional user data that has to be placed in the IDR will come from the IDRDATA statement. See SPZAP control statements for an explanation of the IDRDATA statement.

Figure 1 shows how to inspect and modify a load module containing a single CSECT.

Figure 1. Example: Inspecting and modifying a single CSECT load module
//ZAPCSECT     JOB         MSGLEVEL=(1,1)
//STEP         EXEC        PGM=AMASPZAP
//SYSPRINT     DD          SYSOUT=A
//SYSLIB       DD          DSNAME=SYS1.LINKLIB,DISP=OLD
//SYSIN        DD          *
 NAME        IEEVLNKT
 VERIFY      0018      C9C8,D2D9,D1C2,C7D5
 REP         0018      E5C6,D3D6,E6F0,4040
 SETSSI      01211234
 IDRDATA     71144
 DUMP        IEEVLNKT
/*

SYSLIB DD Statement: Defines the system library SYS1.LINKLIB containing the module IEEVLNKT that SPZAP is to process.

NAME Control Statement: Instructs SPZAP that the operations defined by the control statements that follow are to be performed on the module IEEVLNKT.

VERIFY Control Statement: Requests that SPZAP check the hexadecimal data at offset X'0018' in the module IEEVLNKT to make sure that it is the same as the hexadecimal data specified in this statement. If the data is the same, SPZAP continues processing the subsequent statements sequentially. If the data is not identical, SPZAP will not perform the REP and SETSSI operations requested for the module. It will, however, perform the requested DUMP operation before discontinuing the processing. It will also dump a hexadecimal image of the module IEEVLNKT to the SYSPRINT data set.

REP Control Statement: Causes SPZAP to replace the data at offset X'0018' in module IEEVLNKT with the data given in this control statement, provided the VERIFY statement was successful.

SETSSI Control Statement: Instructs SPZAP to replace the system status information in the directory entry for module IEEVLNKT with the SSI data given in the statement, if the VERIFY statement was successful. The new SSI is to contain:

IDRDATA Control Statement: Causes SPZAP to update the IDR in module IEEVLNKT with the data 71144, if the REP operation is successful.

DUMP Control Statement: Requests that a hexadecimal image of module IEEVLNKT be dumped to the SYSPRINT data set. Since the DUMP statement follows the REP statement, the image will reflect the changes made by SPZAP if the VERIFY operation was successful.

Figure 2 shows how to apply an IBM-supplied PTF in the form of an SPZAP fix, rather than a module replacement PTF.
Figure 2. Example: Modifying a CSECT in a load module
//PTF40228   JOB      MSGLEVEL=(1,1)
//STEP       EXEC     PGM=AMASPZAP
//SYSPRINT   DD       SYSOUT=A
//SYSLIB     DD       DSNAME=SYS1.NUCLEUS,DISP=OLD
//SYSIN      DD       *
 NAME      IEANUC01  IEWFETCH
 IDRDATA   LOCFIX01
 VERIFY    01F0 47F0C018
 VERIFY    0210 5830C8F4
 REP       01F0 4780C072
 REP       0210 4130C8F4
 SETSSI    02114228
 DUMPT     IEANUC01  IEWFETCH
/*

SYSLIB DD Statement: Defines the library (SYS1.NUCLEUS) that contains input module IEANUC01.

SYSIN DD Statement: Defines the input stream.

NAME Control Statement: Instructs SPZAP that the operations defined by the control statements that immediately follow this statement are to be performed on the CSECT IEWFETCH contained in the load module IEANUC01.

IDRDATA Control Statement: Causes SPZAP to update the IDR in module IEANUC01 for CSECT IEWFETCH with the date LOCFIX01, if either of the REP operations is successful.

VERIFY control statements: Requests that SPZAP compare the contents of the locations X'01F0' and X'0210' in the control section IEWFETCH with the data given in the VERIFY control statements. If the comparisons are equal, SPZAP continues processing subsequent control statements sequentially. However, if the data at the locations does not compare identically to the data given in the VERIFY control statements, SPZAP dumps a hexadecimal image of CSECT IEWFETCH to the SYSPRINT data set; the subsequent REP and SETSSI statements are ignored. The DUMPT function specified will be performed before SPZAP ends processing.

REP control statements: Causes SPZAP to replace the data at offsets X'01F0' and X'0210' from the start of CSECT IEWFETCH with the hexadecimal data specified on the corresponding REP statements.

SETSSI Control Statement: Causes SPZAP to replace the system status information in the directory for module IEANUC01 with the SSI data given in the SETSSI statement after the replacement operations have been effected. The new SSI will contain a change level of 02, a flag byte of 11, and a serial number of 4228.

DUMPT Control Statement: Causes SPZAP to produce a translated dump for CSECT IEWFETCH of load module IEANUC01.

Use the JCL in Figure 3 to inspect and modify two CSECTs in the same load module.
Figure 3. Example: Inspecting and modifying two CSECTs
//CHANGIT    JOB         MSGLEVEL=(1,1)
//STEP       EXEC        PGM=AMASPZAP
//SYSPRINT   DD          SYSOUT=A
//SYSLIB     DD          DSNAME=SYS1.LINKLIB,DISP=OLD
//SYSIN      DD          *
 NAME      IEFX5000  IEFQMSSS
 VERIFY    0284 4780,C096
 REP       0284 4770,C096
 IDRDATA   PTF01483
 SETSSI    01212448
 DUMPT     IEFX5000  IEFQMSSS
 NAME      IEFX5000  IEFQMRAW
 VERIFY    0154 4780,C042
 REP       0154 4770,C042
 IDRDATA   PTF01483
 SETSSI    01212448
 DUMPT     IEFX5000  IEFQMRAW
/*

SYSLIB DD Statement: Defines the system library SYS1.LINKLIB containing the load module IEFX5000 that is to be changed by SPZAP.

NAME Control Statement #1: Instructs SPZAP that the operations requested through the control statements immediately following it are to be performed on CSECT IEFQMSSS in load module IEFX5000.

VERIFY Control Statement #1: Requests that SPZAP check the hexadecimal data at offset X'0284' in CSECT IEFQMSSS to make sure it is the same as the data specified in this control statement. If the data is identical, SPZAP continues processing the control statements. If the data is not identical, SPZAP does not perform the REP or SETSSI for CSECT IEFQMSSS, but it does perform the DUMPT operation. It also provides a hexadecimal dump of CSECT IEFQMSSS.

REP Control Statement #1: Causes SPZAP to replace the data at offset X'0284' in CSECT IEFQMSSS with the hexadecimal data given in this control statement.

IDRDATA Control Statement #1: Causes SPZAP to update the IDR in module IEFX5000 for CSECT IEFQMSSS with the data PTF01483, if the first REP operation is successful.

SETSSI Control Statement #1: Instructs SPZAP to replace the system status information in the directory entry for module IEFX5000 with the SSI data given. The new SSI will contain a change level of 01, a flag byte of 21, and a serial number of 2448.

DUMPT Control Statement #1: Provides a translated dump of CSECT IEFQMSSS.

NAME Control Statement #2: Indicates that the operations defined by the control statements that immediately follow this statement are to be performed on CSECT IEFQMRAW in the load module IEFX5000.

VERIFY Control Statement #2: Requests that SPZAP perform the VERIFY function at offset X'0154' from the start of CSECT IEFQMRAW. If the VERIFY operation is successful, SPZAP continues processing the subsequent control statements sequentially. If the VERIFY is rejected, however, SPZAP does not perform the following REP or SETSSI operations, but it does dump a hexadecimal image of CSECT IEFQMRAW to the SYSPRINT data set and performs the DUMPT operation as requested.

REP Control Statement #2: Causes SPZAP to replace the data at hexadecimal offset X'0154' from the start of CSECT IEFQMRAW with the hexadecimal data that is specified in this control statement.

IDRDATA Control Statement #2: Causes SPZAP to update the IDR in module IEFX5000 for CSECT IEFQMRAW with the data PTF01483, if the second REP operation is successful.

SETSSI Control Statement #2: Causes SPZAP to perform the same function as the previous SETSSI, but only if the second VERIFY is not rejected.

DUMPT Control Statement #2: Causes SPZAP to perform the DUMPT function on control section IEFQMRAW.

Use the JCL shown in Figure 4 to inspect and modify control section PRINTF in z/OS UNIX System Services.
Figure 4. Example: Inspecting and Modifying a CSECT in z/OS UNIX System Services
//ZAPUNIX  EXEC PGM=AMASPZAP
//SYSPRINT DD  SYSOUT=A
//SYSLIB   DD  PATH='/sj/sjpl/binder/unixzap/',
// PATHDISP=(KEEP,KEEP)
//SYSIN    DD  *
  NAME     LOADMOD1  PRINTF
  VERIFY   0000 58F0C210
  REP      0000 68F0D210
  DUMP     LOADMOD1 PRINTF
/*

SYSLIB DD Statement: Defines the directory ‘/sj/sjpl/binder/unixzap/’ containing the program object LOADMOD1 that SPZAP is to process.

SYSIN DD Statement: Defines the input stream.

NAME control statement: Instructs SPZAP that the operations defined by the control statements that follow are to be performed on the control section PRINTF of the program object LOADMOD1.

VERIFY control statement: Requests that SPZAP compare the contents of the location X'0000' in the control section PRINTF with the data given on the VERIFY control statement. If the comparisons are equal, SPZAP continues processing subsequent control statements sequentially. If the data does not compare, SPZAP dumps a hexadecimal image of CSECT PRINTF to the SYSPRINT data set; the subsequent REP control statement is ignored.

REP control statement: Causes SPZAP to replace the data at offset X'0000' from the start of the CSECT PRINTF with the hexadecimal data provided.

DUMP control statement: Requests that a hexadecimal image of program object LOADMOD1, control section PRINTF be dumped to the SYSPRINT data set. Because the dump statement follows the REP statement, the image will reflect the changes made by SPZAP if the VERIFY operation was successful.

Use the JCL in Figure 5 to inspect and modify a CSECT within a program object.
Figure 5. Example: Using SPZAP to modify a CSECT
//UPDATE  JOB   MSGLEVEL=(1,1)
//ZAPSTEP EXEC  PGM=AMASPZAP
//SYSPRINT  DD  SYSOUT=A
//SYSLIB    DD  DSN=SYS1.USERLIB,DISP=OLD
//SYSIN     DD  *
  NAME                                                             LONG#
                  ALIASNAME       PDSPROCR
  VERIFY    000070   58E0,9118
  REP       000074   50E0,9434,9140,9058,47E0,C0A8,45E0,C476,94BF,9058,#
                     181D,58D0,D004,1FFF,43F0,A046,1F00,BF07,A047
  REP       00009A   1861,1870,1F55,0E64,98EC,D00C,07FE

SYSLIB DD statement: Defines the library SYS1.USERLIB containing a program object with an alias of LONGALIASNAME. (Note the continuation character (#) following LONG.) One CSECT in this program object is being changed.

SYSIN DD statement: Defines the input stream.

NAME control statement: This control statement contains a ‘#’ in column 72 and is continued to a second control statement. The first 18 columns of the continued statement are blanks and are ignored. The string ALIASNAME on this continued statement is concatenated with the string LONG to form member name LONGALIASNAME. Note that this statement could have been contained in one record as NAME LONGALIASNAME PDSPROCR. Either way, the NAME statement indicates that SPZAP is to use the VERIFY and two REP statements to one CSECT PDSPROCR in the program object member whose alias is LONGALIASNAME.

Note: Leading blanks on the continued statement are ignored. No characters on the first card are skipped. Therefore, in order to split an operand, part on the first card and the rest on the second, it is important that the part of the operand on the first card extends to column 71. A blank in column 71 indicates that the non-blank string in the second card begins a new operand.

VERIFY control statement: Requests that SPZAP check the data at hexadecimal displacement X'000070' from the start of the data record defined in the CCHHR statement to make sure it is the same as the hexadecimal data specified in this control statement. If the data is the same, SPZAP continues processing the following control statements sequentially. If the data is not identical, SPZAP does not perform the REP function but does perform the ABSDUMPT operation; it also dumps a formatted hexadecimal image of the data record defined by the CCHHR statement to the SYSPRINT data set.

REP Control Statement #1: Causes SPZAP to replace the data at offset X'000074' in CSECT PDSPROCR with the hexadecimal data given in this control statement. Notice that this statement contains a non-blank (#) in column 72 indicating that it is continued to a second control statement.

REP Control Statement #2: Causes SPZAP to replace the data at offset X'00009A' in CSECT PDSPROCR with the hexadecimal data given in this control statement.