This article describes how to avoid DB0108 and SQL0088N errors by fully qualifying host variables.
Problem:
Compiling an SQL program from Net Express or Server Express using the DB2(QUALFIX) directive could result in a DB0108 error using DB2 UDB Version 8 or an SQL0088N error using DB2 LUW when the same variable is defined in more than one structure in a program. For example, compiling the following program under DB2 UDB Version 8 results in an error:
      $set db2(db=sample udb-version=8 QUALFIX)
       01  ws-structure-1.
           05 ws-var-1            PIC X(10).
       01  ws-structure-2.
           05 ws-var-1            PIC X(10).
       procedure division.
       MOVE 5 TO ws-var-1 OF ws-structure-1 *> this works
       MOVE 5 TO ws-var-1 OF ws-structure-2 *> this works too
       EXEC SQL
         SELECT EMPNO
         INTO :ws-var-1
         FROM EMP
         WHERE EMPNO = '200010'
       END-EXEC
       goback
       .
>
* Micro Focus SQL External Compiler Module for IBM DB2 UDB
* Version 4.0.05 (C) copyright 1997-2008 Micro Focus (IP) Ltd.19 END-EXEC
* 801-S******
**
**
** External Compiler Module message
** DB0108 ws-var-1 is non-unique and should be qualified. cob64:error(s) in compilation:
Compiling with DB2 LUW could return an error similar to the following:
*EXEC SQL SELECT LASTNAME * INTO :ws-var-1 * *SQL0088N Host variable "ws-var-1" is ambiguous.
In DB2 UDB Versions 7 and earlier, you could use the QUALFIX directive to make any host variable unique; thus it was not necessary to fully qualify host variables in EXEC SQL statements. However, Net Express 5.1 and Server Express 5.1 no longer support DB2 UDB Version 7 or earlier.
Resolution:
Because Net Express and Server Express support only DB2 UDB Version 8 or later and DB2 LUW, and these versions do not support the QUALFIX directive, you must fully qualify host variables in EXEC SQL statements to avoid errors from the DB2 pre-compiler. For example:
EXEC SQL
         SELECT EMPNO
         INTO :ws-structure-1.ws-var-1
         FROM EMP
         WHERE EMPNO = '200010'
       END-EXEC
Incident Number: 2258188