Created On:  21 December 2010

Problem:

COBSQ0080E STRING VARIABLE WS-QUERY-LENGTH IS NOT 'VARCHAR' TYPE.   :

The following  code fails during compilation in MFEEE 3.1

      *  ----------------------------------
      *  | Query from caller copied here. |
      *  ----------------------------------
       01  WS-QUERY.
           49  WS-QUERY-LENGTH               PIC S9(4) COMP.
           49  WS-QUERY-DATA                    PIC X(32767).


  EXEC SQL PREPARE DYNSQL FROM :WS-QUERY END-EXEC

Compiling progname.CBL...
COBSQ0080E STRING VARIABLE WS-QUERY-LENGTH IS NOT 'VARCHAR' TYPE.   : C:\\location\\progname.CBL(nnn,nn)
Compilation complete with 1 errors, 0 warnings, 0 notices and an exit code of 8

Build finished with 1 errors, 0 warnings, and 0 notices.
Completed in 1 seconds

Resolution:

This same code compiled correctly in MFE 3.0

But if the value is changed to 32704 from 32767

      *  ----------------------------------
      *  | Query from caller copied here. |
      *  ----------------------------------
       01  WS-QUERY.
           49  WS-QUERY-LENGTH               PIC S9(4) COMP.
           49  WS-QUERY-DATA                    PIC X(32704).

the program compiles correctly.

The precompiler has been updated to define COBOL VARCHAR host variables as any variable with lengths <= 32704.

You can use other types of host variables in PREPARE statement that are > 32K
Incident #2489314