This chapter provides an overview and checklist for novice users of the Foreground option. The following sections assist you in preparing your programs for testing and using the application panels and commands to test your programs. For detailed information on the application panels used with the Foreground Option, see the chapter “Debugging Panels”, and for detailed information concerning the commands used with the Foreground Option, see the chapter "Debugging Commands."
Use the following steps to compile a program to be tested under the control of the application and to begin foreground test execution.
If you are testing an IMS program, first read this section, then read Testing IMS Applications. Also, if you are testing a DB2 application, see Testing IBM DB2 Applications. If you are testing an application that uses any database, batch link is the suggested method for debugging.
If you place the PROFILE WTPMSG in the application CLIST, you will not need to reenter it each time you invoke the application.
If you are testing an IMS or DL/I program, also review the instructions given in the section Testing IMS Applications.
If you are testing under CA Roscoe, also review the instructions in the section Testing Under CA Roscoe.
If you are testing an IMS or DL/I program, also review the instructions given in the section Testing IMS Applications.
If any of the programs specified on the Monitor Control panel are Visual Age PL/I for OS/390 programs and you entered a Y in the Monitor PL/I field, the PL/I PROTSYM/Load Module Map panel displays. Fill in the load module names for any PL/I programs that you want to debug.
If you are using CA Endevor SCM to manage your load module and listing libraries, you can activate the dynamic symbolic support feature (DSS) by designating a PROTSYM file as the receiver for DSS post processor-created symbolic files. This reduces your pre-testing setup time and ensures you will always debug with the correct symbolic file associated with the load module being monitored.
The execution of the application begins.
The program executes until one of the following conditions is encountered:
When an abend occurs, use application commands to correct the bad data and continue the test.
For example, consider the following COBOL statements:
041600 MOVE +20 TO VARIABLE‑LENGTH‑1. 041700 MOVE FIELD1 TO SALARY‑TO‑DATE. 041800 MOVE +30 TO VARIABLE‑LENGTH‑3.
If FIELD1 contains invalid numeric data such as spaces, an S0C7 occurs when an attempt is made to execute statement 041700. When the S0C7 occurs, the Intercept panel displays: the abend reason code appears on the title line and statement 041700 is highlighted.
To check the contents of FIELD1, use the DISPLAY command to format and display WORKING STORAGE. To change the contents of FIELD1, move the cursor under the data displayed at the right of the data item, and key in the new value for the data item.
Press the END key to return to the Intercept panel. Then issue the GO command to resume the test session.
Press the Attention key or PA1 key to stop a looping program. This causes the debugger to stop execution at the next executed statement. The Attention key works for terminals that are attached to the system through an SNA controller. The PA1 key works for terminals attached to the system using other means. To have the PA1 key work on most terminals, you must first press the RESET key.
If you cannot locate the Attention or RESET and PA1 keys, ask your technical support person for assistance.
Note: If you are attempting to break from a looping program and the PA1 key does not work, press RESET and then the PA1 key.
A program can be stepped backward from the point of an abend to determine the cause of the abend condition.
Use the PREV command to trace the program's execution in reverse. The PREV command does not affect the contents of the application's variables. It also does not change the location where the GO command will resume execution.
To view the statement that has been executed, enter P or PREV in the Command field of the Intercept panel and press Enter.
Stop a program at selected statements by setting unconditional breakpoints at those statements. From the Intercept panel, locate the statement where the program will be stopped, then use the U line command or the UNCOND command to set the unconditional breakpoint. To access the Intercept panel, review the Preparation for Test Execution section.
For example, consider the following COBOL statements:
041400 0000‑INITIALIZATION SECTION. 041500 041600 MOVE +20 TO VARIABLE‑LENGTH‑1. 041700 MOVE +25 TO VARIABLE‑LENGTH‑2. 041800 MOVE +30 TO VARIABLE‑LENGTH‑3.
The program is stopped at the first line of this code so that you can examine the value of the VARIABLE‑LENGTH variables used in the next three lines.
Set the breakpoint by typing a U in the left margin where the breakpoint will be set. In this example, type a U at statement 41400 and press Enter. Type GO and press Enter.
Use the UNCOND command also to set the breakpoint. It is especially useful if you want to automatically execute commands at the breakpoint. Assume that VARIABLE‑LENGTH‑4 was a data‑item that should have been initialized in this paragraph. The MOVE +45 TO VARIABLE‑LENGTH‑4 statement was omitted from the program source code. Add the statement by setting a breakpoint and specifying the SET command on the UNCOND command.
Set the breakpoint using either of the following UNCOND command formats:
UNCOND 41400 (SET VARIABLE‑LENGTH‑4 = +45)
or
UNCOND 0000‑INITIALIZATION (SET VARIABLE‑LENGTH‑4 = +45)
Press Enter to set the breakpoint and then issue the GO command to execute the program. When the program begins execution of statement 041400, the Intercept panel displays. The title line reads BREAKPOINT INTERCEPT and line 041400 is highlighted. The Breakpoint Intercept panel displays before the statement is executed. The assignment of +45 to VARIABLE‑LENGTH‑4 has been done automatically.
Step through a section of code by setting unconditional breakpoints at particular statements and then use the STEP and GO commands to execute each verb. For example, consider the following statements:
049400 DIVIDE CONV‑YEAR BY 4 049500 GIVING CONV‑LEAP‑COUNT 049600 REMAINDER CONV‑LEAP‑REMAINDER. 049700 ADD +1 TO CONV‑LEAP‑COUNT. 049800 IF CONV‑LEAP‑REMAINDER IS EQUAL TO ZERO 049900 THEN 050000 SUBTRACT +1 FROM CONV‑LEAP‑COUNT. 050100 050200 IF CONV‑DAY IS NOT EQUAL TO ZERO 050300 THEN 050400 SUBTRACT +1 FROM CONV‑DAY. 050500 050600 COMPUTE CONV‑TOD = 050700 (((((((CONV‑YEAR * 365) + CONV‑LEAP‑COUNT + CONV‑DAY) 050800 * 24) + CONV‑TIME‑HOUR) * 60) * CONV‑TIME‑MINUTE) 050900 * 60) + CONV‑TIME‑SST. 051000
Assume that one of the IF clauses in the previous example is not functioning as expected. Step through this section of the code by using the following command sequence:
|
UNCOND 49400 |
Sets a breakpoint at statement 049400, the DIVIDE verb. |
|
GO or GO key |
Executes the program until statement 049400 is reached; then the Intercept panel displays. The title line reads UNCOND BEFORE INTERCEPT. Statement 049400 is highlighted. |
|
STEP 1 |
Executes (or steps) one verb each time you enter the GO command. |
|
GO or GO key |
Executes one verb and redisplays the Intercept panel. This occurs each time you enter GO, until the step count is turned off. This process lets you monitor the flow of control through the program. |
Assume that statement 050600 has been reached and you want to execute the program until this loop is reentered without entering GO commands for each statement. To reset the program to normal execution, you must turn off the step count and enter the GO command once more:
|
STEP 0 |
Turns off the step count (sets it to zero). |
|
GO or GO key |
Executes the program normally until statement 049400 is reached again. The Intercept panel displays, the title line reads UNCOND BEFORE INTERCEPT. Statement 049400 is highlighted. |
Note: As an alternative to using the STEP 1 command in conjunction with the GO command, you can use the NEXT command. This command executes up to the next verb.
Many S0C4 abends are caused by a subscript exceeding its expected range (overflowing). This causes unrelated data in a program to be overlaid or garbled. The application can stop a program when a particular data item contains or exceeds a value or another data item. This is done by setting a conditional breakpoint using the WHEN command.
For example, assume that subscript SUBS1 is exceeding its range (1 through 30). To stop the program at the statement where SUBS1 exceeds 30, enter the following command:
WHEN SUBSCRIP SUBS1 GT 30
This command stops the program when SUBS1 is greater than 30. The character string SUBSCRIP in the command is the name assigned to the WHEN condition. It is displayed in the title of the W when‑name Intercept panel whenever this condition is encountered; for example, the title of the Intercept panel reads:
WHEN SUBSCRIP BEFORE INTERCEPT
The when‑name identifies which WHEN condition was encountered. The when‑name can also be a statement number. For example, assume that SUBS1 is updated in statement 15200 and that SUBS1 exceeds its range.
Enter the WHEN condition as follows:
WHEN 15200 SUBS1 GT 30
This way the condition will only be checked when the specified statement number is being executed.
|
Copyright © 2013 CA.
All rights reserved.
|
|