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

Developer #258

Closed
wants to merge 11 commits into from
Closed

Conversation

sam94dion
Copy link

Add function so one can include DB2 copybooks

@Rune-Christensen
Copy link
Collaborator

Hi @sam94dion
Thank you for your contribution :-D
I see changes to file section statements, mixed with the DB2 copybook expand changes.
Could you elaborate on these changes?
We are aware that we have neglected file section in the development, so input to this area is welcome.
Regards Rune

Copy link
Collaborator

@dakaa16 dakaa16 left a comment

Choose a reason for hiding this comment

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

Thank you for the pull request - happy that there's more to come. If you can fix the issues I've commented on, I'll approve the Pull Request. It's some good changes, and it seems you have a good understanding of the code :)

line.setUnNumberedString(" **");
}
if(lineRepository.getFileSectionStatements().size() > 0) {
for(int i=0; i < lineRepository.getFileSectionStatements().size(); i++) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of looping through all file section statements, the method addExpandedCopyDB2Statements could return the elements that were added, so we only need to look through the new elements.

@@ -25,6 +25,8 @@ public List<String> getTokens() {
return tokens;
}
public String getToken(int index) { return tokens.get(index); }

public void setUnNumberedString(String s) {unNumberedString = s;}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This method invalidates the object, as the tokens, the original string and the other fields are not updated. I do not see the need to specifically set unNumberedString. Could you refactor the method, so that it takes the original string, and then update all the other fields like it's done in the constructor?

@samdion1994
Copy link
Collaborator

Thank you for your kind words :)

Copy link
Collaborator

@dakaa16 dakaa16 left a comment

Choose a reason for hiding this comment

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

Hi Samuel
You are required to sign off your commits in order for the pull request to be approved. Please go through your commits and sign them off - it is a bit of a hassle, please do let me know if you are having any trouble :). Make sure to also sign off any future commits.
Please also make sure to not include extensive refactoring along with functional changes in one pull request. It makes it hard to review your functional changes. Extensive refactoring is welcome, but keep it in its own pull request.
Again thank you very much for your contribution.

return convertToStrings(reader.getCurrentStatement());
}

//Getting info from reader
public boolean hasStatementBeenRead(){
public CobolLine getCurrentLineAsStatement() throws IOException {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is unnecessary. At line 433 you make sure that the line is read as a statement:
extractedCopyBook = lineRepository.addExpandedCopyDB2Statements(reader.readStatementAsOneLine());
This ensures that the Generator will write the whole statement. What you are trying to achieve is already handled.

writerController.writeStubbedLine(sourceLine);
if (interpreter.shouldCurrentLineBeStubbed()) {
if(interpreter.isReading(Constants.WORKING_STORAGE_SECTION))
writerController.writeStubbedLine(interpreter.getCurrentLineAsStatement().getUnNumberedString());
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is unnecessary. See comment about getCurrentLineAsStatement. It will always be written as a statement, by the check at line 161: hasStatementBeenRead().

sam94dion and others added 6 commits November 15, 2022 10:16
Added fonction to include DB2 copybooks

Also when a numeric variable was copied from a
copybook it was not taken into account fixed that
Added cursors handling in the working section.
Moved the stubbing to the generate class.
Added cursor in the DB2PROG example.
Signed-off-by: sam94dion <[email protected]>
Signed-off-by: Samuel <[email protected]>
@Rune-Christensen
Copy link
Collaborator

Hi @sam94dion
These changes were implemented in pull request #278
I am therefore closing this PR.
Thank you :-)

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.

4 participants