Accessing data in a CSECT

For a complete description of the control statements mentioned in the following discussion, see SPZAP control statements.

Once the CSECT has been found, the use of offset parameters in the VERIFY and REP statements allow SPZAP to locate the data that is to be verified and replaced. The offset parameters are specified in hexadecimal notation and define the displacement of the data relative to the beginning of the CSECT. For example, if a hexadecimal offset of X'40' is specified in a VERIFY statement, SPZAP will find the location that is 64 bytes beyond the beginning of the CSECT identified by the NAME statement, and begin verifying the data from that point.

Normally, the assembly listing address associated with the instruction to be inspected or modified can be used as the offset value in the VERIFY or REP statement. However, if a CSECT has been assembled with other CSECTs so that its origin is not at assembly location zero, then the locations in the assembly listing do not reflect the correct displacements of data in the CSECT. You must compute the proper displacements by subtracting the assembly listing address delimiting the start of the CSECT from the assembly listing address of the data to be referenced.

You can, however, use the BASE control statement to eliminate the need for such calculations and allow you to use the assembly listing locations. The BASE control statement should be included in the input to SPZAP immediately following the NAME statement that identifies the CSECT. The parameter in the BASE statement must be the assembly listing address (in hexadecimal) at which the CSECT begins. SPZAP then subtracts this value from the offset specified on any VERIFY or REP statement that follows the BASE statement, and uses the difference as the displacement of the data.

Figure 1 is a sample assembly listing showing more than one control section. To refer to the second CSECT (IEFCVOL2), you could include in the input to SPZAP a BASE statement with a location of 0398. Then, to refer to the subsequent LOAD instruction (L R2,CTJCTAD) you could use an offset of X'039A' in the VERIFY or REP statements that follow in the SPZAP input stream.

Figure 1. Sample Assembly Listing Showing Multiple Control Sections
       LISTING TITLE

 LOC   OBJECT CODE    ADDR1 ADDR2 STMT   SOURCE STATEMENT

000000                               1 IEFCVOL1 CSECT                  10000017

                                    .
                                    .
                                    .

000384 00000000                    378 VCNQMSSS DC   V(IEFQMSSS)       55800017
                                   379 *                               56000017
000388 00000000                    380 VCMSG15  DC   V(IEFVMG15)       56100017
00038C D200 1001 8000 00000 00000  381 MVCMSG   MVC  0(1,R1),0(R8)     56200017
                                   382 *                               56300017
000392 D200 1001 1000 00001 00000  383 MVCBLNKS MVC  1(1,R1),0(R1)     56400017
                                   384 *                               56500017



000398                             386          CSECT                  56600017
000398 0590                        387          BALR  R9.0             56700017
00039A                             388          USING *,R9             56800017
00039A 5820 C010            00010  389          L     R2,LCTJCTAD      56900017

                                    .
                                    .
                                    .