Tip

Using "D" lines for debugging and documentation in COBOL

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.