Skip to main content

Argumentless WRITE

Argumentless WRITE

Argumentless WRITE lists the names and values of all defined local variables. It does not list process-private globals, global variables, or special variables. It lists defined local variables one variable per line in the following format:

varname1=value1
varname2=value2

Argumentless WRITE displays local variable values of all types as quoted strings. The exceptions are canonical numbers and object references. A canonical number is displayed without enclosing quotes. An object reference (OREF) is displayed as follows: myoref=<OBJECT REFERENCE>[1@%SQL.Statement]; a JSON array or JSON object is displayed as an object reference (OREF). Bit string values and List values are displayed as quoted strings with the data value displayed in encoded form.

The display of numbers and numeric strings is shown in the following example:

  SET str="fred"
  SET num=+123.40
  SET canonstr="456.7"
  SET noncanon1="789.0"
  SET noncanon2="+999"
  WRITE
canonstr=456.7
noncanon1="789.0"
noncanon2="+999"
num=123.4
str="fred"

Argumentless WRITE displays local variables in case-sensitive string collation order, as shown in the following WRITE output example:

A="Apple"
B="Banana"
a="apple varieties"
a1="macintosh"
a10="winesap"
a19="northern spy"
a2="golden delicious"
aa="crabapple varieties"

Argumentless WRITE displays the subscripts of a local variable in subscript tree order, using numeric collation, as shown in the following WRITE output example:

a(1)="United States"
a(1,1)="Northeastern Region"
a(1,1,1)="Maine"
a(1,1,2)="New Hampshire"
a(1,2)="Southeastern Region"
a(1,2,1)="Florida"
a(2)="Canada"
a(2,1)="Maritime Provinces"
a(10)="Argentina"

Argumentless WRITE executes control characters, such as Formfeed ($CHAR(12)) and Backspace ($CHAR(8)). Therefore, local variables that define control characters would display as shown in the following example:

  SET name="fred"
  SET number=123
  SET bell=$CHAR(7)
  SET formfeed=$CHAR(10)
  SET backspace=$CHAR(8)
  WRITE
backspace="
bell=""
formfeed="
             "
name="fred"
number=123

Multiple backspaces display as follows, given a local variable named back: 1 backspace: back="; 2 backspaces: back""; 3 backspaces: bac"="; 4 backspaces: ba"k="; 5 backspaces: b"ck="; 6 backspaces: "ack="; 7 or more backspaces: "ack=".

An argumentless WRITE must be separated by at least two blank spaces from a command following it on the same line. If the command that follows it is a WRITE with arguments, you must provide the WRITE with arguments with the appropriate line return f format control arguments. This is shown in the following example:

   SET myvar="fred"
   WRITE  WRITE          ; note two spaces following argumentless WRITE
   WRITE  WRITE myvar    ; formatting needed
   WRITE  WRITE !,myvar  ; formatting provided

Argumentless WRITE listing can be interrupted by issuing a CTRL-C, generating an <INTERRUPT> error.

You can use argumentless WRITE to display all defined local variables. You can use the $ORDER function to return a limited subset of the defined local variables.

FeedbackOpens in a new tab