Wednesday, February 01, 2006

Quick Sample Debugging

Quick Sample Debugging Session
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

This chapter demonstrates the basic debugging features of XPEDITER/TSO,
using the sample program TRIMAIN. A quick overview shows you how to do
the following:

* Run and stop the program

* Step through code

* View and modify program variables

* Debug called modules

* Analyze data flow

* Trace logic flow

* Review execution in reverse direction


3.1 Preparing the Programs
=-=-=-=-=-=-=-=-=-=-=-=-=-


The source for the sample program TRIMAIN, which calls TRITST and TRIRPT
by use of CALL literal, is contained in the SAMPLIB dataset on the
XPEDITER/TSO product tape. The sample programs can be found in the common
load module, SIR, and file list libraries that have been created and
verified by your site installer. If not found, compile the sample
programs TRITST, TRIRPT, and TRIMAIN with the SIR processor.

Select option 2.1 (XPEDITER/TSO standard environment) from the XPEDITER
Primary Menu. Review the SETUP screens that have been initialized by your
site installer by typing SETUP in the primary command line. Following
this, type TRIMAIN in the Program field and the dataset name that contains
the file list for TRIMAIN in the File Allocation List field. The File
Allocation List should contain the INFILE and OUTFILE, which are defined
in the FD statements of TRIMAIN and must be preallocated when program
TRIMAIN is executed. The input test data can be located in member TRIDATA
of the SAMPLIB dataset. Be sure to direct the program output to the
terminal by specifying TERM for the OUTFILE DD. The file list can be
created by accessing the File Allocation List screen (option 1 on the
XPEDITER Primary Menu or through the use of the ALLOC command).

To start the debugging session, press . XPEDITER/TSO processes
the file list, allocates the necessary datasets, loads the program
TRIMAIN, and displays the COBOL source code. You should be able to see
the message "Before Breakpoint Encountered" with the execution arrow
pointing to the PROCEDURE DIVISION statement. This means that TRIMAIN is
stopped before the start of the program. An example of the source code
display is shown in Figure 3-1.

|----------------------------------------------------------------------------------|
| |
| ------------------------------ XPEDITER/TSO - SOURCE ----------------------------|
| COMMAND ===> SCROLL===> CSR |
| Before Breakpoint Encountered |
| ------ ------------------------------------------------------ Before TRIMAIN --|
| =====> B PROCEDURE DIVISION. |
| 000035 MAIN-PARA. |
| 000036 PERFORM INIT-PARA. |
| 000037 PERFORM ANALYZE-NEXT-REC |
| 000038 UNTIL OUT-OF-RECS = 'Y'. |
| 000039 PERFORM ENDING-PARA. |
| 000040 A GOBACK. |
| 000041 INIT-PARA. |
| 000042 MOVE ZERO TO N-CNTR (1) N-CNTR (2) N-CNTR (3) N-CNTR (4). |
| 000043 OPEN INPUT INFILE. |
| 000044 MOVE 'N' TO OUT-OF-RECS. |
| 000045 ANALYZE-NEXT-REC. |
| 000046 READ INFILE INTO WORK-REC |
| 000047 AT END |
| 000048 MOVE 'Y' TO OUT-OF-RECS. |
| 000049 IF OUT-OF-RECS = 'N' |
| 000050 MOVE ZERO TO TRIANGLE-TYPE |
| 000051 CALL 'TRITST' USING WORK-REC TRIANGLE-TYPE |
| 000052 SET TX TO TRIANGLE-TYPE |
| 000053 ADD 1 TO N-CNTR (TX). |
| |
|----------------------------------------------------------------------------------|

Figure 3-1. Debugging Screen Showing TRIMAIN Program

To access HELP, press the key. To terminate the debugging session
and return to the Standard screen, press the (EXIT) key. If you
need to reload the program and test again from the beginning, type the
following command in the primary command line:

RETEST

The RETEST command resets all the breakpoints and data displays.


RETEST is not valid in Dialog, BTS, or IMS environments, or with DB2
databases.

3.2 Setting Breakpoints
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


You can control program execution by setting breakpoints and running the
program. A breakpoint is a certain location in your program where you
want program execution to stop so you can inspect the data the program is
processing and check the logic to make certain it is correct.

A simple way to set a breakpoint is to enter it from the line command
area. Move the cursor to the compiler-generated statement number 43 at
the OPEN verb, then type over the statement number with the B(efore) line
command, as shown in Part A of Figure 3-2, and press . A "B"
appears in column 9 on statement 43, as seen in Part B, indicating that a
BEFORE breakpoint has been set. This breakpoint causes program execution
to pause before executing the OPEN statement.


|------------------------------------------------------------------------------|
| Part A: Entering B Line Command on Statement 43 |
|------------------------------------------------------------------------------|
| =====> B PROCEDURE DIVISION. |
| 000035 MAIN-PARA. |
| 000036 PERFORM INIT-PARA. |
| 000037 PERFORM ANALYZE-NEXT-REC |
| 000038 UNTIL OUT-OF-RECS = 'Y'. |
| 000039 PERFORM ENDING-PARA. |
| 000040 A GOBACK. |
| 000041 INIT-PARA. |
| 000042 MOVE ZERO TO N-CNTR (1) N-CNTR (2) N-CNTR (3) N-CNTR (4). |
| B 043 OPEN INPUT INFILE. |
| 000044 MOVE 'N' TO OUT-OF-RECS. |
|------------------------------------------------------------------------------|
| Part B: BEFORE Breakpoint Displayed for Statement 43 |
|------------------------------------------------------------------------------|
| =====> B PROCEDURE DIVISION. |
| 000035 MAIN-PARA. |
| 000036 PERFORM INIT-PARA. |
| 000037 PERFORM ANALYZE-NEXT-REC |
| 000038 UNTIL OUT-OF-RECS = 'Y'. |
| 000039 PERFORM ENDING-PARA. |
| 000040 A GOBACK. |
| 000041 INIT-PARA. |
| 000042 MOVE ZERO TO N-CNTR (1) N-CNTR (2) N-CNTR (3) N-CNTR (4). |
| 000043 B OPEN INPUT INFILE. |
| 000044 MOVE 'N' TO OUT-OF-RECS. |
|------------------------------------------------------------------------------|


Figure 3-2. Entering a BEFORE Breakpoint on Line 43

Press (GO) to execute TRIMAIN until the breakpoint is reached. The
program stops at statement 43, where the execution arrow is pointing. The
execution status field on the fourth line also shows that execution is at
"Before TRIMAIN.43," as shown in Figure 3-3.

|----------------------------------------------------------------------------------|
| |
| ------------------------------ XPEDITER/TSO - SOURCE ----------------------------|
| COMMAND ===> SCROLL===> CSR |
| Before Breakpoint Encountered |
| ------ --------------------------------------------------- Before TRIMAIN.43 --|
| 000034 B PROCEDURE DIVISION. |
| 000035 MAIN-PARA. |
| 000036 PERFORM INIT-PARA. |
| 000037 PERFORM ANALYZE-NEXT-REC |
| 000038 UNTIL OUT-OF-RECS = 'Y'. |
| 000039 PERFORM ENDING-PARA. |
| 000040 A GOBACK. |
| 000041 INIT-PARA. |
| 000042 MOVE ZERO TO N-CNTR (1) N-CNTR (2) N-CNTR (3) N-CNTR (4). |
| =====> B OPEN INPUT INFILE. |
| 000044 MOVE 'N' TO OUT-OF-RECS. |
| 000045 ANALYZE-NEXT-REC. |
| 000046 READ INFILE INTO WORK-REC |
| 000047 AT END |
| 000048 MOVE 'Y' TO OUT-OF-RECS. |
| 000049 IF OUT-OF-RECS = 'N' |
| 000050 MOVE ZERO TO TRIANGLE-TYPE |
| 000051 CALL 'TRITST' USING WORK-REC TRIANGLE-TYPE |
| 000052 SET TX TO TRIANGLE-TYPE |
| 000053 ADD 1 TO N-CNTR (TX). |
| 00054 ENDING-PARA. |
| |
|----------------------------------------------------------------------------------|

Figure 3-3. BEFORE Breakpoint at Statement 43

Press (GO 1) to execute statements one-by-one. The program stops at
statement 44 after the input file is opened and before the OUT-OF-RECS
switch is set to "N." Type the SHOW FILE command in the primary command
line.

The DD names and DCB parameters that you generally specify in the JCL
statements are listed, together with the file I/O status, as shown in
Figure 3-4.

|----------------------------------------------------------------------------------|
| |
| ------------------------------- XPEDITER/TSO - SHOW -----------------------------|
| COMMAND ===> SCROLL===> CSR |
| PROGRAM: TRIMAIN MODULE: TRIMAIN COMP DATE: 07/29/92 COMP TIME: 14.41.59 |
| ------------------------------------------------------------ Before TRIMAIN.44 --|
| ******************************* TOP OF DATA ********************************** |
| ** FILE ATTRIBUTES FOR APPLICATION MODULE TRIMAIN *** |
| DSORG RECFM BLKSI LRECL |
| NON-VSAM FILE FOR DDNAME INFILE OPEN DCB = PS FB 23440 80 |
| DSN=AXPTSO.QA.TSODATA.DATA JFCB= PO FB 23440 80 |
| MBR=TRIDATA |
| DATA SET ALLOCATED ON VOLUME AXP001 DSCB= PO FB 23440 80 |
| ORGANIZATION = SEQUENTIAL ACCESS MODE = SEQUENTIAL RECFM = FB |
| OPEN VERB OPTION = INPUT LAST I/O STATEMENT = OPEN STATUS = 00 |
| |
| ** FILE ATTRIBUTES FOR APPLICATION MODULE TRIRPT *** |
| DSORG RECFM BLKSI LRECL |
| NON-VSAM FILE FOR DDNAME OUTFILE CLOSED DCB = PS -- 0 80 |
| DSN=*TERMINAL* JFCB= PS -- 0 0 |
| ORGANIZATION = SEQUENTIAL ACCESS MODE = SEQUENTIAL RECFM = FB |
| |
| ** END OF FILE ATTRIBUTE DISPLAY *** |
| ****************************** BOTTOM OF DATA ******************************** |
| |

Figure 3-4. File Attributes Displayed by the SHOW FILE Command

Press (END) to return to the Source screen.

There are several variations of the breakpoint commands. A B line command
sets a BEFORE breakpoint. An A line command sets an AFTER breakpoint.
You may want to place an AFTER breakpoint on a conditional statement since
XPEDITER/TSO tells you what the next logical statement will be when the
breakpoint is encountered.

To remove breakpoints, enter the D(elete) line command on a line that has
a breakpoint and press .

3.3 Displaying Data Contents
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


In the TRIMAIN program, move the cursor to statement 42, where a table
would have been initialized with zeros, type over the statement number
with the P (PEEK) line command, and press . The screen
automatically scrolls up to the DATA DIVISION statement and displays the
data content of N-CNTR, as shown in Figure 3-5.

|----------------------------------------------------------------------------------|
| |
| ------------------------------ XPEDITER/TSO - SOURCE ----------------------------|
| COMMAND ===> SCROLL===> CSR |
| PROGRAM: TRIMAIN MODULE: TRIMAIN COMP DATE: 07/29/92 COMP TIME: 14.41.59 |
| ------ --------------------------------------------------- Before TRIMAIN.44 --|
| > 1 OCCURRENCE |
| 000027 10 N-CNTR > 0000 DECIMAL |
| 000028 01 OUT-OF-RECS PIC X. |
| 000029 01 TRIANGLE-TYPE PIC 9. |
| 000030 01 WORK-REC. |
| 000031 05 SIDE-A PIC 9(01). |
| 000032 05 SIDE-B PIC 9(01). |
| 000033 05 SIDE-C PIC 9(01). |
| 000034 B PROCEDURE DIVISION. |
| 000035 MAIN-PARA. |
| 000036 PERFORM INIT-PARA. |
| 000037 PERFORM ANALYZE-NEXT-REC |
| 000038 UNTIL OUT-OF-RECS = 'Y'. |
| 000039 PERFORM ENDING-PARA. |
| 000040 A GOBACK. |
| 000041 INIT-PARA. |
| 000042 MOVE ZERO TO N-CNTR (1) N-CNTR (2) N-CNTR (3) N-CNTR (4). |
| 000043 B OPEN INPUT INFILE. |
| =====> MOVE 'N' TO OUT-OF-RECS. |
| 000045 ANALYZE-NEXT-REC. |
| |
|----------------------------------------------------------------------------------|

Figure 3-5. Displaying the Data Content of N-CNTR

Tab down to the arrow that shows the occurrence number and type over the 1
with a 2 and press . Continue typing over the occurrence number,
each time adding 1 to the previous number. Eventually, XPEDITER/TSO
displays the warning shown in Figure 3-6, indicating that the index
boundary has been reached.

|----------------------------------------------------------------------------------|
| |
| ------------------------------ XPEDITER/TSO - SOURCE ----------------------------|
| COMMAND ===> SCROLL===> CSR |
| NUMBER EXCEEDS MAXIMUM OCCURRENCES FOR ITEM |
| ------ --------------------------------------------------- Before TRIMAIN.44 --|
| > 5 OCCURRENCE |
| 000027 10 N-CNTR > ???? INVALID DECIMAL |
| 000028 01 OUT-OF-RECS PIC X. |
| 000029 01 TRIANGLE-TYPE PIC 9. |
| 000030 01 WORK-REC. |
| 000031 05 SIDE-A PIC 9(01). |
| 000032 05 SIDE-B PIC 9(01). |
| 000033 05 SIDE-C PIC 9(01). |
| 000034 B PROCEDURE DIVISION. |
| 000035 MAIN-PARA. |
| 000036 PERFORM INIT-PARA. |
| 000037 PERFORM ANALYZE-NEXT-REC |
| 000038 UNTIL OUT-OF-RECS = 'Y'. |
| 000039 PERFORM ENDING-PARA. |
| 000040 A GOBACK. |
| 000041 INIT-PARA. |
| 000042 MOVE ZERO TO N-CNTR (1) N-CNTR (2) N-CNTR (3) N-CNTR (4). |
| 000043 B OPEN INPUT INFILE. |
| =====> MOVE 'N' TO OUT-OF-RECS. |
| 000045 ANALYZE-NEXT-REC. |
| |
|----------------------------------------------------------------------------------|

Figure 3-6. Message Indicating That the Index Boundary Has Been Reached

Press (LOCATE *) to scroll down to where the execution arrow is.
See Figure 3-7.

|----------------------------------------------------------------------------------|
| |
| ------------------------------ XPEDITER/TSO - SOURCE ----------------------------|
| COMMAND ===> SCROLL===> CSR |
| PROGRAM: TRIMAIN MODULE: TRIMAIN COMP DATE: 07/29/92 COMP TIME: 14.41.59 |
| ------ --------------------------------------------------- Before TRIMAIN.44 --|
| =====> MOVE 'N' TO OUT-OF-RECS. |
| 000045 ANALYZE-NEXT-REC. |
| 000046 READ INFILE INTO WORK-REC |
| 000047 AT END |
| 000048 MOVE 'Y' TO OUT-OF-RECS. |
| 000049 IF OUT-OF-RECS = 'N' |
| 000050 MOVE ZERO TO TRIANGLE-TYPE |
| 000051 CALL 'TRITST' USING WORK-REC TRIANGLE-TYPE |
| 000052 SET TX TO TRIANGLE-TYPE |
| 000053 ADD 1 TO N-CNTR (TX). |
| 000054 ENDING-PARA. |
| 000055 CLOSE INFILE. |
| 000056 CALL 'TRIRPT' USING NAME-N-CNTR-TABLE. |
| ****** *********************** BOTTOM OF MODULE *************************** |
| |

Figure 3-7. TRIMAIN After Entering LOCATE * Command

Place an A line command on statement 46, setting an AFTER breakpoint at
the READ statement. Next, type the K2 line command on statement 46 to
open a Keep window at the top of the screen and display the contents of
Working Storage item WORK-REC (the second variable identified on line 46).
The display is shown in Figure 3-8.

|----------------------------------------------------------------------------------|
| |
| ------------------------------ XPEDITER/TSO - SOURCE ----------------------------|
| COMMAND ===> SCROLL===> CSR |
| PROGRAM: TRIMAIN MODULE: TRIMAIN COMP DATE: 07/29/92 COMP TIME: 14.41.59 |
| --- |
| 000030 01 WORK-REC > ... |
| ------ --------------------------------------------------- Before TRIMAIN.44 --|
| =====> MOVE 'N' TO OUT-OF-RECS. |
| 000045 ANALYZE-NEXT-REC. |
| 000046 A READ INFILE INTO WORK-REC |
| 000047 AT END |
| 000048 MOVE 'Y' TO OUT-OF-RECS. |
| 000049 IF OUT-OF-RECS = 'N' |
| 000050 MOVE ZERO TO TRIANGLE-TYPE |
| 000051 CALL 'TRITST' USING WORK-REC TRIANGLE-TYPE |
| 000052 SET TX TO TRIANGLE-TYPE |
| 000053 ADD 1 TO N-CNTR (TX). |
| 000054 ENDING-PARA. |
| 000055 CLOSE INFILE. |
| 000056 CALL 'TRIRPT' USING NAME-N-CNTR-TABLE. |
| ****** ************************ BOTTOM OF MODULE ***************************** |
| |

Figure 3-8. Opening Up a Keep Window for the Second Variable (WORK-REC)
on Line 46

Press (GO) to execute TRIMAIN. As shown in Figure 3-9, you can
see that record '345' was read when the READ verb was executed.

|----------------------------------------------------------------------------------|
| |
| ------------------------------ XPEDITER/TSO - SOURCE ----------------------------|
| COMMAND ===> SCROLL===> CSR |
| Next logical instruction is TRIMAIN.49 |
| --- |
| 000030 01 WORK-REC > 345 |
| ------ ---------------------------------------------------- After TRIMAIN.46 --|
| 000044 MOVE 'N' TO OUT-OF-RECS. |
| 000045 ANALYZE-NEXT-REC. |
| ====>> A READ INFILE INTO WORK-REC |
| 000047 AT END |
| 000048 MOVE 'Y' TO OUT-OF-RECS. |
| 000049 IF OUT-OF-RECS = 'N' |
| 000050 MOVE ZERO TO TRIANGLE-TYPE |
| 000051 CALL 'TRITST' USING WORK-REC TRIANGLE-TYPE |
| 000052 SET TX TO TRIANGLE-TYPE |
| 000053 ADD 1 TO N-CNTR (TX). |
| 000054 ENDING-PARA. |
| 000055 CLOSE INFILE. |
| 000056 CALL 'TRIRPT' USING NAME-N-CNTR-TABLE. |
| ***** ************************** BOTTOM OF MODULE ***************************** |
| |

Figure 3-9. Displaying a Variable in a Keep Window

Press (GO) again. Paragraph ANALYZE-NEXT-REC is performed until
EOF, and the next record '789' is read in the second time through the
loop. WORK-REC is updated to reflect the change. As you execute your
program, XPEDITER/TSO updates the Keep window to reflect the current
values. You can also type over the displayed fields and modify the data
values as if the program had executed the MOVE statement.

3.4 Debugging Subroutines
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


Statement 51 shows that the program TRIMAIN calls TRITST and passes
parameters WORK-REC and TRIANGLE-TYPE. In order to examine how TRITST is
processing these parameters, you might want to set a breakpoint at the
beginning of TRITST to gain control of the execution. Therefore, type the
following command in the primary command line:

BEFORE TRITST.

The period (.) after the program name indicates that a module-level
breakpoint is requested. Press (GO) to execute the program.
XPEDITER/TSO pauses execution at the PROCEDURE DIVISION USING statement.
Now, type the following command in the primary command line.

PEEK LINKAGE

The Linkage Section shows that the correct values, '789' for TST-REC and
'0' for TYPE-OF-TRIANGLE were passed from the driver TRIMAIN.

|----------------------------------------------------------------------------------|
| |
| ------------------------------ XPEDITER/TSO - SOURCE ----------------------------|
| COMMAND ===> SCROLL===> CSR |
| PROGRAM: TRITST MODULE: TRITST COMP DATE: 07/29/92 COMP TIME: 14.41.59 |
| ------ ------------------------------------------------------- Before TRITST --|
| --- |
| 000010 01 TST-REC > 789 |
| 000011 05 A PIC 9. |
| 000012 05 B PIC 9. |
| 000013 05 C PIC 9. |
| 000014 01 TYPE-OF-TRIANGLE > 0 DECIMAL |
| =====> B PROCEDURE DIVISION USING TST-REC |
| 000016 TYPE-OF-TRIANGLE. |
| 000017 VALIDATE-TRIANGLE. |
| 000018 ADD A B GIVING A-N-B. |
| 000019 ADD A C GIVING A-N-C. |
| 000020 ADD B C GIVING B-N-C. |
| 000021 IF (B-N-C NOT > A) OR (A-N-C NOT > B) OR (A-N-B NOT > C) |
| 000022 MOVE 4 TO TYPE-OF-TRIANGLE. |
| 000023 DETERMINE-TYPE. |
| 000024 IF TYPE-OF-TRIANGLE = 4 |
| 000025 NEXT SENTENCE |
| 000026 ELSE |
| 000027 IF (A = B) AND (B = C) |
| 000028 MOVE 1 TO TYPE-OF-TRIANGLE |
| |
|----------------------------------------------------------------------------------|

Figure 3-10. Displaying LINKAGE SECTION in the Called Module TRITST

3.5 Analyzing Data Flow
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


To better understand how the parameters are processed in the subroutine,
XPEDITER/TSO allows you to cross-reference data and to analyze the data
flow in your program. The 01 level for TST-REC has three 05 levels: A,
B, and C. Essentially, the elementary items are the aliases of a group
item. Type the following command in the primary command line:

FIND TST-REC ALIAS

XPEDITER/TSO highlights all the statements that reference (DEFine,
MODify, USE) TST-REC and its aliases. The message shown in Figure 3-11 is
issued, which states how many data definitions were found.

|----------------------------------------------------------------------------------|
| |
| ------------------------------ XPEDITER/TSO - SOURCE ----------------------------|
| COMMAND ===> SCROLL===> CSR |
| 24 DATA REFS: 4 DEFS, 20 USES FOUND FOR TST-REC |
| ------ ------------------------------------------------------- Before TRITST --|
| --- |
| 000010 01 TST-REC > 789 |
| 000011 05 A PIC 9. DEF |
| 000012 05 B PIC 9. DEF |
| 000013 05 C PIC 9. DEF |
| 000014 01 TYPE-OF-TRIANGLE > 0 DECIMAL |
| =====> B PROCEDURE DIVISION USING TST-REC USE |
| 000016 TYPE-OF-TRIANGLE. |
| 000017 VALIDATE-TRIANGLE. |
| 000018 ADD A B GIVING A-N-B. 2 USE |
| 000019 ADD A C GIVING A-N-C. 2 USE |
| 000020 ADD B C GIVING B-N-C. 2 USE |
| 000021 IF (B-N-C NOT > A) OR (A-N-C NOT > B) OR (A-N-B NOT > C) 3 USE |
| 000022 MOVE 4 TO TYPE-OF-TRIANGLE. |
| 000023 DETERMINE-TYPE. |
| 000024 IF TYPE-OF-TRIANGLE = 4 |
| 000025 NEXT SENTENCE |
| 000026 ELSE |
| 000027 IF (A = B) AND (B = C) 4 USE |
| 000028 MOVE 1 TO TYPE-OF-TRIANGLE |
| |
|----------------------------------------------------------------------------------|

Figure 3-11. Finding Statements That Reference TST-REC

The analysis concludes that parameter TST-REC is USEd, but never MODified
in the subroutine. What about parameter TYPE-OF-TRIANGLE? Type the
following command in the primary command line:

FIND TYPE-OF-TRIANGLE MOD

The message "4 DATA MODS FOUND FOR TYPE-OF-TRIANGLE" is displayed in the
message line, as shown in Figure 3-12, which means that the parameter is
MODified four times.

|----------------------------------------------------------------------------------|
| |
| ------------------------------ XPEDITER/TSO - SOURCE ----------------------------|
| COMMAND ===> SCROLL===> CSR |
| 4 DATA MODS FOUND FOR TYPE-OF-TRIANGLE |
| ------ ------------------------------------------------------- Before TRITST --|
| --- |
| 000010 01 TST-REC > 345 |
| 000011 05 A PIC 9. |
| 000012 05 B PIC 9. |
| 000013 05 C PIC 9. |
| 000014 01 TYPE-OF-TRIANGLE > 0 DECIMAL |
| =====> B PROCEDURE DIVISION USING TST-REC |
| 000016 TYPE-OF-TRIANGLE. |
| 000017 VALIDATE-TRIANGLE. |
| 000018 ADD A B GIVING A-N-B. |
| 000019 ADD A C GIVING A-N-C. |
| 000020 ADD B C GIVING B-N-C. |
| 000021 IF (B-N-C NOT > A) OR (A-N-C NOT > B) OR (A-N-B NOT > C) |
| 000022 MOVE 4 TO TYPE-OF-TRIANGLE. MOD |
| 000023 DETERMINE-TYPE. |
| 000024 IF TYPE-OF-TRIANGLE = 4 |
| 000025 NEXT SENTENCE |
| 000026 ELSE |
| 000027 IF (A = B) AND (B = C) |
| 000028 MOVE 1 TO TYPE-OF-TRIANGLE MOD |
| |
|----------------------------------------------------------------------------------|

Figure 3-12. Result of Entering FIND TYPE-OF-TRIANGLE MOD Command

The FIND command under XPEDITER/TSO is sensitive to COBOL-structure
keywords as well as data reference keywords. For instance, you can use
the FIND command to search conditional statements or I/O statements. The
highlighting effect helps you capture the program logic and understand
what the program does.

3.6 Tracing Logic Flow
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


Subroutine TRITST evaluates the type of triangle by using TST-REC and
updates TYPE-OF-TRIANGLE. Paragraph DETERMINE-TYPE (statement 23) has a
nested IF structure. XPEDITER/TSO can automatically trace the logic flow
to show which path was chosen. Type the following command in the primary
command line:

TRACE ALL STATEMENTS;GO

Tracing pauses when the AFTER breakpoint is reached when control is
returned to the calling module TRIMAIN, as shown in Figure 3-13.

|----------------------------------------------------------------------------------|
| |
| ------------------------------ XPEDITER/TSO - SOURCE ----------------------------|
| COMMAND ===> SCROLL===> CSR |
| Next logical instruction is TRIMAIN.49 |
| --- |
| 000030 01 WORK-REC > 563 |
| ------ ---------------------------------------------------- After TRIMAIN.46 --|
| 000044 MOVE 'N' TO OUT-OF-RECS. |
| 000045 ANALYZE-NEXT-REC. |
| ====>> A READ INFILE INTO WORK-REC |
| 000047 AT END |
| 000048 MOVE 'Y' TO OUT-OF-RECS. |
| 000049 IF OUT-OF-RECS = 'N' |
| 000050 MOVE ZERO TO TRIANGLE-TYPE |
| 000051 CALL 'TRITST' USING WORK-REC TRIANGLE-TYPE |
| 000052 SET TX TO TRIANGLE-TYPE |
| 000053 ADD 1 TO N-CNTR (TX). |
| 000054 ENDING-PARA. |
| 000055 CLOSE INFILE. |
| 000056 CALL 'TRIRPT' USING NAME-N-CNTR-TABLE. |
| ****** *********************** BOTTOM OF MODULE ***************************** |
| |
| |
| |
| |
| |
|----------------------------------------------------------------------------------|

Figure 3-13. Tracing is Paused for the AFTER Breakpoint in the Calling
Module TRIMAIN

Press (GO) to return to TRITST again. If execution is too fast
for you to follow, type the following command in the primary command line
to control the tracing speed:

SET DELAY 1;GO

Otherwise, press (GO) to trace through TRITST.

3.7 Review Mode
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


Type the following command in the primary command line:

MONITOR ALL

Press (GO) to start execution, followed by another (GO) to
continue execution. When the AFTER breakpoint is reached in TRIMAIN, type
the following command in the primary command line to change the direction
of execution processing:

REVERSE

The execution status line shows that XPEDITER/TSO is reviewing in the
reverse direction. See Figure 3-14.

|----------------------------------------------------------------------------------|
| |
| ------------------------------ XPEDITER/TSO - SOURCE ----------------------------|
| COMMAND ===> SCROLL===> CSR |
| Next logical instruction is RESUME EXECUTION |
| --- |
| 000030 01 WORK-REC > 345 |
| ------ -------------------------------------------Reverse - After TRIMAIN.46 --|
| 000044 MOVE 'N' TO OUT-OF-RECS. |
| 000045 ANALYZE-NEXT-REC. |
| ====>> A READ INFILE INTO WORK-REC |
| 000047 AT END |
| 000048 MOVE 'Y' TO OUT-OF-RECS. |
| 000049 IF OUT-OF-RECS = 'N' |
| 000050 MOVE ZERO TO TRIANGLE-TYPE |
| 000051 CALL 'TRITST' USING WORK-REC TRIANGLE-TYPE |
| 000052 SET TX TO TRIANGLE-TYPE |
| 000053 ADD 1 TO N-CNTR (TX). |
| 000054 ENDING-PARA. |
| 000055 CLOSE INFILE. |
| 000056 CALL 'TRIRPT' USING NAME-N-CNTR-TABLE. |
| ****** *********************** BOTTOM OF MODULE ****************************** |
| |
| |
| |
| |
| |
|----------------------------------------------------------------------------------|

Figure 3-14. Review Mode Execution

Now step through each statement backwards by pressing (GO 1)
several times. Data values in the Keep window reshow the original state
as the MOVE, ADD, and READ verbs are being "undone."

You can remove the Keep window by typing the following command in the
primary command line:

DELETE KEEP

If you want to remove a certain data item from the Keep window, enter the
D line command on the appropriate line. Press (EXIT) to exit the
debugging session and to return to the Standard screen.