Native Inspect Manual (H06.13+, J06.03+)

print [format] expression
Where:
format
An optional count, format, and size specification. See Syntax of /format (page 63).
expression
Evaluates the expression and assigns its value to a variable.
In COBOL expressions, use COBOL operators, and in C and pTAL expressions, use the standard
C assignment operators, including +=, *=, and \=.
See Syntax of expression (page 62).
Considerations
Other functions of the print command (illustrated in Examples (page 105)) include the
following:
FunctionPrint Command Form
Displays a variable formatted as a specific type (specified by a
C/C++ cast expression)
print (cast-type) variable
Displays a buffer formatted as the specified structure. Equivalent to
the DISPLAY AS command in Inspect.
print {struct} buffer
Displays the specified number of instances of a variable. Example:
print var@2
print variable@elements
Displays a range of array elements.print array [index] @count
Displays a static variable in a specific file or function
print file::variable
print function::variable
Evaluates an expression and assigns the result to a variable. The
expression can be any valid C expression. This command is
equivalent to the following command: set variable var = exp
print var=exp
Calls a procedure, function or subroutine in the process being
debugged.
print func (args)
call func using arg [,arg] ]
To view an appropriately formatted SPI buffer, you must use Visual Inspect instead of Native
Inspect. Native Inspect does not support the formatting of SPI buffers.
For C/C++, character pointers are displayed until a terminating null or the configured maximum
number of elements is displayed. Use the following command to control the maximum number
of elements printed for strings or arrays:
set print elements max-number
For pTAL code, only one character of a pointer to a string is printed. An array of strings is
printed as an array with each different element printed separately. If the elements are all
characters, however, they are printed as one string.
After you enter a print command, you can repeat it by pressing the Enter key at the next Native
Inspect prompt. The effect is the same as if you had entered another print command with the
same parameters. This ability to repeat continues until you enter any other Native Inspect
command.
104 Native Inspect Command Syntax