Inspecting and modifying a data record

You will inspect and modify a data record differently depending on whether the data record is in a PDSE or some other type of data set, such as a VTOC or sequential data set.

Note: The following information does NOT apply to a PDS. SPZAP only supports a PDS that contains load modules.

Record not in a PDSE: To inspect or modify a specific data record that is not in a PDSE you must use a CCHHR control statement to specify its direct access address. This CCHHR address must be within the limits of the direct access data set defined in the SYSLIB DD control statement.

When you use the CCHHR control statement, SPZAP reads the physical record you want to inspect or modify. The offset parameters specified in subsequent VERIFY and REP statements are then used to locate the data that will be verified or replaced within the record. These hexadecimal offsets must define the displacement of data relative to the beginning of the record and include the length of any key field.

If you request a REP operation for a record identified by a CCHHR control statement, SPZAP issues message AMA112I to provide a record of your request.

In z/OS® V1R7 and later DSNTYPE=LARGE data sets are supported when using V1R7 or a later release of SPZAP.

Record in a PDSE: To inspect or modify a specific data record in a PDSE data library, you must use the RECORD control statement preceded by a NAME control statement to specify its direct access address. This combination of RECORD and NAME serves as a pointer to a specific location in a PDSE data library member.

The CCHHR control statement does not apply to a PDSE. Any attempt to access data in a PDSE with a CCHHR control statement will cause an error message. Any VER|VERIFY, REP, IDRDATA, or SETSSI control statements immediately following a CCHHR statement will be flagged in error and ignored.

To determine the relative record number for a specific record, invoke SPZAP, specifying:
NAME membernam
ABSDUMP(T)  1 99999999
The results show a display of all records in the member, record length, relative record number, and other pertinent information.
In Figure 1, the data set to be modified is a volume table of contents.
Figure 1. Example: Inspecting and modifying a data record
//ZAPIT         JOB         MSGLEVEL=(1,1)
//STEP          EXEC        PGM=AMASPZAP
//SYSPRINT      DD          SYSOUT=A
//SYSLIB        DD          DSNAME=FORMAT4.DSCB,DISP=OLD,
//      UNIT=3390,VOLUME=SER=111111,DCB=(KEYLEN=44)
//SYSIN         DD          *
 CCHHR             0005000001
 VERIFY            2C   0504
 REP               2C   0A08
 REP               2E   0001,03000102
 ABSDUMPT          ALL
/*

SYSPRINT DD Statement: Defines the message data set.

SYSLIB DD Statement: Defines the data set to be accessed by SPZAP in performing the operations specified by the control statements. In this example, it defines the VTOC (a Format 4 DSCB) on a 3390 volume with a serial number of 111111. DCB=(KEYLEN=44) is specified so that the dump produced by the ABSDUMPT control statement will show the dsname which is a 44-byte key. Note that this is not necessary for the VERIFY and REP control statements.

CCHHR Control Statement: Indicates that SPZAP is to access the direct access record address “0005000001” in the data set defined by the SYSLIB DD statement while performing the operations specified by the following control statements.

VERIFY Control Statement: Requests that SPZAP check the data at hexadecimal displacement X'2C' 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 statements: Cause the eight bytes of data starting at displacement 2C from the beginning of the record to be replaced with the hexadecimal data in the REP control statements. The 2C displacement value allows for a 44-byte key at the beginning of the record.

ABSDUMPT Control Statement: Causes SPZAP to dump the entire data set to the SYSPRINT data set. Since DCB=(KEYLEN=44) is specified on the SYSLIB DD statement, the 44-byte dsname is also dumped.

Note: If the VTOC is to be modified, message AMA117D is issued to the operator, requesting permission for the modification.
Figure 2 shows how to inspect and modify a record within a PDSE data library.
Figure 2. Example: Using SPZAP to modify a data record
//UPDDATA JOB   MSGLEVEL=(1,1)
//ZAPSTEP EXEC  PGM=AMASPZAP
//SYSPRINT  DD  SYSOUT=A
//SYSLIB    DD  DSN=IBMUSER.LMD.PDSE,DISP=OLD
//SYSIN     DD  *
  NAME    USERDATA
  RECORD    0003
  VER       000010   04B3,9017
  REP       000014   10C7,C5E3,C4E2
  ABSDUMP   3        3

SYSLIB DD statement: Defines the data set that SPZAP is to access to perform the operations specified by the control statements. In this example, it defines a private PDSE data library. The NAME statement identifies the member as USERDATA, which is shown in Figure 4.

SYSIN DD statement: Defines the input stream containing the SPZAP control statements.

NAME control statement: Instructs SPZAP that the control statements that immediately follow this statement are to be performed on the member whose name is USERDATA.

RECORD control statement: Indicates that SPZAP is to access relative record 3, the third record in the member USERDATA. Record 3 is the object of the VERIFY and REP operations that follow.

VERIFY control statement: Requests that SPZAP check the data at hexadecimal displacement X'0010' to compare it to the string specified. If there is a difference, this VERIFY is flagged with an error message, the contents of record 3 are displayed, and the following REP statement is flagged and ignored.

REP control statement: Causes SPZAP to replace the data at offset X'000014' in record 3 of member USERDATA with the data X'10C7C5E3C4E2' if the preceding VERIFY statement completed successfully. If the preceding VERIFY statement was flagged in error, then this statement is also flagged in error, and no data is replaced.

ABSDUMP control statement: Causes SPZAP to display record 3 of member USERDATA. Record 3 is displayed whether the VERIFY succeeded or failed.