COBTEST COBTEST is a debugging tool available for use with COBOL programs. THE FOLLOWING IS A BRIEF INTRODUCTION TO THE MOST COMMONLY USED COMMANDS FOLLOWED BY MORE DETAILED INFORMATION ON COBTEST COMMANDS. MORE INFORMATION CAN BE FOUND IN THE MANUAL APPLICATION PROGRAMMING DEBUGGING. ENTERING AND EXITING COBTEST To debug a program with COBTEST you must first compile the program with the TEST compiler option and then run it as follows, assuming the program is named PROG1: 1. COBOL PROG1 (TEST to compile the program. 2. At the E)XIT, C)MS SUBSET, SET PROGRAM A)RGUMENTS, OR R)UN? type E for EXIT. 3. Enter your FILEDEF'S. 4. COBTEST PROG1 to execute the program. 5. Several lines of license information will be displayed. COBTEST will scan through your program and stop at the first verb. It will display a prompt giving the location of the verb in your program followed by COBTEST (which is the standard COBTEST prompt): PROG1.000231.1 COBTEST This indicates that COBTEST is at the first verb in line 231 of the program with a PROGRAM-ID of PROG1. 6. You can now enter individual commands and proceed with debugging your program, as described in the following pages. 7. IF YOUR PROGRAM IS ABENDING, YOU CAN FIND OUT THE LINE NUMBER by typing GO. When you get your abend message, it will be followed by another location message. For example, the message 000285.1 means that the program is abending on line 285. To see what values are in all your variables at the time the program abends, type LIST ALL. Then page through the output to see the values in the variables. Looking at these values will help you decide if it is ABENDING ON THE FIRST RECORD, THE LAST RECORD, ETC. ALTERNATELY, TO SEE WHAT IS IN A PARTICULAR VARIABLE, TYPE LIST X WHERE X IS THE NAME OF THE VARIABLE YOU WANT TO SEE. 8. TO SEE WHAT PARAGRAPHS YOUR PROGRAM IS EXECUTING, TYPE TRACE NAME, THEN ISSUE THE GO COMMAND. THIS COMMAND TOGETHER WITH DISPLAY STATEMENTS IN YOUR PROGRAM IS HELPFUL IN TRACKING DOWN WHAT YOUR PROGRAM IS DOING. TO GET A PRINTOUT FOR FURTHER ANALYSIS, GIVE THE COMMAND TRACE NAME PRINT FOLLOWED BY A GO. 9. WHEN YOU ARE THROUGH WITH COBTEST, TYPE THE COMMAND QUIT. COBTEST COMMANDS AT The AT command establishes breakpoints at one or more COBOL verbs in your program. When an AT breakpoint is reached the system will print a message to identify the program name, statement number, and verb number of that breakpoint. Several breakpoints can be in effect at once. Format: AT line-number.verb-number Example: AT 500.1 After a GO, execution will stop on the first verb on line 500. If no verb number is given it defaults to 1. Example: AT 500.1 (LIST EOF-FLAG) This command will stop at line 500 each time it is executed and print out the value of EOF-FLAG. Example: AT 100 (LIST (NAME-IN, CODE-IN, SALARY-IN)) Same as above, except that more than one variable is printed by enclosing the variable list in parenthesis. NOTE: Display statements in your program will also print out the value of variables. GO The GO command starts or resumes the execution of your program. It will continue to execute until it reaches a breakpoint, the end of the program, or there is an ABEND. If an ABEND occurs the line number and verb number that caused the ABEND will be displayed. Format: GO line-number.verb-number Example: GO Example: GO 352.2 Start execution with the second verb on line 352. If no verb number is given it defaults to 1. If no line number is given it defaults to the current line. HELP The HELP command provides information about the function, syntax, and operands of all debug tool commands. LIST The LIST command displays the values of selected items of storage. Format: LIST item Example: LIST RATE Display the contents of RATE. LIST ALL Display the contents of all variables. LIST (TAX,AMT) Display the contents of TAX and AMT. LIST (PAY,'THIS IS FEE',FEE) Display the contents of PAY, the literal THIS IS FEE, and then the contents of FEE. NEXT The NEXT command sets a temporary breakpoint at the first verb that will be executed when program execution is resumed. Format: NEXT ( or just N) Example: N After a GO, execute the next verb and then stop. OFF The OFF command removes one or more breakpoints that have been set with the AT command. Format: OFF line-number.verb-number Example: OFF Remove all AT breakpoints OFF 362 Remove the AT breakpoint at the first verb in line 362 OFF 254,644 Remove the AT breakpoints at line 254 and at line 644. OFFWN The OFFWN command removes one or more breakpoints that were established by the WHEN command. Format: OFFWN when-name Example: OFFWN NUM1 Removes the WHEN breakpoint called NUM1. OFFWH NUM1,SEC Removes the WHEN breakpoints called NUM1 and SEC OFFWN Removes all the WHEN breakpoints. QUIT The QUIT command terminates your debugging session. RESTART The RESTART command deletes and reloads the program, thereby causing reinitialization of program variables. It does NOT erase the breakpoints. Format: RESTART Example: RESTART Reinitialize all variables and make the first line of the PROCEDURE DIVISION the current line. STEP The STEP command causes the execution of a specific number of COBOL verbs. Format: STEP number Example: STEP 12 Execute the next 12 verbs in the program. If no number is given it defaults to 1. TRACE The TRACE command shows the flow of program execution by displaying the line and verb number of a paragraph or the first statement of a logical group as they are executed. A logical group is a sequence of statements where there is a possible change in the program logic: e.g., the path followed in an IF-THEN-ELSE, EVALUATE, etc. Format: TRACE parameter Example: TRACE NAME After a GO, the paragraph names will be displayed as they are executed. Example: TRACE NAME PRINT Same as above, but sends trace output to printer. Example: TRACE OFF Discontinue the previous TRACE. WHEN The WHEN command enables you to specify one or more conditions that will cause a break in the execution of the program. Since several WHEN's may be active at once, each must have a user supplied name of four characters or less. May use =, >, <, >=, <=, NE Format WHEN when-name item Example WHEN NUM1 TAX=14 After a GO, execution will stop when the value of TAX equals 14. (NUM1 is the when-name.) WHEN NUM1 RATE After a GO, execution will stop when the value of RATE changes WHEN ZERO (SUM = 0) (LIST (A, B, C)) After a GO, will stop when SUM = 0 and will display the values of the variables listed. WHERE Gives the next line number to be executed Format WHERE