Debugging Lines [ HP COBOL II/XL Reference Manual ] MPE/iX 5.0 Documentation
HP COBOL II/XL Reference Manual
Debugging Lines
A debugging line is any line with a "D" in column 7. It is only
permitted in the program after the OBJECT-COMPUTER paragraph.
A debugging line will be considered to have all the characteristics of a
comment line, if the WITH DEBUGGING MODE clause is not specified in the
SOURCE-COMPUTER paragraph. Any debugging line that consists solely of
spaces from margin A to margin R is treated the same as a blank line.
The contents of a debugging line must be such that a syntactically
correct program is formed with or without the debugging line.
Successive debugging lines are allowed. Continuation of debugging lines
is permitted, except that each continuation line must contain a "D" in
column 7, and character strings may not be broken across two lines.
The ANSI Debug Module Example
001000 IDENTIFICATION DIVISION.
001100 PROGRAM-ID. EXAMPLE.
001200 ENVIRONMENT DIVISION.
001300 CONFIGURATION SECTION.
001400 SOURCE-COMPUTER. HP3000 WITH DEBUGGING MODE.
001500 OBJECT-COMPUTER. HP3000.
001600 DATA DIVISION.
001700 WORKING-STORAGE SECTION.
001800 01 GRP.
001900 05 N-1 PIC S9(4) VALUE 0
002000 SIGN IS LEADING SEPARATE.
002100 05 N-2 PIC S9(4) VALUE 0
002200 SIGN IS LEADING SEPARATE.
002300 05 N-3 PIC S9(4) COMP-3.
002400 PROCEDURE DIVISION.
002500 DECLARATIVES.
002600 DEBUG-SEC SECTION.
002700 USE FOR DEBUGGING ON ALL PROCEDURES.
002800 DEBUG-PAR-1.
002900 DISPLAY SPACE.
003000 DISPLAY "CURRENT PARA/SEC IS " DEBUG-NAME.
003100 DISPLAY "CONTROL FLOW WAS " DEBUG-CONTENTS.
003200 END DECLARATIVES.
003300 SEC-1 SECTION 01.
003400 BEGIN-HERE.
003500 DISPLAY "ENTER N-1, 4 DIGITS".
003600 ACCEPT N-1 FREE.
003700 DISPLAY "N-1 = " N-1.
003800 PERFORM PAR-2.
003900 STOP RUN.
004000 PAR-2.
004100 DISPLAY "ENTER N-2, 4 DIGITS".
004200 ACCEPT N-2 FREE.
004300 DISPLAY "N-2 = " N-2.
004400 MOVE N-2 TO N-3.
004500D DISPLAY "N-3 = " N-3.
Using the ANSI Debug Module Example
The above program displays the value of DEBUG-NAME and DEBUG-CONTENTS at
the start of each section and paragraph. Note the use of the following
source lines:
1. Source line 001400 - the WITH DEBUGGING MODE clause enables
compilation of the debugging procedures and lines.
2. Source line 002700 - the USE FOR DEBUGGING ON ALL PROCEDURES
sentence enables control within the Declaratives portion of the
program and upon execution of ALL section and paragraph
procedures.
3. Source line 004500 - the D, in column 7, declares a Source Debug
Line. Debug lines are useful to display specific identifiers
whenever the program is compiled with the WITH DEBUGGING MODE
clause. When the clause is not specified, the lines are treated
as comments.
To activate the debugging procedures at run time, the object-time switch
must be set to 1. For example,
:RUN progname;PARM=1
CURRENT PARA/SEC IS SEC-1
CONTROL FLOW WAS START PROGRAM
CURRENT PARA/SEC IS BEGIN-HERE
CONTROL FLOW WAS FALL THROUGH
ENTER N-1, 4 DIGITS
123
N-1 = +0123
CURRENT PARA/SEC IS PAR-2
CONTROL FLOW WAS PERFORM LOOP
ENTER N-2, 4 DIGITS
-1
N-2 = -0001[REV BEG]
N-3 = -0001[REV END]
END OF PROGRAM
MPE/iX 5.0 Documentation