Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for DB2 SQL standard language option STDSQL(YES) #973

Closed
Oxdeception opened this issue Jun 22, 2021 · 4 comments
Closed

Add support for DB2 SQL standard language option STDSQL(YES) #973

Oxdeception opened this issue Jun 22, 2021 · 4 comments
Labels
new feature New feature or request

Comments

@Oxdeception
Copy link

Oxdeception commented Jun 22, 2021

DB2 programs written to use the DB2 SQL standard language option show invalid definition errors on uses of SQLCA records.

Describe the solution you'd like
Option to set STDSQL(YES)

Additional information
When using SQL standard language rules SQLCA does not need to included by the programmer; The corresponding fields are automatically generated by the precompiler.

When STDSQL(YES) is specified, the Db2 precompiler or coprocessor automatically generates an SQLCA that includes the variable name SQLCADE instead of SQLCODE and SQLSTAT instead of SQLSTATE.

Per DB2 documentation:
https://www.ibm.com/docs/en/db2-for-zos/12?topic=sql-standard-language

@Oxdeception Oxdeception added the new feature New feature or request label Jun 22, 2021
@asatklichov
Copy link
Contributor

asatklichov commented Jun 22, 2021

Hi,

Thank you for mentioning "STDSQL(YES)". We will add this compiler option in coming releases.
But currently, we support enabling SQLCA without including it by programmer.
You only will write " EXEC SQL INCLUDE SQLDA END-EXEC." that is all.

E.g. in below code, programmer is not including SQLCA or SQLDA explicitly. Our application can provide you all language-features (hover-over, etc..) as like you are in DB2.
This also works for DATACOM server as well. You can configure it in VSCode as in below snapshot

       IDENTIFICATION DIVISION.
       PROGRAM-ID. HELLO-SQL.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       
           EXEC SQL INCLUDE SQLDA END-EXEC.
           EXEC SQL INCLUDE SQLCA END-EXEC.
           
       PROCEDURE DIVISION.
            INITIALIZE SQLCA.
            MOVE '00' TO  SQLCAID  OF   SQLCA.            
            MOVE 23 TO  SQLCODE  OF SQLCA.
            DISPLAY SQLCA.
            DISPLAY SQLCODE.
            MOVE 23 TO  SQLERRML   OF   SQLCA.
            MOVE 23 TO  RETURN-CODE.
            

      *    SQLDA
            MOVE 23 TO  SQLDABC   OF   SQLDA. 
            
           IF  SQLCODE = ZERO  THEN  DISPLAY  "SUCCESS" 
           ELSE DISPLAY "FAIL SQLCODE = " SQLCODE.


 

@asatklichov
Copy link
Contributor

sqlca-da-config

@Oxdeception
Copy link
Author

The SQLCA that is included implicitly by using an EXEC SQL INCLUDE SQLCA END-EXEC is different than the one provided by STDSQL(YES), which uses SQLCADE instead of SQLCODE, and SQLSTAT instead of SQLSTATE. Using the include still results in errors whenever these fields are used.

@asatklichov
Copy link
Contributor

We are not supporting STDSQL(YES) case, will be implemented in next releases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request
Projects
Status: Released
Development

No branches or pull requests

3 participants