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

276 Added Support on EXCEPTION in CALLs #309

Closed
wants to merge 2 commits into from
Closed

276 Added Support on EXCEPTION in CALLs #309

wants to merge 2 commits into from

Conversation

AkashKumar7902
Copy link
Contributor

Fixes: #276

@Rune-Christensen
Copy link
Collaborator

Hi @AkashKumar7902
Thank you for the pull request.
I am not sure that the pull request solves the issue.
I am aware that the example in the issue only lists a perform statement inside the ON EXCEPTION clause.
But any COBOL statement is valid inside the ON EXCEPTION clause, there can be multiple lines, and even a new CALL with its own ON EXCEPTION clause.

And please add tests that verifies that the changes fixes the issue.

Regards,
Rune

@AkashKumar7902
Copy link
Contributor Author

AkashKumar7902 commented Aug 24, 2023

@Rune-Christensen
Thanks for the clarification.

Here is my another idea:

In the endOfStatement function, if the current line contains CALL verb then it will continue returning false until it finds an equal number of END-CALL verb as CALL verb in the current line or if it encounters a terminating verb in the next line.

Here is a list of terminating verbs. Please Suggest addition/deletion(s) if any.
GO GOBACK STOP EXIT END

I would love to have feedback on this approach.

@Rune-Christensen
Copy link
Collaborator

Hi @AkashKumar7902
I am afraid that will also not work.
The issue is that in this code:
CALL "A" USING A-VALUES
MOVE "SOME-VALUE" TO B-VALUES
The MOVE statement is the statement that indicates that the CALL statement is finished.

You have to identify the ON EXCEPTION phrase, and then look for a END-CALL or a period >>.<< as the keys to determine when the CALL is finished.

Also "terminating" verbs, doesn't work like that.
This is invalid COBOL:
CALL "A" USING A-VALUES
ON EXCEPTION
GOBACK
A-NEW-PARAGRAPH.

You will get a compile error, because the CALL ON EXCEPTION statement is not finished, before the next paragraph definition.
Terminating verbs still have to be inside valid COBOL, and have to be encapsulated by END-CALL END-IF and so on statements.

You should not be considering terminating verbs in the code you are building for this, they are just as any other COBOL statements in this regard.

Regards
Rune

@AkashKumar7902
Copy link
Contributor Author

@Rune-Christensen
Thanks for the review.
I will be sending a new PR.

@AkashKumar7902 AkashKumar7902 closed this by deleting the head repository Aug 24, 2023
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.

Support ON EXCEPTION in CALLs
2 participants