Yes, the callee is unaware of if the caller used pass by reference or pass by 
content.  That's a call site feature only.  The callee uses (the default) call 
by reference regardless.
A "by reference" parameter can be specified for any call, and need not be "the 
same" for additional calls to the same subroutine.

Interesting you mention function prototypes.  Those were not supported until 
the 2002 COBOL standard, and still have yet to be implemented in to Enterprise 
COBOL.  Soon, perhaps.  IBM only added user-defined functions in the most 
recent version (E.C. 6.4), and without prototypes those are rather awkward, so 
I'm hopeful for prototypes "soon".

As things are, without prototypes, for the CALL statement there is no parameter 
checking.  Just like in assembler...

________________________________
From: IBM Mainframe Discussion List <[email protected]> on behalf of 
Paul Gilmartin <[email protected]>
Sent: Monday, April 3, 2023 9:27 AM
To: [email protected] <[email protected]>
Subject: Re: ASM call by value

On Mon, 3 Apr 2023 04:57:02 +0000, Frank Swarbrick  wrote:
>
>(reply)  Call by content is enforced by the caller.  Call by value is enforced 
>by the callee.
>
Ah.  In my jargon I'd use "declared".  So the callee is unaware of the
distinction between reference and content; it just sees an address in
either case.

Is "content" declared in a function prototype or at the point of call?
If the latter, I'd imagine that the same function could be called with
arguments by reference at one point and by content at another.

--
gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to