Skip to main content
I'm receiving the following error and have everything in place, when I searched the internet for the cause of below, I received (below)
Query.CPY (40,21-22) : error COBES0100 : Incorrect SQL statement syntax near: Query
Query.CPY (44,26-31) : error COBCH0233 : Unknown data description qualifier Query
Query.CPY (86,26-36) : error COBCH0233 : Unknown data description qualifier Query-NULL
  COBOL compile: 0 item(s) succeeded or up-to-date, 1 failed.

Incorrect SQL statement syntax near: WITH

PoorPoorFairFairAverageAverageGoodGoodExcellentExcellent

Problem:

The following complex query compiles fine in Net Express:
   EXEC SQL
      DECLARE cursor0 CURSOR FOR
      SELECT col1, col2,
      CASE WHEN ...
         THEN (SELECT COUNT(*) FROM table1 WHERE ...)
         ELSE (SELECT COUNT(*) FROM table1 WHERE...
            AND EXISTS (SELECT * FROM table2 WITH (NOLOCK) WHERE ...)) END,              CASE WHEN ... END
      FROM Table0
   END-EXEC.
When compiling the above in Visual COBOL 2.3 for Visual Studio, the following error occurs:
COBES0100 : Incorrect SQL statement syntax near: WITH

Resolution:

The issue has already been addressed in Visual COBOL 2.3 Hotfix1 that is available at the Product Updates page of the Micro Focus SupportLine site.
The fix is also included in the upcoming release of Visual COBOL 2.3 Update 1.
then when I go to this site, it shows ACCESS DENIED
Is this the correct problem?
I'm receiving the following error and have everything in place, when I searched the internet for the cause of below, I received (below)
Query.CPY (40,21-22) : error COBES0100 : Incorrect SQL statement syntax near: Query
Query.CPY (44,26-31) : error COBCH0233 : Unknown data description qualifier Query
Query.CPY (86,26-36) : error COBCH0233 : Unknown data description qualifier Query-NULL
  COBOL compile: 0 item(s) succeeded or up-to-date, 1 failed.

Incorrect SQL statement syntax near: WITH

PoorPoorFairFairAverageAverageGoodGoodExcellentExcellent

Problem:

The following complex query compiles fine in Net Express:
   EXEC SQL
      DECLARE cursor0 CURSOR FOR
      SELECT col1, col2,
      CASE WHEN ...
         THEN (SELECT COUNT(*) FROM table1 WHERE ...)
         ELSE (SELECT COUNT(*) FROM table1 WHERE...
            AND EXISTS (SELECT * FROM table2 WITH (NOLOCK) WHERE ...)) END,              CASE WHEN ... END
      FROM Table0
   END-EXEC.
When compiling the above in Visual COBOL 2.3 for Visual Studio, the following error occurs:
COBES0100 : Incorrect SQL statement syntax near: WITH

Resolution:

The issue has already been addressed in Visual COBOL 2.3 Hotfix1 that is available at the Product Updates page of the Micro Focus SupportLine site.
The fix is also included in the upcoming release of Visual COBOL 2.3 Update 1.
then when I go to this site, it shows ACCESS DENIED
Is this the correct problem?

Can you please post your actual SQL statement on which the error is occurring so I can test it here?

Thanks.


I'm receiving the following error and have everything in place, when I searched the internet for the cause of below, I received (below)
Query.CPY (40,21-22) : error COBES0100 : Incorrect SQL statement syntax near: Query
Query.CPY (44,26-31) : error COBCH0233 : Unknown data description qualifier Query
Query.CPY (86,26-36) : error COBCH0233 : Unknown data description qualifier Query-NULL
  COBOL compile: 0 item(s) succeeded or up-to-date, 1 failed.

Incorrect SQL statement syntax near: WITH

PoorPoorFairFairAverageAverageGoodGoodExcellentExcellent

Problem:

The following complex query compiles fine in Net Express:
   EXEC SQL
      DECLARE cursor0 CURSOR FOR
      SELECT col1, col2,
      CASE WHEN ...
         THEN (SELECT COUNT(*) FROM table1 WHERE ...)
         ELSE (SELECT COUNT(*) FROM table1 WHERE...
            AND EXISTS (SELECT * FROM table2 WITH (NOLOCK) WHERE ...)) END,              CASE WHEN ... END
      FROM Table0
   END-EXEC.
When compiling the above in Visual COBOL 2.3 for Visual Studio, the following error occurs:
COBES0100 : Incorrect SQL statement syntax near: WITH

Resolution:

The issue has already been addressed in Visual COBOL 2.3 Hotfix1 that is available at the Product Updates page of the Micro Focus SupportLine site.
The fix is also included in the upcoming release of Visual COBOL 2.3 Update 1.
then when I go to this site, it shows ACCESS DENIED
Is this the correct problem?

I've attached the file also with a screen shot of lines 40 & 44, both are listed as errors on the bottom of the shot.  And line 86, shown below.

           EXEC SQL
               WHENEVER SQLERROR perform OpenESQL-Error
           END-EXEC.
      
           EXEC SQL
             CONNECT TO 'Sober'
           END-EXEC.

85     ,A.YOU-AGREE-TERMS

86       INTO

87            :SoberHouse-Query-ID:SoberHouse-Query-ID-NULL

88           ,:SoberHouse-Query-DEP-AMT:SoberHouse-Query-DEP-AMT-NULL

89           ,:SoberHouse-Query-RENT-PAYM:COL-3-NULL


I'm receiving the following error and have everything in place, when I searched the internet for the cause of below, I received (below)
Query.CPY (40,21-22) : error COBES0100 : Incorrect SQL statement syntax near: Query
Query.CPY (44,26-31) : error COBCH0233 : Unknown data description qualifier Query
Query.CPY (86,26-36) : error COBCH0233 : Unknown data description qualifier Query-NULL
  COBOL compile: 0 item(s) succeeded or up-to-date, 1 failed.

Incorrect SQL statement syntax near: WITH

PoorPoorFairFairAverageAverageGoodGoodExcellentExcellent

Problem:

The following complex query compiles fine in Net Express:
   EXEC SQL
      DECLARE cursor0 CURSOR FOR
      SELECT col1, col2,
      CASE WHEN ...
         THEN (SELECT COUNT(*) FROM table1 WHERE ...)
         ELSE (SELECT COUNT(*) FROM table1 WHERE...
            AND EXISTS (SELECT * FROM table2 WITH (NOLOCK) WHERE ...)) END,              CASE WHEN ... END
      FROM Table0
   END-EXEC.
When compiling the above in Visual COBOL 2.3 for Visual Studio, the following error occurs:
COBES0100 : Incorrect SQL statement syntax near: WITH

Resolution:

The issue has already been addressed in Visual COBOL 2.3 Hotfix1 that is available at the Product Updates page of the Micro Focus SupportLine site.
The fix is also included in the upcoming release of Visual COBOL 2.3 Update 1.
then when I go to this site, it shows ACCESS DENIED
Is this the correct problem?

Here is the code along with errors I received.

39          EXEC SQL

40              WHENEVER SQLERROR perform OpenESQL-Error

41          END-EXEC.

42      

43          EXEC SQL

44            CONNECT TO 'Sober'

45          END-EXEC.

85           ,A.YOU-AGREE-TERMS

86       INTO

87            :SoberHouse-Query-ID:SoberHouse-Query-ID-NULL

88           ,:SoberHouse-Query-DEP-AMT:SoberHouse-Query-DEP-AMT-NULL

\\SoberHouse Query.CPY (40,21-22) : error COBES0100 : Incorrect SQL statement syntax near: Query

F:\\AP Courseware\\COBOLClass\\COBOLClass\\Projects\\15_01_SQLProject\\SQLProject\\SoberHouse Query.CPY (44,26-31) : error COBCH0233 : Unknown data description qualifier Query

F:\\AP Courseware\\COBOLClass\\COBOLClass\\Projects\\15_01_SQLProject\\SQLProject\\SoberHouse Query.CPY (86,26-36) : error COBCH0233 : Unknown data description qualifier Query-NULL

 COBOL compile: 0 item(s) succeeded or up-to-date, 1 failed.


I'm receiving the following error and have everything in place, when I searched the internet for the cause of below, I received (below)
Query.CPY (40,21-22) : error COBES0100 : Incorrect SQL statement syntax near: Query
Query.CPY (44,26-31) : error COBCH0233 : Unknown data description qualifier Query
Query.CPY (86,26-36) : error COBCH0233 : Unknown data description qualifier Query-NULL
  COBOL compile: 0 item(s) succeeded or up-to-date, 1 failed.

Incorrect SQL statement syntax near: WITH

PoorPoorFairFairAverageAverageGoodGoodExcellentExcellent

Problem:

The following complex query compiles fine in Net Express:
   EXEC SQL
      DECLARE cursor0 CURSOR FOR
      SELECT col1, col2,
      CASE WHEN ...
         THEN (SELECT COUNT(*) FROM table1 WHERE ...)
         ELSE (SELECT COUNT(*) FROM table1 WHERE...
            AND EXISTS (SELECT * FROM table2 WITH (NOLOCK) WHERE ...)) END,              CASE WHEN ... END
      FROM Table0
   END-EXEC.
When compiling the above in Visual COBOL 2.3 for Visual Studio, the following error occurs:
COBES0100 : Incorrect SQL statement syntax near: WITH

Resolution:

The issue has already been addressed in Visual COBOL 2.3 Hotfix1 that is available at the Product Updates page of the Micro Focus SupportLine site.
The fix is also included in the upcoming release of Visual COBOL 2.3 Update 1.
then when I go to this site, it shows ACCESS DENIED
Is this the correct problem?

This doesn't appear to be complete. Your statement at line 85 starts in the middle of a SELECT statement. The errors are pointing to the fact that the filename SoberHouse Query.cpy has a space in its name. Can you try to change the name to remove the space and try again?


I'm receiving the following error and have everything in place, when I searched the internet for the cause of below, I received (below)
Query.CPY (40,21-22) : error COBES0100 : Incorrect SQL statement syntax near: Query
Query.CPY (44,26-31) : error COBCH0233 : Unknown data description qualifier Query
Query.CPY (86,26-36) : error COBCH0233 : Unknown data description qualifier Query-NULL
  COBOL compile: 0 item(s) succeeded or up-to-date, 1 failed.

Incorrect SQL statement syntax near: WITH

PoorPoorFairFairAverageAverageGoodGoodExcellentExcellent

Problem:

The following complex query compiles fine in Net Express:
   EXEC SQL
      DECLARE cursor0 CURSOR FOR
      SELECT col1, col2,
      CASE WHEN ...
         THEN (SELECT COUNT(*) FROM table1 WHERE ...)
         ELSE (SELECT COUNT(*) FROM table1 WHERE...
            AND EXISTS (SELECT * FROM table2 WITH (NOLOCK) WHERE ...)) END,              CASE WHEN ... END
      FROM Table0
   END-EXEC.
When compiling the above in Visual COBOL 2.3 for Visual Studio, the following error occurs:
COBES0100 : Incorrect SQL statement syntax near: WITH

Resolution:

The issue has already been addressed in Visual COBOL 2.3 Hotfix1 that is available at the Product Updates page of the Micro Focus SupportLine site.
The fix is also included in the upcoming release of Visual COBOL 2.3 Update 1.
then when I go to this site, it shows ACCESS DENIED
Is this the correct problem?

Looked at the copybook lines and found the name with the space as you said.  Thia was the dclgen created in openESQL with the spaces so it thought it was ok, it wasn't.  Now getting a error 19703 on the connect to DB.  This is the code generated by openESQL too, does anything work in this environment?


I'm receiving the following error and have everything in place, when I searched the internet for the cause of below, I received (below)
Query.CPY (40,21-22) : error COBES0100 : Incorrect SQL statement syntax near: Query
Query.CPY (44,26-31) : error COBCH0233 : Unknown data description qualifier Query
Query.CPY (86,26-36) : error COBCH0233 : Unknown data description qualifier Query-NULL
  COBOL compile: 0 item(s) succeeded or up-to-date, 1 failed.

Incorrect SQL statement syntax near: WITH

PoorPoorFairFairAverageAverageGoodGoodExcellentExcellent

Problem:

The following complex query compiles fine in Net Express:
   EXEC SQL
      DECLARE cursor0 CURSOR FOR
      SELECT col1, col2,
      CASE WHEN ...
         THEN (SELECT COUNT(*) FROM table1 WHERE ...)
         ELSE (SELECT COUNT(*) FROM table1 WHERE...
            AND EXISTS (SELECT * FROM table2 WITH (NOLOCK) WHERE ...)) END,              CASE WHEN ... END
      FROM Table0
   END-EXEC.
When compiling the above in Visual COBOL 2.3 for Visual Studio, the following error occurs:
COBES0100 : Incorrect SQL statement syntax near: WITH

Resolution:

The issue has already been addressed in Visual COBOL 2.3 Hotfix1 that is available at the Product Updates page of the Micro Focus SupportLine site.
The fix is also included in the upcoming release of Visual COBOL 2.3 Update 1.
then when I go to this site, it shows ACCESS DENIED
Is this the correct problem?

Looked at the copybook lines and found the name with the space as you said.  Thia was the dclgen created in openESQL with the spaces so it thought it was ok, it wasn't.  Now getting a error 19703 on the connect to DB.  This is the code generated by openESQL too, does anything work in this environment?


I'm receiving the following error and have everything in place, when I searched the internet for the cause of below, I received (below)
Query.CPY (40,21-22) : error COBES0100 : Incorrect SQL statement syntax near: Query
Query.CPY (44,26-31) : error COBCH0233 : Unknown data description qualifier Query
Query.CPY (86,26-36) : error COBCH0233 : Unknown data description qualifier Query-NULL
  COBOL compile: 0 item(s) succeeded or up-to-date, 1 failed.

Incorrect SQL statement syntax near: WITH

PoorPoorFairFairAverageAverageGoodGoodExcellentExcellent

Problem:

The following complex query compiles fine in Net Express:
   EXEC SQL
      DECLARE cursor0 CURSOR FOR
      SELECT col1, col2,
      CASE WHEN ...
         THEN (SELECT COUNT(*) FROM table1 WHERE ...)
         ELSE (SELECT COUNT(*) FROM table1 WHERE...
            AND EXISTS (SELECT * FROM table2 WITH (NOLOCK) WHERE ...)) END,              CASE WHEN ... END
      FROM Table0
   END-EXEC.
When compiling the above in Visual COBOL 2.3 for Visual Studio, the following error occurs:
COBES0100 : Incorrect SQL statement syntax near: WITH

Resolution:

The issue has already been addressed in Visual COBOL 2.3 Hotfix1 that is available at the Product Updates page of the Micro Focus SupportLine site.
The fix is also included in the upcoming release of Visual COBOL 2.3 Update 1.
then when I go to this site, it shows ACCESS DENIED
Is this the correct problem?

It should work fine as long as the environment and the project is setup correctly.

I just tested with spaces in the project folder and it worked fine for me so it must be something specific to your table name. Is your actual table name "Soberhouse Query" with the space in it?

If you are connecting to a 32-bit DSN then your project build configuration should be set to x86. If you are connecting to a 64-bit DSN then your build configuration should be set to x64. What is your current configuration set to?

The 19703 error on the connect simply means that the connect failed which usually indicates that the connect statement is incorrect or the ODBC driver or DSN is not set up properly.

If you add the following to your program's working-storage:

01 MFSQLMESSAGETEXT    PIC X(256).

Then this variable will contain the actual error message text after the error occurs which may give you some more information to the cause of the actual error.