TypeCobol
TypeCobol copied to clipboard
Support full SQL TYPE IS syntax
Following #2186.
The goal here is to extend the parser to support full syntax for special usage SQL TYPE IS. See https://www.ibm.com/docs/en/db2-for-zos/12?topic=cobol-host-variables-in.
New required contextual keywords:
-
RESULT-SET-LOCATOR
-
LIKE
-
AS
-
LOCATOR
-
ROWID
-
LARGE
-
BLOB
-
CHAR
-
CLOB
-
DBCLOB
-
BLOB-LOCATOR
-
CLOB-LOCATOR
-
DBCLOB-LOCATOR
-
BLOB-FILE
-
CLOB-FILE
-
DBCLOB-FILE
-
K
-
M
-
G
ANTLR grammar:
sqlTypeClause:
SQL TYPE IS (binaryVariable | (resultSetLocator VARYING) | tableLocator | lobVariableOrLocatorOrFile | xmlVariableOrFile | rowid);
binaryVariable:
already defined by #2186
tableLocator:
TABLE like tableName=UserDefinedWord as locator;
lobVariableOrLocatorOrFile:
lobVariable | lobLocator | lobFile;
xmlVariableOrFile:
XML as (lobVariable | lobFile);
lobVariable: ((BINARY large OBJECT | blob) | (CHARACTER large OBJECT | char large OBJECT | clob) | dbclob) LeftParenthesisSeparator length=IntegerLiteral lobVariableUnit? RightParenthesisSeparator;
lobVariableUnit: k | m | g;
lobLocator: blobLocator | clobLocator | dbclobLocator;
lobFile: blobFile | clobFile | dbclobFile;