Previous Topic Next topic Print topic


Evaluate

Use

Evaluates and prints the resultant value of expressions.

Command Syntax

display mode
One of ASCII, BIT, FLOAT, HEX, INTEGER, or OCTAL
expression
Can be any expression that may occur in the source language program, including references to simple as well as aggregate (such as array, record, and structure elements) type variables.

Description

The EVALUATE command evaluates and prints the value of expressions in the source language program. If the expression is omitted, Evaluate uses the previous expression that was evaluated. If no previous expression was evaluated, an error message generates.

The value of simple variables may be changed using the LET command. Array evaluation and array slice evaluation is also supported.

The display mode is the mode in which the value of the expression is to be printed. The valid display modes are Ascii, Bit, Float, Hex, Integer, and Octal. The display modes are defined in the table below.

Display
Mode Definition
AScii Displays the value as a series of Ascii characters.
Bit Displays each bit in the value as a 1 or a zero.
Float Displays the value as a single-precision floating-point number.
Hex Displays the value as a series of hexadecimal numbers.
Integer     Displays the value as a series of signed decimal numbers.
Octal Displays the value as a series of unsigned octal numbers.
Note: CodeWatch allows evaluation of Widechar and Graphic variables only. Evaluation of Widechar and Graphic expressions is currently not supported.

For WIDECHAR variable evaluation, half byte-pairs outside the ASCII range display as a '.' character. Use the EVALUATE command with the /h option to display hexadecimal values for each byte-pair. For example:

dcl wc wchar (8) init('003900370038'Wx);

…

eval /h wc

WC = 00 39 00 37 00 38 00 20 00 20 00 20 00 20 00 20 (hex)  {widechar (8)}

dcl gc graphic (8)  init(‘82588256825781408140814081408140’Gx);

…

eval /h gc

GC = 82 58 82 56 82 57 81 40 81 40 81 40 81 40 81 40 (hex)  {graphic (8)}

In the above example, the Widechar and Graphic strings correspond to the ASCII string ‘978’. For Graphic, codepage of 932 - SHIFT-JIS – Japanese is assumed. For each, Evaluate without /hex will print the “raw” Widechar or Graphic value to the terminal window.

The SUBSTR and LENGTH built-ins may be applied to variable references as part of EVALUATE.

Example

In this example, the value of data items in the SIFT routine is evaluated.

CodeWatch> EVALUATE THIS_PRIME
THIS_PRIME =         7 {fixed binary (31))

In this example, a cross section of the array PRIMES from 1 to count -1, where count equals 4, is evaluated.

CodeWatch> EVALUATE PRIMES (1 : count - 1)
PRIMES(1) =              1 {fixed binary (31))
PRIMES(2) =              2 {fixed binary (31))
PRIMES(3) =              3 {fixed binary (31))

Restrictions

None.

Previous Topic Next topic Print topic