I would like to add:

if you pass the address of a constant field to the called prog using the CALL macro, this looks like call by value, but in fact you have call by reference again, because you
pass an address in the reg1 list.

This is what PL/1 for example does, if it builds and passes a so-called DUMMY ARGUMENT (in cases where types of parameters don't match or when you put paratheses around
your arguments).

PL/1, BTW, also supports "real" by value for some time already, if you code the BYVALUE parameter,
this way allowing the call of C subroutines which expect by value calls.

Kind regards

Bernd


Am 27.03.2023 um 08:52 schrieb Bernd Oppolzer:
Sorry ... in some places: replace "caller" by "called prog" ...


Am 27.03.2023 um 08:49 schrieb Bernd Oppolzer:
Sorry that I post to the original question;
that's because most of the answers so far missed the point.

Call by value means that a value is passed to the caller;
call by reference means that a reference (technically: an address) is passed to the caller.

In ASSEMBLER:

   CALL SUBPROG,(A,B,C),VL

sends address constants of fields A, B and C to the caller (via reg1 address list),
so that is always call by reference.

You can instead send an integer constant to the caller using CALL or a register:

   CALL SUBPROG,(1024,(R3))

with the integer constant, this sure is call by value, but you are limited to integer arguments. With the register argument, it depends on what is contained in the register;
if it is an address, you have call by reference again.

The only real "call by value" I can see here is the case where an integer constant is part of the reg1 parameter list (the 1024 constant above); and this is what C technically does in the "call by value" case. If C passes larger values "call by value", it copies them in the reg1 parameter list. This CANNOT BE DONE using the CALL macro. And this would be
the correct answer to the original question.

HTH,
kind regards

Bernd


Am 26.03.2023 um 23:35 schrieb Frank Swarbrick:
Can the MVS CALL macro be used to call a C function with "value" parameters (rather than reference parameters)?


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to