Let

Use

Assigns a value of an expression to a name.

Command Syntax

LET name = expression 

where:

name
Is the name of any variable or destination construct (such as a substring or based reference in PL/I) that occurs in the source language program
expression
Can be any expression allowed by the source language whose value can be converted to the data type of the named variable. You can also assign a hexadecimal literal constant to a variable with an X, XN, Z, A or E expression. For example:
L FCD_ORGANIZATION = '01'x

Description

The LET command assigns a value of an expression to a name. When the expression is evaluated, appropriate type conversions are performed. The resultant value is assigned to the named variable. If the type conversion is illegal, the debugger will issue an error message.

The value of a character string constant can be changed by enclosing the expression within single or double quotation marks, depending on the source language.

In C, assignments are merely expression operators with side effects. Therefore, Evaluate provides the same functionality as Let in other languages.

Breakpoints are disabled during function calls using the LET command. If you want a breakpoint in a called routine to be incurred, use the CALL command.

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

Note: The Graphic and Widechar data types are supported in the LET command. Only variables references are allowed (not full expressions).
dcl wc wchar (8) varying;
dcl  val fixed bin (15) init (978);

…

let wc = i;      /* Codewatch will convert  val to WideChar and assign to wc */
eval /h wc

WC = 00 00 20 00 20 00 20 00 39 00 37 00 38 (hex)  {widechar varying (8)}
eval length(w)

6  {fixed binary (15)}

dcl gc graphic (8) varying;

…

let gc = val  /* Codewatch will val to Graphic and assign to gc */
eval /h gc    

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

e length(gc)
6  {fixed binary (15)}

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.

Example

In this example, the value of MAXV is assigned a new value (MAXV/ 2).

CodeWatch> EVALUATE MAXV
MAXV =             10 {fixed binary (31))
CodeWatch> LET MAXV = MAXV/2
CodeWatch> EVALUATE MAXV
MAXV =              5 [fixed binary (31))

Restrictions

None.