Totalview® Reference Guide : PART I CLI Commands : Chapter 2 CLI Commands : Command Overview : dassign
dassign
Changes the value of a scalar variable
Format 
dassign target value
Arguments 
target
The name of a scalar variable in your program.
value
A source-language expression that evaluates to a scalar value. This expression can use the name of another variable.
Description 
The dassign command evaluates an expression and replaces the value of a variable with the evaluated result. The location can be a scalar variable, a dereferenced pointer variable, or an element in an array or structure.
The default focus for the dassign command is thread. If you do not change the focus, this command acts upon the thread of interest (TOI). If the current focus specifies a width that is wider than t (thread) and is not d (default), -dassign iterates over the threads in the focus set and performs the assignment in each. In addition, if you use a list with the dfocus command, the dassign command iterates over each list member.
The CLI interprets each symbol name in the expression according to the current context. Because the value of a source variable might not have the same value across threads and processes, the value assigned can differ in your threads and processes. If the data type of the resulting value is incompatible with that of the target location, you must cast the value into the target’s type. (Casting is described in Chapter 13 of the TotalView User Guide.)
Assigning Characters and Strings
If you are assigning a character to a target, place the character value within single-quotation marks; for example, ‘c’.
You can use the standard C language escape character sequences; for example, \n and \t. These escape sequences can also be in a character or string assignment.
If you are assigning a string to a target, place the string within quotation marks. However, you must escape the quotation marks so they are not interpreted by Tcl; for example, \"The quick brown fox\".
If value contains an expression, the TotalView expression system evaluates the expression. See Using the Evaluate Window in the TotalView User Guide for information.
Command alias 
Alias
Definition
Description
as
dassign
Changes a scalar variable’s value
 
Examples 
dassign scalar_y 102
Stores the value 102 in each occurrence of variable scalar_y for all processes and threads in the current set.
 
dassign i 10*10
Stores the value 100 in variable i.
 
dassign i i*i
Does not work and the CLI displays an error message. If i is a simple scalar variable, you can use the following statements:
set x [lindex [capture dprint i] 2]
dassign i [expr $x * $x]
 
f {p1 p2 p3} as scalar_y 102
Stores the value 102 in each occurrence of variable scalar_y contained in processes 1, 2, and 3.