3. Embedded QUEL for COBOL : COBOL Variables and Data Types : Variable Usage
 
Share this page                  
Variable Usage
COBOL variables (that is, data items) declared to EQUEL can substitute for most elements of EQUEL statements that are not keywords. Of course, the variable and its data type must make sense in the context of the element. The generic uses of host language variables in EQUEL statements are described the QUEL Reference Guide. The following discussion covers only the usage issues particular to COBOL language variable types.
The following retrieve statement uses the variables "NAMEVAR" and "NUMVAR" to receive data, and the variable "IDNO" as an expression in the where clause:
##   RETRIEVE (NAMEVAR = employee.empname,
##         NUMVAR = employee.empnum) WHERE
##         employee.empnum = IDNO
To distinguish the minus sign used as a subtraction operator in an EQUEL statement from the hyphen used as a character in a data item name, you must delimit the minus sign by blanks. For example, the statement:
##   APPEND TO employee (ename="Jones", eno=ENO-2)
indicates that the data item "ENO-2" is to be appended to column "eno". To append a value two less than the value in the data item "ENO" you must instead use the following statement:
##   APPEND TO employee (ename="Jones", eno=ENO - 2)
Note the spaces surrounding the minus sign.