Native Inspect Manual (H06.13+, J06.03+)
Specifying Variables and Tables
Specifying Variables
To reference a variable that is a unique member of only one record in a COBOL program, you
simply specify the variable name. For example, consider the following declaration in a COBOL
program:
01 REC.
02 VAR NATIVE-2.
02 STR PIC X(9).
As long as the variables are unique within the program unit, you can specify the variable VAR
and STR in any Native Inspect command that accepts a variable name. However, if a variable is
not unique within the program unit (that is, if the same variable name is declared in more than one
record), you must qualify the variable name. Qualify the record name by using the COBOL reserved
word as follows:
• IN.
• OF.
• Period (.) syntax.
For example, consider the following declaration:
01 REC.
02 INT PIC X(10).
02 VAR PIC X(10).
02 REC2.
03 INT PIC X(13).
03 VAR2 PIC X(14).
The variable INT is defined in both REC and REC2. You would specify the variable INT that is
contained in REC2 in any of the following ways:
INT OF REC2
INT IN REC2
REC2.INT
When you use the period (.) syntax, the record name comes first, followed by the variable name.
(This use of the period is Native Inspect syntax, not COBOL syntax.)
When qualifying a non-unique variable name, you must specify only enough qualifiers to make
the variable reference unique. Thus, in the preceding declaration, you need not specify any of the
following:
• INT OF REC2 OF REC.
• INT IN REC2 IN REC.
• REC.REC2.INT.
If you specify a non-unique variable name without qualification or with insufficient qualification,
Native Inspect reports an error.
Specifying Tables
You reference individual table elements by specifying the table name followed by subscripts in
parentheses. For multidimensional tables, the subscripts are separated by commas. For example,
consider the following declaration:
02 TOTAL OCCURS 20 TIMES.
03 TOTAL-A OCCURS 3 TIMES.
The following example refers to a specific element of the two-dimensional table TOTAL-A:
TOTAL-A (4, 2)
In Native Inspect, unlike in a COBOL program, you cannot use spaces as subscript separators.
48 Using Native Inspect With COBOL Programs










