Chapter Contents

Previous

Next
Command Directory

on

Perform One or More Commands at Specified Locations

ABBREVIATION
o{n}

FORMAT
on HOOK-TYPE [when (EXPRESSION)] [count N] CMD | {CMD-LIST}

DESCRIPTION
The on command enables you to perform one or more debugger commands at various locations in your program.

In other words, you can issue a single debugger command (CMD) or a list of debugger commands ({CMD-LIST}) for the HOOK-TYPE argument. Chapter 3 explains the values you can use for the HOOK-TYPE argument, which is an argument that enables you to specify hook locations. The other arguments are explained here:

when
You can optionally use a when clause to give commands conditionally at hooks.

count N
The count N argument is optional. If count N is specified, the first N - 1 times the hook is reached, the count is decremented. The Nth time it is hit, the command is executed. After the Nth time, the command is executed every time the hook is hit.

If a when clause is present, a hit is counted only if the when expression is true.

A query command, issued before the count drops to 1, displays the current value of count. The word count can be abbreviated to cou{nt}.

CMD
CMD can contain any debugger command and its arguments. Abbreviations are accepted for the command also. (Note that on commands can be nested, as described in the next section.)

CMD-LIST
The CMD-LIST argument contains one or more of the commands and arguments separated by semicolons or new lines. CMD-LIST can contain nested on commands. CMD-LIST is enclosed by braces.

Commands that are part of the CMD-LIST argument can be entered on different lines. Use an open brace at the end of the first line, followed by the list of commands, and then a close brace. Note that if you put commands on separate lines, then the end of a line can be the command separator. You do not need a semicolon.

The following is a list of other points you need to know about the CMD-LIST arguments:

EXAMPLES

on entry print
prints the parameters on entry to all functions.

on main 45 print i, pxyz -->a
prints i and pxyz -->a at line 45 of the main function.

on 53 {print i; dump s str}
prints i and dumps the string pointed to by s at line 53 of the current function.

on (comp23) entry print
prints the parameters on entry to the functions in the comp23 compilation.

on func1 entry {where; print parm1, parm2};
issues a where command and prints parm1 and parm2 on entry to the func1 function.

SYSTEM DEPENDENCIES
Although the on command has no system dependencies, the behavior of commands used with on can have system dependencies. For example, the behavior of the escape, system, and exec commands used as CMD arguments or as part of CMD-LIST is system-dependent. See escape, exec (CMS), on, and system (CMS) for details.

COMMAND CAN BE ISSUED FROM

PROFILE yes
configuration file no
Source window prefix none

SCOPE
The on command uses command scope to supply default identifiers, function names, and section names.

RETURN CODES SET
Successful: request number
Unsuccessful: 0

SEE ALSO


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.