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

SQL Preproc issue tracker #371

Open
4 of 13 tasks
NeoKaios opened this issue Oct 14, 2024 · 1 comment
Open
4 of 13 tasks

SQL Preproc issue tracker #371

NeoKaios opened this issue Oct 14, 2024 · 1 comment

Comments

@NeoKaios
Copy link
Contributor

NeoKaios commented Oct 14, 2024

The starting point for this should be #370. And using OCamlPro Gixsql fork : https://github.com/OCamlPro/gixsql

Preproc file generation issues

  • Digit scale should be negative : TSQL005A (2 instead of -2 for NUM1)
  • Failure due to issue in cobol_indent when there is a tabulation as a first character : TSQL009A TSQL042A
    This causes errors when computing the variable prefix of statements
  • Group vars need to be split into their elementary elements : TSQL025A
    Group variable TAB00-REC is passed as is to GIXSQLSetSQLParams where it should be the 3 elementary vars CID, FLD01 and FLD02.
  • Detecting group variable that are length-variable from non-esql variable: TSQL026A - 27A (eg SQLCOMMAND)
    The test fails because the length attribute a variable-length variable should be negative, this is easily done when the variable is defined as 01 v SQL TYPE VARCHAR(100). but it can be the case from normal COBOL variable.
  • Fix is_varying_len method by adding support to COMP-5 to usage
  • --no-rec-code option to implement somehow: TSQL033-1
  • INCLUDEd parts of the working-storage should be accessible to (at least) the Sql_typeck module: TSQL0042A
    The absence of the copy file in the compilation unit cause the typeck to return an unknown type/length/flags for all variable originating from such a file, but those value are passed to GIXSQLSetSQLParams.
  • Implement -P varchar option, it seems to activate flag autotrim on some fields: TSQL037A 37B
  • Fix support of null indicator (some var have :VAR:NULL-IND form, which is ill-supported): TSQL042A

Grammar issues

  • Once the preproc option --cobol85 is remove, a grammar error appears in test TSQL018B : apparently LOREM IPSUM is a valid EXEC SQL bloc...
  • Grammar should be able to parse 'SELECT CASE WHEN' statement: TSQL041A

Parser issues

  • VARYING keyword not supported : TSQL022 NB the test depends on preprocess file content
  • I think EXEC SQL IGNORE block should be handle by another preproc, (the default cobol one ?) as the token inside are to be copied as is in the generated file (I hacked a safeguard to avoid parsing such blocks) (TSQL011A)
@Halbaroth
Copy link

I report here some issues I found with the gixsql test suite:

  • The following warning message:
Internal warning: unable to join locations via limits in
  `Cobol_preproc__Src_overlay.join_limits` 

is emitted a lot of time. For instance with TSQL001A.cbl:

EXEC SQL found at line 51
END-EXEC found at 53
:1.22-1.29: Internal warning: unable to join locations via limits in
  `Cobol_preproc__Src_overlay.join_limits`
  [ctx=Sql_parser__Sql_overlay_manager-2]
:1.37-1.42: Internal warning: unable to join locations via limits in
  `Cobol_preproc__Src_overlay.join_limits`
  [ctx=Sql_parser__Sql_overlay_manager-2]
:1.51-1.56: Internal warning: unable to join locations via limits in
  `Cobol_preproc__Src_overlay.join_limits`
  [ctx=Sql_parser__Sql_overlay_manager-2]
EXEC SQL found at line 67
END-EXEC found at 69
:1.16-1.21: Internal warning: unable to join locations via limits in
  `Cobol_preproc__Src_overlay.join_limits`
  [ctx=Sql_parser__Sql_overlay_manager-2]
:1.35-1.37: Internal warning: unable to join locations via limits in
  `Cobol_preproc__Src_overlay.join_limits`
  [ctx=Sql_parser__Sql_overlay_manager-2]
:1.43-1.51: Internal warning: unable to join locations via limits in
  `Cobol_preproc__Src_overlay.join_limits`
  [ctx=Sql_parser__Sql_overlay_manager-2]
EXEC SQL found at line 79
END-EXEC found at 79
  • An error of syntax with TSQL042A.cbsql and TSQL009A.cbsql too:
TSQL042A.cbsql: in paragraph '100-MAIN':
TSQL042A.cbsql:179: error: syntax error, unexpected Identifier, expecting SECTION or .
  177 | SQLBOL*       START TRANSACTION
  178 | SQLBOL* END-EXEC.
  179 > SQLBOL  ENDCALL STATIC "GIXSQLStartSQL"
  180 | SQLBOL  ENDEND-CALL
  181 | SQLBOL  ENDCALL STATIC "GIXSQLExec" USING
TSQL042A.cbsql:179: note: unknown statement 'ENDCALL'
  • Several errors of syntax with TSQL040A.cbsql:
TSQL040A.cbsql:50: error: PROCEDURE DIVISION header missing
   48 | SQLBOL*      FILENAME                       VARCHAR(60) NOT NULL        0..
   49 | SQLBOL*    ) END-EXEC.                                                  0..
   50 > SQLBOL     TODO.
   51 |       ******************************************************************0..
   52 |       * COBOL DECLARATION FOR TABLE AEPT.P_HISTORY_TD                  *0..
TSQL040A.cbsql:50: error: syntax error, unexpected Identifier
TSQL040A.cbsql:54: error: syntax error, unexpected Identifier, expecting SECTION or .
   52 |       * COBOL DECLARATION FOR TABLE AEPT.P_HISTORY_TD                  *0..
   53 |       ******************************************************************0..
   54 >        01  DCLP-HISTORY-TD.                                             0..
   55 |       *                       DATAVAL                                   0..
   56 |            10 P014-DATAVAL         PIC X(10).                           0..
TSQL040A.cbsql:54: note: unknown statement '01'
TSQL040A.cbsql:56: error: syntax error, unexpected Identifier, expecting SECTION or .
   54 |        01  DCLP-HISTORY-TD.                                             0..
   55 |       *                       DATAVAL                                   0..
   56 >            10 P014-DATAVAL         PIC X(10).                           0..
   57 |       *                       DATARIL                                   0..
   58 |            10 P014-DATARIL         PIC X(10).                           0..
....
  • Warning message with TSQL015A.cbsql:
TSQL015A.cbsql:83: warning: OCCURS DEPENDING ON without TO phrase used [-Wdialect]
   81 |                  DEPENDING ON Z-MY-ELEMENTS
   82 |                  ASCENDING KEY IS MY-ID
   83 >                  INDEXED BY I-TAB.
   84 |                 07 MY-ELEMENT.
   85 |                   10 MY-ID         PIC  9(009) COMP-5 VALUE ZERO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants