Syntax for non-Language Environment COBOL expressions
You can use the syntax defined in this section to write expressions
for Debug Tool commands while you debug non-Language Environment COBOL programs.
In general, whenever you enter a non-Language Environment COBOL expression
as part of a command (for example, as the operand of the LIST expression command,
an assignment command, or the IF command), you must enclose
the non-Language Environment COBOL expression in apostrophes (').
The following example shows the appropriate use of apostrophes:
LIST 'A-B IN C';
'A' = 'B';
IF 'A = 22' THEN...
There are some Debug Tool commands that can be used for debugging non-Language Environment COBOL
programs that use the assembler syntax. A note to this effect is found
in the section describing each of these commands. For example, while
debugging a non-Language Environment COBOL program you might use the following
command:
STORAGE(X"1B4C0",3) = X"0102FC";
Restrictions on non-Language Environment COBOL expressions
In addition to the requirement that non-Language Environment COBOL
expressions be enclosed in apostrophes ('), the following restrictions
apply to non-Language Environment COBOL expressions:
- The following operators are supported by Debug Tool in non-Language Environment COBOL
expressions:
- IN or OF
- Subscript / index
- LENGTH OF
- +, -, *, /
- // (remainder)
- || (concatenation)
- ( )
- In a subscript or index list, the subscript or index expressions
must be separated by a comma. A space is not sufficient for separating
subscript or index expressions.
- Lower-case letters are accepted in contexts other that non-numeric
literals as a substitute for (and equivalent to) upper case letters.
- Debug Tool does not support the use of COBOL special registers (for
example, DAY, DATE, and TIME) in non-Language Environment COBOL expressions.
- All non-numeric literals must be enclosed in quotation marks (").
Apostrophes (') cannot be used.
- You cannot list or alter level-88 variables in non-Language Environment COBOL.
- Only the following subset of figurative constants are supported
in Debug Tool non-Language Environment COBOL expressions:
- HIGH-VALUE, HIGH-VALUES
- LOW-VALUE, LOW-VALUES
- QUOTE, QUOTES
- SPACE, SPACES
- ZERO, ZEROES, ZEROS
Common syntax elements
You can use the following syntax elements to write a non-Language Environment COBOL
expression:
- ddd or ddd.ddd
- A decimal constant, where ddd are valid decimal digits. For
example: 145 or 12.72.
- X"xxxxx"
- A hexadecimal constant, where xxxx are valid hexadecimal digits.
For example:
X"1F4C"
- "cccc"
- A non-numeric literal. For example:
"F$3"
- symbol
- A valid symbol used in the non-Language Environment COBOL source
program. Examples:
LASTNAME
USERVAR8
12CENTS
Debug Tool implicitly defines the _STORAGE symbol in all
non-Language Environment COBOL programs as a symbol representing all of
main memory. You can reference any area of memory by using the _STORAGE
symbol with the substring notation defined in Operators that can be used in any expression.
For example, _STORAGE(X"1FF3C"::4) references the four bytes of storage
at address X"1FF3C". The substring notation used by the _STORAGE symbol
specifies an actual address; therefore, to reference the first byte
of storage, use a 0 instead of a 1 in the substring notation.
- %symbol
- A valid Debug Tool variable or built-in function. For example:
%ADDRESS
%HEX(expression)
Operators
You can use the operators defined in this section to write non-Language Environment COBOL
expressions and conditional non-Language Environment COBOL expressions.
Operators that can be used in any expression
Use the operators defined in this section to write non-Language Environment COBOL
expressions.
- +
- Addition
- -
- Subtraction or prefix minus
- *
- Multiplication
- /
- Division
- //
- Remainder
- ||
- Concatenation (non-arithmetic operands only)
- (...)
- Parenthesis to control the order of operation, specify the subscript
of an array, or select a substring.
- symbol(subscript,subscript,...)
- Parenthesis to specify a subscript or index for an array. Note
that commas are required between subscript or index values. Blanks
alone are not acceptable.
- symbol(substrstart:substrend)
- Parenthesis to select a substring of the bytes from substrstart
to substrend from a character variable.
- symbol(substrstart::substrlen)
- Parenthesis to select a substring of substrlen bytes beginning
at substrstart from a character variable.
For an array of character strings, these forms can be combined
by using symbol(subscript,substrstart:substrend), or symbol(subscript,substrstart::substrlen).
- LENGTH OF
- Returns the length of a symbol. For example, LENGTH OF ABC returns
the length of the symbol ABC.
Operators that can be used only in conditional expressions
The following operators can be used only in conditional expressions
(for example, the IF command):
- =
- Compare the two operands for equality.
- ¬=
- Compare the two operands for inequality.
- <
- Determines whether the left operand is less than the right operand.
- >
- Determines whether the left operand is greater than the right
operand.
- <=
- Determines whether the left operand is less than or equal to
the right operand.
- >=
- Determines whether the left operand is greater than or equal
to the right operand.
- &
- Logical "and" operation.
- |
- Logical "or" operation.