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

LOB variables and file reference variables arrays #2396

Conversation

ilidio-lopes
Copy link
Contributor

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Check the test cases in the PR . Host variables can be in a sample code
        Identification Division.
        Program-Id. 'TEST1'.
        Data Division.
        Working-Storage Section.
       01 VAR1. 
           04 VAR2 USAGE IS SQL TYPE IS CHARACTER LARGE OBJECT (10 M) OCCURS 10 TIMES.
        PROCEDURE division.
           display  VAR1.
  • Test A
  • Test B

Checklist:

  • Each of my commits contains one meaningful change
  • I have performed rebase of my branch on top of the development
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have checked my code and corrected any misspellings

@ilidio-lopes ilidio-lopes force-pushed the US966886-LOB_variables_and_file_reference_variables_arrays branch from 1ae427d to 91bd8fc Compare July 23, 2024 10:20
@ap891843
Copy link
Contributor

I am wondering if we need to add the newly added lexemes to the coloring and auto completion.

@@ -64,6 +68,8 @@ xml_lobNO_size: BLOB_FILE | CLOB_FILE | DBCLOB_FILE;

xml_as: XML AS;

occurs_clause: OCCURS T=dbs_integer {validateIntegerRange($T.text, 1, 32767);} TIMES?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like above approach of dbs_host_var_levels_arrays, where it a single rule for validation. Obviously there is nothing wrong in this as well.

public List<Node> visitLob_host_variables_arrays(Db2SqlParser.Lob_host_variables_arraysContext ctx) {
List<Node> hostVariableDefinitionNode = createHostVariableDefinitionNode(ctx, ctx.dbs_host_var_levels_arrays(), ctx.entry_name());
if (ctx.lobWithSize() != null && ctx.lobWithSize().BINARY() != null) {
generateVarbinVariables((VariableDefinitionNode) hostVariableDefinitionNode.get(0),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't see use case tests for these

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would also apply to the BLOB variant, not just the BINARY LARGE OBJECT, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more question to this - what is the origin of the restriction to binary lobs only?
I see this in the DB2 preprocessor output:

 04  VAR4                             OCCURS 30.           
   49 VAR4-LENGTH                    PIC S9(9) COMP-5.     
   49 VAR4-DATA                      PIC X(20).            
*   04 VAR4 USAGE IS SQL TYPE IS BLOB (20) OCCURS 30 TIMES.
 04  VAR5                             OCCURS 30.           
   49 VAR5-LENGTH                    PIC S9(9) COMP-5.     
   49 VAR5-DATA                      PIC X(20).            
*   04 VAR5 USAGE IS SQL TYPE IS CLOB (20) OCCURS 30 TIMES.
 04  VAR6                             OCCURS 40.           
   49 VAR6-LENGTH                    PIC S9(9) COMP-5.     
   49 VAR6-DATA                      PIC G(30720) DISPLAY-1
*   04 VAR6 USAGE IS SQL TYPE IS DBCLOB (30 K) OCCURS 40.  

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more question to this - what is the origin of the restriction to binary lobs only? I see this in the DB2 preprocessor output:

 04  VAR4                             OCCURS 30.           
   49 VAR4-LENGTH                    PIC S9(9) COMP-5.     
   49 VAR4-DATA                      PIC X(20).            
*   04 VAR4 USAGE IS SQL TYPE IS BLOB (20) OCCURS 30 TIMES.
 04  VAR5                             OCCURS 30.           
   49 VAR5-LENGTH                    PIC S9(9) COMP-5.     
   49 VAR5-DATA                      PIC X(20).            
*   04 VAR5 USAGE IS SQL TYPE IS CLOB (20) OCCURS 30 TIMES.
 04  VAR6                             OCCURS 40.           
   49 VAR6-LENGTH                    PIC S9(9) COMP-5.     
   49 VAR6-DATA                      PIC G(30720) DISPLAY-1
*   04 VAR6 USAGE IS SQL TYPE IS DBCLOB (30 K) OCCURS 40.  

Someone checked that on the mainframe. Probably only binary lobs was checked at that time.
I will make changes for CLOB and DBLOB

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last details - DBCLOB generates PIC G(...), not PIC X(...).

@ilidio-lopes ilidio-lopes force-pushed the US966886-LOB_variables_and_file_reference_variables_arrays branch from 91bd8fc to ddfafec Compare July 24, 2024 12:50
@ap891843
Copy link
Contributor

I am wondering if we need to add the newly added lexemes to the coloring and auto completion.

same have been added under PR #2394

@ilidio-lopes ilidio-lopes force-pushed the US966886-LOB_variables_and_file_reference_variables_arrays branch 3 times, most recently from 177d256 to f553f7f Compare July 25, 2024 10:00
@ilidio-lopes ilidio-lopes force-pushed the US966886-LOB_variables_and_file_reference_variables_arrays branch from f553f7f to 8fce484 Compare July 25, 2024 11:02
public List<Node> visitLob_host_variables_arrays(Db2SqlParser.Lob_host_variables_arraysContext ctx) {
List<Node> hostVariableDefinitionNode = createHostVariableDefinitionNode(ctx, ctx.dbs_host_var_levels_arrays(), ctx.entry_name());
if (ctx.lobWithSize() != null && ctx.lobWithSize().BINARY() != null) {
generateVarbinVariables((VariableDefinitionNode) hostVariableDefinitionNode.get(0),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last details - DBCLOB generates PIC G(...), not PIC X(...).

@ap891843 ap891843 merged commit 9d6d810 into eclipse-che4z:development Jul 25, 2024
17 checks passed
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

Successfully merging this pull request may close these issues.

3 participants