-----Original Message-----
From: IBM Mainframe Discussion List [mailto:ibm-m...@bama.ua.edu] On
Behalf Of Charles Mills
Sent: Sunday, February 21, 2010 8:00 PM
To: IBM-MAIN@bama.ua.edu
Subject: Best practice for 24-bit storage in assembler called from C/C++

I'm writing a fairly large MVS batch application in C++. At several
points
it is necessary to call "library" type routines that I am writing in
assembler. Several of the routines (unfortunately) need to use QSAM
macros
and so need below-the-line storage.

 

Obviously I could do a GETMAIN or STORAGE OBTAIN LOC=24 on the way in
and
FREEMAIN or STORAGE RELEASE on the way out. But that's less than optimal
for
a routine that is called multiple times. (And it would not work at all
if
the routine had to save state across calls, but fortunately that is not
the
case, at least for my requirements so far.)

 

I could make the calling C++ responsible for providing a "work area"
obtained with _malloc24(). But I don't like that for "aesthetic" reasons
-
violates encapsulation, making the caller responsible for the inner
workings
of the called function.

 

Is there a better way? Is there some sort of "anchor word" where a
library
of called assembler routines could save an address across calls? Is this
what CEECAA_TCASRV_USERWORD in CEECAA is for? Does R12 reliably point to
the
CEECAA on entry? Can I count on CEECAA_TCASRV_USERWORD being initialized
to
zero? Where is this stuff documented? I don't see much in LE
Programming, in
LE ILC, or in the C/C++ Programming Guide.

<SNIP>

If you KNOW that you will be serialized, then you can either build your
DCB info into a REUSE program that you can LOAD. You can then call it to
do the I/O that you need done, not get into all the overhead of multiple
OPEN/CLOSE, etc. You can then do an INIT call and a Terminate call for
the OPEN and CLOSE issues.

Otherwise, you can get the storage from your assembler routine, and then
have it IDENTIFY that storage so that you can find it again using LOAD,
or a run of the CDE chain(s).

Just two options you might want to consider.

Regards,
Steve Thompson

-- Opinions expressed by this poster may not reflect those of poster's
employer --

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to