Skip to content

Commit

Permalink
Added validation for after 72 col to not be copied to the next line
Browse files Browse the repository at this point in the history
  • Loading branch information
samdion1994 committed Nov 20, 2023
1 parent 70665db commit 87bc610
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 22 deletions.
10 changes: 5 additions & 5 deletions src/main/cobol/MOCK.CBL
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
PROGRAM-ID. MOCK.
/****************************************************************
* Program to exercise different mock statements and edge cases.
*****************************************************************
*****************************************************************
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
DATA DIVISION.
WORKING-STORAGE SECTION.
Expand All @@ -23,10 +23,10 @@

000-START SECTION.
MOVE "Value1" to VALUE-1
MOVE "Value2" to VALUE-2
MOVE "Value2" to VALUE-2 dadawdwd
/
PERFORM 100-WELCOME
PERFORM 200-GOODBYE
PERFORM 100-WELCOME dadadada
PERFORM 200-GOODBYE dadadada
/
PERFORM 300-CHANGE-1
PERFORM 400-CHANGE-2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ CobolLine readLine() throws IOException {
}
previousLine = currentLine;
setPreviousMeaningfulLine();
if (line.length() > 71)
if (line.length() > 71)
currentLine = new CobolLine(line.substring(0, 71), tokenExtractor);
else
currentLine = new CobolLine(line, tokenExtractor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,10 @@ public String interpretNextLine() {
}

// Current line might change from when it was originally read
return reader.getCurrentLine().getUnNumberedString();
if (reader.getCurrentLine().getUnNumberedString().length() > 71 )
return reader.getCurrentLine().getUnNumberedString().substring(0, 71);
else
return reader.getCurrentLine().getUnNumberedString();
}

public void closeReader() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,6 @@ public void variable_before_exec_sql_include_is_evaluated_as_text() throws IOExc
" . " + Constants.NEWLINE +
" " + Constants.NEWLINE +
" *CALL \"PROGRAM\" USING VALUE-1 " + Constants.NEWLINE +
" * ON EXCEPTION " + Constants.NEWLINE +
" * PERFORM 100-WELCOME " + Constants.NEWLINE +
" *END-CALL. " + Constants.NEWLINE +
" PERFORM UT-PROCESS-UNMOCK-CALL " + Constants.NEWLINE +
" CONTINUE " + Constants.NEWLINE +
" . ";
Expand Down Expand Up @@ -443,8 +440,6 @@ public void variable_before_exec_sql_include_is_evaluated_as_text() throws IOExc
" . " + Constants.NEWLINE +
" " + Constants.NEWLINE +
" *CALL \"PROGRAM\" USING VALUE-1 " + Constants.NEWLINE +
" * ON EXCEPTION " + Constants.NEWLINE +
" * PERFORM 100-WELCOME. " + Constants.NEWLINE +
" PERFORM UT-PROCESS-UNMOCK-CALL " + Constants.NEWLINE +
" CONTINUE " + Constants.NEWLINE +
" . ";
Expand Down Expand Up @@ -489,8 +484,6 @@ public void variable_before_exec_sql_include_is_evaluated_as_text() throws IOExc
" . " + Constants.NEWLINE +
" " + Constants.NEWLINE +
" *CALL \"PROGRAM\" USING VALUE-1 " + Constants.NEWLINE +
" * ON EXCEPTION " + Constants.NEWLINE +
" * DISPLAY \"HELLO WORLD\". " + Constants.NEWLINE +
" PERFORM UT-PROCESS-UNMOCK-CALL " + Constants.NEWLINE +
" CONTINUE " + Constants.NEWLINE +
" . ";
Expand Down Expand Up @@ -535,12 +528,6 @@ public void variable_before_exec_sql_include_is_evaluated_as_text() throws IOExc
" . " + Constants.NEWLINE +
" " + Constants.NEWLINE +
" *CALL \"PROGRAM\" USING VALUE-1 " + Constants.NEWLINE +
" * ON EXCEPTION " + Constants.NEWLINE +
" * CALL \"PROGRAM2\" USING VALUE-1 " + Constants.NEWLINE +
" * ON EXCEPTION " + Constants.NEWLINE +
" * DISPLAY \"HELLO WORLD\" " + Constants.NEWLINE +
" * END-CALL " + Constants.NEWLINE +
" *END-CALL " + Constants.NEWLINE +
" PERFORM UT-PROCESS-UNMOCK-CALL " + Constants.NEWLINE +
" CONTINUE " + Constants.NEWLINE +
" DISPLAY \"NO COMMENTS\" " + Constants.NEWLINE;
Expand Down Expand Up @@ -585,12 +572,10 @@ public void variable_before_exec_sql_include_is_evaluated_as_text() throws IOExc
" . " + Constants.NEWLINE +
" " + Constants.NEWLINE +
" *CALL \"PROGRAM\" USING DATA-1 ON EXCEPTION " + Constants.NEWLINE +
" * DISPLAY \"ERROR\". " + Constants.NEWLINE +
" PERFORM UT-PROCESS-UNMOCK-CALL " + Constants.NEWLINE +
" CONTINUE " + Constants.NEWLINE +
" . " + Constants.NEWLINE +
" *CALL \"PROGRAM\" USING DATA-1 ON EXCEPTION " + Constants.NEWLINE +
" * DISPLAY \"ERROR\". " + Constants.NEWLINE +
" PERFORM UT-PROCESS-UNMOCK-CALL " + Constants.NEWLINE +
" CONTINUE " + Constants.NEWLINE +
" . " + Constants.NEWLINE;
Expand Down
Binary file modified vs-code-extension/Cobol-check/bin/cobol-check-0.2.8.jar
Binary file not shown.

0 comments on commit 87bc610

Please sign in to comment.