Using "D" lines for debugging and documentation in COBOL

Using "D" lines in COBOL can help debug and document your programs.

Using "D" lines in COBOL can help debug and document your programs.

In all of my COBOL programs, I code an additional print file and 
documenting/debugging statements, such as:
"STRING 'factor 1 = ' FACTOR1 ', factor 2 = ' FACTOR2 ', result = ' RESULTFIELD DELIMITED BY SIZE INTO INFO PERFORM INFO-TRACE" "MOVE 'subprogram XY now being called' TO INFO PERFORM INFO-TRACE" "STRING 'returned from subprogram XY, returncode was ' RETURNCODE DELIMITED BY SIZE INTO INFO" PERFORM INFO-TRACE" and so on. INFO-TRACE is part of copied subroutines and prints the contents of INFO. Additional in each paragraph I code "MOVE paragraph-name TO PARAGRAPH PERFORM PARA-TRACE" PARA-TRACE is another part of copied subroutines to print the Name of the paragraph.To anhance readability the paragraphs are printed at column 1, INFO is printed at column 4.When I test my programs, each of them will print a complete list of all run paragraphs and all of the INFOs I coded, helping to see which decisons the program made, intermediate results and so on. These lists are especially helpful in tests with many subprograms -- each of them generates its own list. All the lines containing these statements I mark with "TRACED" in columns 1-6, and the "USE FOR DEBUGGING" clause is NOT used. After the testing has been done, I change the debug/document statements (including the additional print file and the copied subroutines) using only 1 SEU-command:
"c 'TRACED ' 'TRACE D' 1 7 a" moving the "D" from column 6 to column 7. The next compilation of the program will treat the statements as comments.

If necessary, the statements can again be set in function using the SEU-command "c 'TRACE D' 'TRACED ' 1 7 a" and a new compilation.

This was first published in January 2001

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchEnterpriseLinux

SearchDataCenter

Close