che-che4z-lsp-for-cobol icon indicating copy to clipboard operation
che-che4z-lsp-for-cobol copied to clipboard

SQL: Support EXEC SQL VAR

Open GitMensch opened this issue 3 years ago • 1 comments

This is a hint to the SQL preparser about the type of bind variables on the DB side, samples:

           EXEC SQL VAR MYTYPE        IS CHAR      END-EXEC.
           EXEC SQL VAR MYKEY         IS CHAR      END-EXEC.

Those references are bind variables (so part of the sql DECLARE SECTION). It is possibly totally fine to just "skip" those lines in the lsp.

Current result:

{
	"resource": "test.pco",
	"owner": "_generated_diagnostic_collection_name_#1",
	"severity": 8,
	"message": "Syntax error on 'VAR' expected {BEGIN, DECLARE, END, INCLUDE}",
	"source": "COBOL Language Support - E",
	"startLineNumber": 73,
	"startColumn": 21,
	"endLineNumber": 73,
	"endColumn": 24
}

GitMensch avatar Feb 09 '22 11:02 GitMensch

There is an option to turn off CICS or SQL in settings. Would this help?

"cobol-lsp.analysis.features": [
    "CICS", "SQL"
]

zimlu02 avatar Feb 09 '22 16:02 zimlu02

Hello @GitMensch EXEC SQL VAR looks like a non-standard extension that is not supported by IBM Enterprise COBOL for z/OS.

VitGottwald avatar Sep 03 '24 10:09 VitGottwald

And it's Db2 preprocessor.

VitGottwald avatar Sep 03 '24 10:09 VitGottwald

Yes, this is not in the statement list https://www.ibm.com/docs/en/db2/11.5?topic=sql-statements which instead uses USAGE SQL TYPE after EXEC SQL BEGIN DECLARE SECTION. Just to recheck: is that supported completely?

Otherwise it is "only" a common extension for (nearly all?) other SQL preprocessors, so I'd suggest to not close it but move it to an open sql dialect issue instead... or come back to this as part of #2158.

GitMensch avatar Sep 03 '24 11:09 GitMensch

All of Db2 SQL including host variables should be supported with the recent 2.2.0 release.

VitGottwald avatar Sep 03 '24 12:09 VitGottwald