You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
I just wonder what happened to the export,
MOVE var/lit TO var
) and possibly user input/output data (ACCEPT var
,DISPLAY var
) implemented back then.CODE SECTION.
is intended to be output directly before the first instruction, not after every one.Originally posted by @GitMensch in #1148 (comment)
The text was updated successfully, but these errors were encountered: