So that didn't work.  But after a lot of fiddling about, here's what works for 
me.  I LE enabled it so it will be reentrant.

ISCICS#  CEEENTRY MAIN=NO
*        SEE IF WE'RE RUNNING UNDER CICS BY CALLING @@GETCB...
         CALL  @@GETCB,MF=(E,=F'3') ...WITH VALUE INTEGER 3
         CEETERM RC=(15)
*
PPA      CEEPPA
         CEEDSA ,
         CEECAA ,
         END   ISCICS#

By using the execute format of the CALL macro, assuming all of the fields are 
to be passed by value, you can place them, in order, in the execute literal (or 
whatever its called that follows the 'E').

So, for example, if you wanted to call like the C statement "F(1,2,3)" you 
could do:
         CALL  F,MF=(E,=X'000000010000000300000003')
Or, of course, you could refer do a DC group instead of using a literal.

Perhaps this will help others.

Frank


________________________________
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on behalf of 
Frank Swarbrick <frank.swarbr...@outlook.com>
Sent: Monday, March 27, 2023 11:49 AM
To: IBM-MAIN@LISTSERV.UA.EDU <IBM-MAIN@LISTSERV.UA.EDU>
Subject: Re: ASM call by value

So it looks like all I need is the following:
CALL @@GETCB,(3)
which should call the @@GETCB function passing integer 3 by value, returning 0 
or 1 in R15 to indicate if the task is running in a CICS environment.
Will give this a shot.  Thanks!

Frank

________________________________
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on behalf of 
Bernd Oppolzer <bernd.oppol...@t-online.de>
Sent: Monday, March 27, 2023 12:49 AM
To: IBM-MAIN@LISTSERV.UA.EDU <IBM-MAIN@LISTSERV.UA.EDU>
Subject: Re: ASM call by value

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

----------------------------------------------------------------------
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