Enterprise COBOL supposedly supports a paragraph-tracing capability, by using
the SOURCE-COMPUTER . . . WITH DEBUGGING MODE statement along with
Declaratives section / USE FOR DEBUGGING in the Procedure Division. The
COBOL-provided system variable Debug-Name is supposed to provide the name of
the paragraph the program is running in, essentially providing a trace of the
paragraphs that were executed.
What I coded is based on the COBOL Programming Guide, Ver 5.1, SC14-7382-00,
page 383, and while the program runs, it does not produce any expected DISPLAY
statements, as coded under DEBUG-DECLARATIVES-PARAGRAPH.
Code is below. It's short.
Perhaps the problem is one of incompatible COBOL compile options. I tried TEST
and NOTEST. OPTIMIZE(0) is set. Or perhaps a missing, but required, DD
statement is needed (except then I would have expected "DD STATEMENT MISSING.")
Or perhaps there's a COBOL installation parameter that disables this
functionality, but I could not find one, if one exists.
If someone has a working example of this, showing the COBOL syntax and compile
options used, I'd appreciate it.
Otherwise, it will remain as one of those COBOL Unsolved Mysteries.
Best -
Richard Zierdt
// EXEC IGYWCLG
IDENTIFICATION DIVISION.
PROGRAM-ID. COBOLDM.
AUTHOR. Testing COBOL's WITH DEBUGGING MODE capability.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. IBM-370 WITH DEBUGGING MODE.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 W Pic 9(9) Value Zero.
01 Total Pic 9(9) Value 1.
01 Trace-Message Pic X(30) Value " Trace for Procedure-Name : ".
PROCEDURE DIVISION.
DECLARATIVES.
DEBUG-DECLARATIVES SECTION.
USE FOR DEBUGGING ON Some-Routine.
DEBUG-DECLARATIVES-PARAGRAPH.
DISPLAY TRACE-MESSAGE, DEBUG-NAME, TOTAL.
END DECLARATIVES.
Main-Program Section.
Perform Paragraph-A
Perform Some-Routine
Perform Some-Routine
Perform Some-Routine
Perform Some-Routine
Perform Paragraph-C
Display 'End of Debug program'
Stop Run.
Paragraph-A.
add 1 to W.
Some-Routine.
add 3 to Total.
Paragraph-C.
Perform Paragraph-D
add 5 to W.
Paragraph-D.
add 7 to W.
//GO.SYSOUT DD SYSOUT=* DISPLAY commands
//MSGFILE DD SYSOUT=* Language Environment (didn't help)
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN