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

COBOL export aspects #1170

Open
codemanyak opened this issue May 24, 2024 · 1 comment
Open

COBOL export aspects #1170

codemanyak opened this issue May 24, 2024 · 1 comment
Assignees
Labels

Comments

@codemanyak
Copy link
Collaborator

I just wonder what happened to the export,

  • I've thought we had simple assignments (MOVE var/lit TO var) and possibly user input/output data (ACCEPT var, DISPLAY var) implemented back then.
  • Note: I guess the CODE SECTION. is intended to be output directly before the first instruction, not after every one.

Originally posted by @GitMensch in #1148 (comment)

@codemanyak
Copy link
Collaborator Author

codemanyak commented May 24, 2024

@GitMensch

Note: I guess the CODE SECTION. is intended to be output directly before the first instruction, not after every one.

I found out that the lines "CODE SECTION." and "GO BACK." were produced by the Generator method generateResult(), which is supposed to implement the function result mechanism at a routines end. "CODE SECTION." was an arbitrarily chosen section name, possibly intended for adressability of the return code (i.e., to allow to jump there from some other part of the subroutine), The "GO BACK." generation seems misplaced in generateResult() as it should always be added at the end of a diagram (except perhaps from Includables) und should therefore be produced by generateFooter(). Hence, for diagrams not representing a function, the method should not produce anything. For functions returning an integer value, it should apparently move the result value to variable RETURN-CODE (or the identifier specified by the "RETURNING" clause of the procedure division). But my question would be: what to do with a non-integer result? How do non-integral user-defined functions work in COBOL, or are they to be implemented as procedures that fill either a "globally" or "externally" declared variable or some reference argument? What is the preferrable way to export a general function diagram to COBOL?

EDIT (2024-05-27): I guess the declaration of an "BY REFERENCE" argument in the respective CALL might be the preferrable way to pass a non-integral result since it provides the best chance of name independence. In the generator draft the discussed mechanisms have indeed already been prepared, just not quite completely.

@codemanyak codemanyak self-assigned this May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant