This facility assists in debugging compiled Process Module (PM) objects. PM DEBUG (much like that of a symbolic debugger provided with the operating system and third generation languages) has functions that:
Set up to 16 breakpoints at lines of routines where execution of the PM suspends.- Set up to 16 watch points at fields where a change in value causes execution to suspend and the statement causing the change to be reported.
- Display and clear breakpoints and watch points.
- Display the contents of Declare Section fields, Global Storage (GS) fields, record fields and system fields.
- Set values into any of the above mentioned fields which are modifiable.
- Step through the execution of the PM, statement by statement.
- Trace PM statements as they are executed, showing the text and line numbers or the line number only.
- Display a PM statement or a range of statements.
- Search for the occurrence of a text string in the text of the PM.
PM DEBUG cannot be started if the text of the PM has been removed. This prevents users from viewing a PM that is protected.
If a user wishes to debug a PM with a Code Segment (CS), the COMPOSE facility should be used before starting PM DEBUG. COMPOSE will make the INCLUDE statement a comment and load the text so that the CS becomes part of the PM text.
There are two ways to start PM DEBUG:
1. In order to use PM DEBUG with every PM in the application, use:
*ENABLE PM DEBUG<CR>If the PM DEBUG option is enabled, PM DEBUG always starts when any PM is executed. The default for the PM DEBUG option is disabled.
2. In order to debug a specific PM object, enter the name of the PM and the DBL in which it resides in the system field @DEBUG_PM_NAME:
*SET "PAYCHECKS" TO @DEBUG_PM_NAME<CR>If the system field @DEBUG_PM_NAME has a value in it and the PM DEBUG option is disabled, PM DEBUG still starts when the PM name in the @DEBUG_PM_NAME system field is executed.
Once the PM is executing, PM DEBUG stops at the first executable statement and displays the PM DEBUG prompts. PM DEBUG commands can be entered at this point.
DBG*To disable PM DEBUG, the following:
Enter the command:
*DISABLE PM DEBUG<CR>Clear the System Field @DEBUG_PM_NAME:
*SET "" TO @DEBUG_PM_NAME<CR>
The PM DEBUG commands are described next. The commands are defined in alphabetical order. A summary of commands appears at the end of this section.
PURPOSE: BREAK specifies a line number or a routine name where execution of the PM is to be suspends (breakpoints). When a line with a breakpoint is about to be executed, PM DEBUG suspends execution prints the text of the line and waits for a command. Use the TYPE command to examine fields or the SET command to modify fields in the PM. Optionally, the statement can be executed a specified number of times before breaking.
SYNTAX
B/REAK/ \\{line_number; routine_name}\\ [AFTER integer]
line_number | specifies up to 16 PM line numbers where execution is suspended. |
routine_name | specifies the name of the routine that will cause the PM execution to break (when the routine is executed). |
AFTER integer |
causes PM DEBUG to suspend execution after it has executed the line the specified number of times. At this point, the original count is restored to allow repetition of the sequence again. |
Example
1. Sets breakpoints at PM line 510 and 600.
DBG* BREAK 510,600
2. Sets a breakpoint at line 800 and indicates to stop after every tenth execution.
DBG* B 800 AFTER 10
3. Sets breakpoints at line 90 and to stop only after every fifth execution and at line 200 and to stop only after every fifth execution.
DBG* B 90,200 AFTER 54. Sets breakpoints at lines 100, 200 and at routine PART_LOOK_UP.DBG* BREAK 100, PART_LOOK_UP, 200NOTES: A routine defined in a CS cannot be used as a breakpoint. An attempt to do so will display an error message.
SEE ALSO: CLEAR, SET, TYPE Commands
PURPOSE: CLEAR removes breakpoints or watch points.
SYNTAX
C/LEAR/ {B/REAK/ \\line_number\\; WATCH \\field_name\\; ALL BREAK; ALL WATCH}
B/REAK/ \\line_number\\ |
removes breakpoints at the specified line numbers. |
WATCH \\field_name\\ |
removes watch points for the specified fields. |
ALL BREAK |
removes all breakpoints. |
ALL WATCH |
removes all watch points. |
Example
1. Clears breakpoints at lines 100, 510 and 800.DBG* CLEAR BREAK 100,510,800
2. Clears all breakpoints.
DBG* CLEAR ALL BREAK
3. Clears all watch points.
DBG* CLEAR ALL WATCH
4. Removes the watch points on the fields GROSS, TAX_RATE, and PERCENT.
DBG* CLEAR WATCH GROSS, TAX_RATE, PERCENT<CR>
SEE ALSO: BREAK and WATCH Command
PURPOSE: The FIND command finds any character string in the text of the PM being debugged. (This function is not case sensitive.) The search is done in the specified line range of the PM. The line(s) within the specified range that has the search string is displayed to the terminal.
SYNTAX
F/IND/ line_range "string"
DBG* FIND 5:10 "DATE"DBG* F ^:* "NAME"DBG* FIND .+2 "LOCATION"NOTES: Special characters can be used in the line range specification. Their meanings are explained below:
circumflex (^) - first line
asterisk (*) - last line
period (.) - current line
plus (+n) - to n lines after current position
minus (-n) - from n lines before current position
SEE ALSO: PRINT Command
PURPOSE: GO starts PM execution or continues from the point that PM execution was suspended for a break point or watch point.
SYNTAX
G/O/
Example
*DBG GO<CR>NOTES: The GO and STEP commands are the only commands that can continue execution of the PM after a break.
SEE ALSO: STEP and PRINT Command
PURPOSE: PRINT displays a specified PM line or a specified range of lines.
SYNTAX
FORM 1: displays a single line or a range of lines.
P/RINT/ {line_no; ^; *; .} [ : {line_no; ^; *; .}]
FORM 2: displays a line relative to the breakpoint.
P/RINT/ [{+; -} n]
line_no |
specifies a line number. |
^ (circumflex) |
specifies the first statement. |
* (asterisk) |
specifies the last statement. |
. (period) |
specifies the current breakpoint. |
: (colon) |
indicates a range of lines. |
+ (plus sign) |
specifies the printing of lines after the breakpoint. |
- (minus sign) |
specifies the printing of lines before the breakpoint. |
n |
specifies the number of lines to print (before or after) the breakpoint. |
Example
*DBG PRINT 100 |
Displays line 100. |
*DBG P 20:200 |
Displays from line 20 to 200 inclusive. |
*DBG P ^ |
Displays the first statement. |
*DBG PRINT * |
Displays the last statement. |
*DBG P ^:* |
Displays every line. |
*DBG P ^:1000 |
Displays from the beginning to line 1000. |
*DBG P 100:* |
Displays from line 100 to the last line. |
*DBG PRINT . |
Displays the statement at the current breakpoint. |
*DBG PRINT .:* |
Displays from the current breakpoint to the last line. |
*DBG PRINT .+5 |
Displays the fifth line after the current breakpoint. |
*DBG P .-8 |
Displays the eighth line before the current breakpoint. |
PURPOSE: SET moves the contents of a field (or a literal value) to another field. If an error occurs, the SET command aborts and the contents of the destination field are unchanged.
SYNTAX
SE/T/ value; field_name TO field_name
value |
specifies a literal value that is moved to the destination field. |
field_name |
specifies the name of a field. The field contents are moved to the destination field. |
TO field_name |
specifies the destination field. The destination field must not be a read-only field. |
Example
Example 1: sets 10 to field FI.
DBG* SET 10 to FIExample 2: sets the content of @INTEGER (1) to FN.
DBG* SET @INTEGER(1) to FNNOTES: To assign a constant value to a date field, an integer of form YYYYMMDD must be used. The following command moves August, 5 1991 to the field INV_DATE.
DBG* SET 19910805 TO INV_DATE<CR>The value of a Record Field cannot be set (such as @DS_NAME, @QUALIFIED, and @NEW_RECORDS) to a field with the SET command.
PURPOSE: SHOW displays breakpoint line numbers, watch point field names, source mode setting, and trace mode setting. SHOW can set the trace mode and source mode. SHOW can also display the screen for a specified time without the debug information.
SYNTAX
SH/OW/ [B/REAK/; W/ATCH/; [NO] S/OURCE/; [NO] T/RACE/; SCREEN /FOR/ n
/SECONDS/]
SH/OW/ |
(by itself) shows the source and trace modes that are in effect. |
displays all PM line numbers where breakpoints are set. If a breakpoint was set with an AFTER limit value, then the original limit and the original limit less the number of times the statement has been executed are also displayed. |
|
displays all field names at which watch points are set. |
|
[NO] S/OURCE |
turns on source mode which displays the text of PM lines while in trace mode. The SHOW NOSOURCE option only allows line numbers to be displayed. The default is SHOW SOURCE. This option has an effect only if TRACE is turned on. |
[NO] T/RACE |
turns on trace mode which displays PM lines as they are executed. NO will shut off the trace if it is on. The default is SHOW NOTRACE. |
SCREEN /FOR/ n /SECONDS/ |
displays the screen as it would be without PM DEBUG information. This command suspends the PM DEBUG dialog for the amount of time specified (n SECONDS) and displays the current screen. This is particularly useful for debugging screen programs to determine placement of objects on the screen and overall aesthetics. |
Example
DBG* SHOWSource display is enabledTrace display is disabledDBG* BREAK 3300DBG* SHOW BREAKBreakpoint at line 3300DBG* SH SCREEN 10(If there is an active screen, it will be displayed for 10 seconds then control is returned to the debugger.)
DBG* WATCH HEADCTRDBG* SHOW WATCHWatch point at HEADCTR:DSEE ALSO: BREAK and WATCH Command
PURPOSE: SPAWN creates a sub-process so DCL commands can be executed inside the PM DEBUG facility. Control is returned to the same point in the PM DEBUG facility when the sub-process is finished.
SYNTAX
SPAWN
Example
DBG* SPAWN<CR>NOTES: SPAWN can be used to confirm the existence of files by executing the Digital Command Language (DCL) directory command. Enter LOGOUT at DCL prompt to end the sub-process.
SEE ALSO: GO and STEP Command (earlier in this section)
PURPOSE: STEP executes the next PM line(s). Execution is then suspended again. It is possible to "single-step" through the PM and display or modify fields after each single statement executes.
An optional step value can be specified to execute more than one line at a time before suspending execution again.
SYNTAX
S/TEP/ [n]
n |
is a positive integer constant that specifies the number of statements to execute before breaking PM execution. The default is 1. |
Example
DBG* STEP 5<CR>DBG* S<CR>NOTES: The GO and STEP commands are the only commands that can continue execution of the PM after a breakpoint.
SEE ALSO: GO Command (earlier in this section)
PURPOSE: STOP ends execution of the PM. All files opened by the PM are closed and control returns to ACCENT R. If a Command Module (CM) or System File (SF) was active when PM DEBUG was invoked, execution continues at the next statement in the CM or SF.
SYNTAX
S/TOP/
Example
DBG* STOP
PURPOSE: TYPE displays field values at the terminal.
SYNTAX
T/YPE/ \\field_name\\
field_name | specifies the name(s) of the field(s) to display. |
Example
DBG* TYPE HEADCTRHEADCTR:D = 0NOTES: The value of Record Fields (such as @DS_NAME, @QUALIFIED, and @NEW_RECORDS) cannot be TYPEd.
PURPOSE: WATCH specifies fields where a change in value is reported (watch point). When a different value is stored in the field, PM DEBUG suspends execution. It displays the new value of the field and the PM line that caused the modification.
For character array fields, PM DEBUG breaks and indicates the specific element in the array that has been set to a new value.
SYNTAX
W/ATCH/ \\field_name\\
field_name |
defines a watch point at one or more field names. A maximum of 16 watch points can be set. |
Example
DBG* WATCH HEADCTRDBG* GOBreak in PM execution due to watch point on field:
HEADCTR:D = 1Watch point break caused by:
01260 INCR HEADCTRBreak in PM execution at line 1270
01270 SCREEN PUT_CHARS USING VIEW_ID,@RTRIM PAGEHEAD(ICTR),&HEADCTR,1,@SCN_NOERASE,@SCN_NORMALNOTES: PM DEBUG only breaks when the new value is different from the old value.
If a WATCH is set on a DS field that is read through a GET statement, PM DEBUG breaks and displays the statement following the GET.
A WATCH set on a field of the master or transaction DS will be ignored. PM DEBUG always stops on the next executable statement following a watch point. For this reason, PM DEBUG cannot identify a field that has been modified in the last executable statement.
A watch point cannot be set for Record Fields (such as @DS_NAME, @QUALIFIED, and @NEW_RECORDS).
SEE ALSO: SET, TYPE Commands, GET Statement
Command |
Function |
B/REAK/ \\line_number\\ [AFTER integer] |
Sets a breakpoint at one or more PM line numbers. |
C/LEAR/ ALL (B/REAK/; W/ATCH/) |
Removes all breakpoints or watch points. |
C/LEAR/ B/REAK/ \\line_number\\ |
Removes a breakpoint at one or more PM line numbers. |
C/LEAR/ W/ATCH/ \\field_name\\ |
Removes a watch point at one or more field names. |
F/IND/ line_range "string" |
Searches for the specified string in the specified line range. |
G/O/ |
Starts or resumes PM execution from the point where it suspended. |
P/RINT/ line1 [: line2] |
Displays a line or a range of lines. |
SE/T/ (value; field_name) TO field_name |
Assigns a value to the destination field. |
SH/OW/ |
Shows the source and trace modes that are in effect. |
SH/OW/ B/REAK/ |
Displays line numbers where breakpoints are set. |
S/HOW/ SCREEN /FOR/ n /SECONDS/ |
Displays the screen without PM DEBUG information for a specified length of time. |
SH/OW/
NO S/OURCE |
Determines whether the text of PM lines are displayed while in trace mode. |
SH/OW/
NOT/RACE/ |
Determines whether PM lines are displayed as they are executed. |
SH/OW/ W/ATCH/ |
Displays field names at which watch points are set. |
SPAWN |
Starts a sub-process at the DCL level. |
S/TEP/ |
Causes the next PM line to execute. |
STO/P/ |
Ends execution of the PM. |
T/YPE/ \\field_name\\ |
Displays field values. |
W/ATCH/ \\field_name\\ |
Defines a watch point on one or more fields. |