Caché ObjectScript Reference
ZZPRINT
[Back] 
   
Server:docs2
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

Displays one or more source code lines from a routine.
Synopsis
ZZPRINT:pc "entry+offset^routine":before:after
Arguments
pc Optional — A postconditional expression.
entry Optional — The name of an entry (label) within routine. If omitted, ZZPRINT begins at the start of routine (line 0).
offset Optional — An integer specifying the number of lines to offset from entry (if specified), or from the beginning of routine (if entry is omitted). An offset requires the plus sign (+) prefix. Commonly offset is a positive integer. An offset can be a negative number; for example, "subsect+-3^mytest", which displays the line 3 lines prior to subsect. If offset is omitted, display begins at start of entry.
routine The routine from which to display source code lines. A routine name is always preceded by a caret (^) prefix.
before Optional — A positive integer count specifying the number of lines before the line specified in "entry+offset^routine" to display. Does not include the "entry+offset^routine" line.
after Optional — A positive integer count specifying the number of lines after the line specified in "entry+offset^routine" to display. Does not include the "entry+offset^routine" line.
Description
The ZZPRINT command displays one or more source code lines from a specified Caché ObjectScript routine. It can display a designated line of code and a specified number of lines that appear before and/or after that designated line of source code, enabling you to see it in context. The entry value specifies a starting point for display. However, ZZPRINT does not limit its display to the specified entry; offset, before, and after may include source code lines in prior or subsequent entries.
The displayed lines include all labels, comments, and whitespace, with the exception of entirely blanks lines. A blank line, whether in code or within a multiline comment, is neither displayed nor counted. For this reason, ZZPRINT displays and counts the following multi-line comment as two lines, not three:
   /* This comment includes

      a blank line */ 
ZZPRINT does not count or display preprocessor statements.
Command Delimiters and Blank Space Requirements
The delimiting quotation marks (" ") are required. The opening quotation mark must appear exactly one space after the command name or postconditional expression. Any number of spaces can appear following the opening quotation mark or proceeding or following the closing quotation mark.
The caret (^) prefix to the routine name is required. If you specify an offset, any number of spaces can precede the caret prefix. If you do not specify an offset, there must be no spaces between the entry name and caret prefix to the routine name.
The plus sign (+) is required to specify an offset. The plus sign must immediately follow the entry name (if specified). A plus sign not immediately followed by an integer represents an offset of zero. For example, a plus sign immediately followed by the caret (^) prefix, by a space, or by a non-number character all represent an offset of zero. A plus sign immediately followed by a integer represents a positive offset. A plus sign immediately followed by a negative integer represents a negative offset.
A colon (:) delimiter is required to specify a before line count. To specify an after line count you must specify both colon delimiters, whether or not you specify a before value. Any number of spaces are permitted before or after these colon delimiters.
Arguments
pc
An optional postconditional expression. Caché executes the command if the postconditional expression is true (evaluates to a nonzero numeric value). Caché does not execute the command if the postconditional expression is false (evaluates to zero). For further details, refer to Command Postconditional Expressions in Using Caché ObjectScript.
entry
The name of an entry within routine. Entry names are case-sensitive. If routine does not contain the specified entry, Caché generates a <NOLABEL> error.
offset
An integer specifying the number of lines to offset from the beginning of entry (if specified), or the beginning of routine. Omitting offset is the same as an offset of zero. An offset of zero from entry is the entry label line itself (line 1). An offset of zero from routine is the (nonexistent) line prior to the beginning of the routine (line 0). Therefore, to display a comment line at the beginning of a routine, you must specify an offset of 1 ("+1^mytest").
Offset counts include all source code lines except preprocessor statements and completely blank lines. These are neither displayed nor counted. An offset that exceeds the available lines in routine when counting from the specified (or implied) entry point returns a null string.
routine
The name of the routine from which to display source code lines. Routine names are case-sensitive. If the specified routine does not exist, Caché generates a <NOROUTINE> error.
You must have read permission for routine to be able to ZZPRINT it. If you do not have this permission, Cache generates a <PROTECT> error.
before
A positive integer specifying the number of lines to display before the specified line. This enables you to view a source code line in the context of the lines immediately prior to it. This is a count of lines backwards from a designated program line. The before count does not include the program line designated by "entry+offset^routine". If the before count is larger than the number of available code lines, ZZPRINT displays the available code lines; it does not issue an error.
after
A positive integer specifying the number of lines to display after the specified line. This enables you to view a source code line in the context of the lines immediately following it. This is a count of lines forwards from a designated program line. The after count does not include the program line designated by "entry+offset^routine". If the after count is larger than the number of available code lines, ZZPRINT displays the available code lines; it does not issue an error.
When you specify an after value, you can specify or omit a before value:
See Also