I wanted to close the loop on this. Forgive the two-week delay; I was on vacation.
I have demonstrated to my satisfaction that CEEPIPI will do what I want. I got the IBM sample program from https://www.ibm.com/docs/en/zos/3.1.0?topic=services-example-program-invocation-ceepipi and the associated C program running without modifications. Worked right out of the box. Then I modified the assembler program to call the C subroutine three times in succession, and modified the C code to store a pointer in a static and a value on the heap. The values were preserved to my satisfaction across calls. QED. I am going to write -- probably for the CBT -- a generalized module to "Rexx environment enable" a program written in an LE language (C++ in my case, but I intend it to support COBOL and PL/I as well) similar to that described below. I am in communication with @Peter.Farley about the module, and I welcome input from anyone else. Charles On Sun, 1 Mar 2026 05:14:03 -0600, Charles Mills <[email protected]> wrote: >Thank you all for your prompt replies. Let me see if I can't respond to >everyone at once and minimize the listserv noise. > >> Charles, you will need two levels to accomplish this from Rexx. First you >> need a Rexx function or ADDRESS mode package written in assembler or MetalC >> that will load and call your C code the first time, using CEEPIPI to >> initialize the C environment, and save the entry point address and the >> address of the GETMAIN'ed CEEPIPI area in the user area of one of the Rexx >> control blocks or in a saved named whatchamacallit (I forget the macro name >> – the z/OS mechanism behind CICS named counters) for subsequent calls. And >> for completeness you'll probably need an "exit" call as well to clean up the >> loaded code and dynamic storage before Rexx termination. > >I assume I should take your reply as a Yes to my question. Using CEEPIPI will >let the statics and heap persist across Rexx invocations of the C++ code. > >Yes, I pictured the first of those "levels." I see a sequence in Rexx >something like > >CALL LEENVMGR 'ADD', env-name, 'LE runtime parms', etc. >ADDRESS env-name whatever >IF RC = 'blah blah blah' THEN ... >ADDRESS env-name whatever >ADDRESS env-name whatever >CALL LEENVMGR 'DELETE', env-name ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
