Variable Maintenance

#### Search Results

Search

# Variable Maintenance

This function is used to display and modify variables within the debugger when a Natural object has been interrupted.

For the interrupted Natural object, the Variable maintenance function displays user-defined variables, global variables and the database-related system variables `*COUNTER`, `*ISN` and `*NUMBER` together with Natural data formats, lengths and contents.

This section covers the following topics:

- Display User-Defined, Global and DB-Related System Variables

- Display System Variables

- Modify Variable

## Display User-Defined, Global and DB-Related System Variables

This section provides instructions for invoking either the Display Variables (summary) screen with a list of all variables, or the Display Variable (individual) screen with all details on a particular variable.

- Display Variables - Summary

- Display Variable - Individual

### Display Variables - Summary

To display a summary of user-defined, global and database-related system variables

- In the Debug Main Menu or in the Debug Break window, enter function code `V`.

  Or:
  Enter the following direct command:

      DISPLAY VARIABLE variable,variable,...

The Display Variables (summary) screen provides a list of the variables specified for the interrupted Natural object. Long values may be displayed truncated on the screen. For arrays, only the contents of the first occurrence are displayed.

To switch between alphanumeric and hexadecimal representation of the variable contents, choose PF10 (Alpha) and PF11 (Hex).

To toggle between the truncated display of a variable and the full name display with the group name, variable name and indices (if relevant), choose PF5 (Zoom).

For variable, a system variable can also be specified. See Display System Variables for more information.

### Display Variable - Individual

To display an individual variable in its entirety

- From the Display Variables (summary) screen, select a variable by marking it with the line command `DI`.

  Or:
  Enter the following direct command:

      DISPLAY VARIABLE variable

  Or:
  On the List Object Source screen, in the Source column, position the cursor at a variable name and choose PF18 (Di Va).

  - The following restrictions apply when using PF18 (Di Va):

    If a variable name (including the occurrences of an array) spans more than one line, only the contents of the first line are evaluated.
    If an array name is not followed by an index, the entire array is displayed.
    If the index of an array is constant, for example, array (3,2,6), only this occurrence is displayed.
    If the index of an array is variable, for example, array (i,j) or array (3:i), the variables are evaluated before the respective occurrences of the array are displayed.

  Or:
  On the List Object Source screen, in the Source column, position the cursor at a variable name and choose ENTER.

  - When using ENTER, the same restrictions apply as for PF18, see above. However, the variable or array occurrence is displayed in a window instead of using the Display Variable (individual) screen, if the index for an array does not denote more than one occurrence. If the index for an array denotes more than one occurrence, data is displayed using the Display Variable (individual) screen.

  Or:
  Instead of positioning the cursor manually and choosing ENTER you can also use Entire Connection for ease of use. Here, a double click with the left mouse button positions the cursor and simulates the ENTER key.

The Display Variable (individual) screen, or a window appears with all relevant specifications for the particular variable.

If data is displayed using a window and the length of the contents of the variable exceeds 256 bytes, only the first 256 bytes are displayed. For the Display Variable (individual) screen there is no such limit and you can navigate through the entire contents of the variable as described in the instructions below.

To display the entire contents of the variable or navigate within the contents

- Choose PF22 to page backward or PF23 to page forward.

  Or:
  In the Position field, enter a numeric value to start the display at a particular position.

You can choose PF10 (Alpha) and PF11 (Hex) to switch between alphanumeric and hexadecimal representation of the variable contents.

To display all occurrences of an array using screen functions

- From the Display Variables screen, select a variable by marking it with the line command `DI`.

  Or:
  Choose PF7 (-) and PF8 (+) to page between the individual occurrences.

To display one or more occurrences of an array using direct commands

- Use the following direct command:

      DISPLAY VARIABLE variable-name(index-specification)

  where `variable-name` denotes the name of the variable, and `index-specification` denotes any of the following: an index notation, an index range, or asterisk (*) for all occurrences of a dimension. Variables that are part of the index-specification are evaluated before the respective occurrences are displayed.

  Examples:

  `DISPLAY VARIABLE ARRAY1(*)` | One-dimensional array: Displays all occurrences of the one-dimensional array `ARRAY1`.
  `DISPLAY VARIABLE ARRAY1(1)` or `DISPLAY VARIABLE ARRAY1` | One-dimensional array: Displays the first occurrence of the one-dimensional array `ARRAY1`.
  `DISPLAY VARIABLE ARRAY2(2,3:4)` | Two-dimensional array: Displays the second occurrence of the first dimension and the index notation of the second dimension of the two-dimensional array `ARRAY2`.
  `DISPLAY VARIABLE ARRAY3(1,3:4,*)` | Three-dimensional array: Displays the first occurrence of the first dimension, the index notation of the second dimension, and all occurrences of the third dimension of the three-dimensional array `ARRAY3`.
  `DISPLAY VARIABLE ARRAY4(I,J + 1)` | Two-dimensional array: Displays the occurrence of the two-dimensional array `ARRAY4` specified by the value of variable`I` and the value of the expression`J + 1`.

## Display System Variables

To display system variables (except database-related system variables)

- Enter the following direct command:

      SYSVARS

  The System Variables screen appears with a limited set of system variables.

To display a single system variable

- Use the following direct command:

      DISPLAY VARIABLE system-variable-name

  where system-variable-name is the name of the system variable which can also be displayed using the SYSVARS direct command.

For variables of the type Handle, the name of the class of the instance that the Handle refers to is displayed in alphanumeric representation. If the class name is not available, the Globally Unique Identifier (GUID) is displayed instead. If the class was defined within Natural, the class name or GUID is suffixed with `(NAT)`.

The contents of properties of an instance of a class cannot be displayed within the debugger.

## Modify Variable

This function does not apply to system variables.

This function is used to change the value of user-defined and global variables and the database-related system variables.

To modify the contents of a variable from the Modify Variable screen

1. Invoke the Modify Variable screen by marking the variable with the line command `MO`.

   Or:
   On the Display Variable screen, choose PF5 (Mod).

2. On the Modify Variable screen, in the Contents field, change the value of the variable.

   The new contents must be valid for the Natural data format of the modified variable since the format of a variable cannot be modified within the debugger.

   On the Modify Variable screen, you can toggle between alphanumeric and hexadecimal representation of the variable value using PF10 (Alpha) and PF11 (Hex).

To modify the contents of a variable via direct command

- Enter the following direct command:

      MODIFY VARIABLE variable = new value

  A message appears that confirms modification of the variable value.

Note
The Modify Variables function or the `MODIFY VARIABLE` command can be disallowed by Natural Security as described in Components of an Environment Profile in the Natural Security documentation.

### On this page

- Display User-Defined, Global and DB-Related System Variables
- Display System Variables
- Modify Variable