Skip to content

Commit

Permalink
only read statement as 1 line if it starts with EXEC SQL
Browse files Browse the repository at this point in the history
Signed-off-by: Brian Wildt <brw@bankdata.dk>
  • Loading branch information
WildtBrian committed Jan 7, 2025
1 parent acb18e6 commit a5096eb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
Binary file modified build/distributions/cobol-check-0.2.15.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -451,24 +451,24 @@ private void updateLineRepository(CobolLine line) throws IOException {
}
}

if (reader.isFlagSet(Constants.WORKING_STORAGE_SECTION)) {
if (reader.isFlagSet(Constants.WORKING_STORAGE_SECTION) && line.containsToken(Constants.EXEC_SQL_TOKEN)) {
String statement = reader.readStatementAsOneLine().getTrimmedString().replaceAll("\\s+", " ");
if (statement.startsWith(Constants.EXEC_SQL_TOKEN + " " + Constants.INCLUDE)) {
Platform platform = PlatformLookup.get();
switch(platform){
case ZOS:
if (statement.contains("SQLCA") || statement.contains("SQLDA"))
return;
default:
extractedCopyBook = lineRepository.addExpandedCopyDB2Statements(reader.readStatementAsOneLine());
for (int i = 0; i < extractedCopyBook.size(); i++) {
CobolLine cobolLine = new CobolLine(extractedCopyBook.get(i), tokenExtractor);
List<CobolLine> currentStatement = new ArrayList<>();
currentStatement.add(cobolLine);
this.currentDataStructure = updateCurrentDataStructure(currentStatement, currentDataStructure);
updateNumericFields(cobolLine);
}
break;
Platform platform = PlatformLookup.get();
switch(platform){
case ZOS:
if (statement.contains("SQLCA") || statement.contains("SQLDA"))
return;
default:
extractedCopyBook = lineRepository.addExpandedCopyDB2Statements(reader.readStatementAsOneLine());
for (int i = 0; i < extractedCopyBook.size(); i++) {
CobolLine cobolLine = new CobolLine(extractedCopyBook.get(i), tokenExtractor);
List<CobolLine> currentStatement = new ArrayList<>();
currentStatement.add(cobolLine);
this.currentDataStructure = updateCurrentDataStructure(currentStatement, currentDataStructure);
updateNumericFields(cobolLine);
}
break;
}
}
}
Expand Down
Binary file modified vs-code-extension/Cobol-check/bin/cobol-check-0.2.15.jar
Binary file not shown.

0 comments on commit a5096eb

Please sign in to comment.