Space announcement This documentation space provides the same content as before, but the organization of the content has changed. The content is now organized based on logical branches instead of legacy book titles. We hope that the new structure will help you quickly find the content that you need.

COUNT


COBOL

PL/I

Assembler

C Language


Description

The COUNT command monitors program execution and reports the number of times a specified statement or range of statements has been executed. You can also set a condition to pause execution when the execution count reaches the specified limit. The count is indicated by a 7-digit counter starting in column 74 on the Source screen.

Input

image2021-2-15_15-11-46.png

COUNT Line Command Syntax

C - Set a count breakpoint on a line
CC - Set count breakpoints on a block of lines

The following are the parameter descriptions for the COUNT command:

location

A place where breakpoints are set or deleted. Valid locations are: statement number, paragraph name, ALL STATE, ALL PARA, ALL FUNC, ALL PROG, ALL SQL, ALL DLI, ALL MQ, or ALL variable-name. You can specify a list separated by spaces or commas, or specify a range; for example, statement-number THRU statement-number. THRU is a required keyword when a range is specified. For additional information on these parameters, see to Notation Rules.

MAX n

Sets a limit on the number of times a statement can be executed, where n is a positive integer.

Usage Notes

ALL Languages

  1. Use the DELETE command or DC line command to remove the counter.
  2. The use of ALL and its keywords sets count breakpoints in the qualified module.
  3. The counter field can be typed over to set a limit. Enter a COUNT command on an instruction, type over the counter with a positive integer, and press Enter. Code Debug TSO accepts the value, displays the current count, and suspends execution when the execution count reaches the limit.
    To exceed the limit, type over the displayed value with a positive integer greater than the current count and press Enter. Code Debug TSO accepts the new value and redisplays the current count.
    To turn off the new value without resetting the count breakpoint, type over the displayed count with zeros. The current count will be redisplayed, but the maximum value will be eliminated.
  4. When a maximum count limit is reached in batch mode testing, the kept variables are updated in the session log. Execution resumes following the session log update as if the COUNT command had been reset.
  5. The qualification syntax is valid with the COUNT command and should be used when applicable. See to Command Qualification Rules.
  6. The SHOW COUNTS command enters a record in the session log of all counted lines for the module.
  7. A counter is effective with any or all other breakpoint commands.
  8. When a count breakpoint is set, a message reports the number of primary and line commands successfully completed. However, if an error is encountered, the message is not displayed until after the error is corrected.
  9. A breakpoint is set if the program attempts to exceed the predetermined limit set by the MAX keyword. A new COUNT MAX command must be issued to raise the limit.

    Important

    The MAX keyword is not valid in review mode.

COBOL

  1. Inline PERFORMs: When running a COBOL program which contains PERFORM VARYING or PERFORM UNTIL, the results displayed by the COUNT command may appear incorrect. The execution and initialization of these statements generates a path through the COBOL code that reflects the Assembler code behind the COBOL program. On occasion, this path will appear to contradict what might normally be expected. Be aware that the counts on the beginning and ending statements of inline PERFORMs are subject to these compiler paths. The focus of the COUNT command output should be the execution counts for all statements between the PERFORM and the END-PERFORM.

PL/I

C Language

  1. Counts can be set only on code lines, not data lines.
  2. Code Debug TSO sets the count on the first code statement on the line. Counts cannot be set at other statements on the same line.

Assembler

  1. A count breakpoint set on an unexpanded macro is incremented each time the first instruction in the macro is executed.
  2. COUNT module-name is not valid.
  3. Relative addressing (+/- calculation factor) and indirect addressing (Rn%/Rn?) are supported with the COUNT command.
  4. The C line command is valid on any supported Assembler instruction except the object of an EX instruction.

Examples

ALL Languages

  1. To maintain counts for certain statements, enter:
       COUNT 42 54 56
  2. To maintain counts for all statements in a range, enter the following on the command line:
       COUNT 45 THRU 53
  3. To maintain counts for all statements in the current module/procedure, enter the following on the command line:
       COUNT ALL STATE
  4. To maintain a count of statement 78 to a maximum of 5 executions, enter:
       COUNT 78 MAX 5;GO

COBOL

  1. To count all paragraphs in a nested program, enter the following on the command line:
       COUNT NESTSUB:ALL PARA

Assembler

  1. To maintain counts for all labels in the current module, enter:
       COUNT ALL LABELS
  2. To maintain counts for label AGAIN in module TRIMAINA, enter:
       COUNT TRIMAINA:AGAIN
  3. To count how often the specified address is executed, enter:
       COUNT 06AE2

PL/I

  1. To maintain a count for the procedure ANALYZE_NEXT_REC:, enter the following on the command line:
       COUNT ANALYZE_NEXT_REC:

C Language

  1. To maintain a count for the function analyze_next_rec, enter the following on the command line:
       COUNT analyze_next_rec

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*