PL/I

PL/I

PL/I

 View Only

How to allocate persistent storage?

  • 1.  How to allocate persistent storage?

    Posted Thu October 19, 2017 12:44 PM

    Hi,

    I'm trying to write an ISPF panel input exit (")INEXIT LOAD ...") in PL/I.The procedure has "OPTIONS(MAIN)" so that it can be called by ISPF.I have a DISPLAY() right after the declares and the ON code traps.I set the return code by calling PLIRETC. The procedure looks like:%PROCESS SYSTEM(MVS);MYINEXIT: PROCEDURE(PNAME,PBUFPTR,PBUFLEN,PRECLEN,FLGS,DATAPTR)         OPTIONS(LINKAGE(SYSTEM) MAIN NOEXECOPS);                           DCL APNAME  POINTER NONVARYING BYVALUE INONLY;                    DCL PBUFPTR POINTER            BYADDR  INONLY;                    DCL PBUFLEN FIXED(31) BINARY   BYADDR  INONLY;                    DCL PRECLEN FIXED(31) BINARY   BYADDR  INONLY;                    DCL FLGS    FIXED(31) BINARY   BYADDR  INONLY;                    DCL DATAPTR POINTER            BYADDR  INOUT;       DCL PNAME CHAR(8) BASED(APNAME);                  DISPLAY('MYINEXIT ENTERED.');    DISPLAY('MYINEXIT PNAME = "' || TRIM(PNAME) || '".'); /*<-- It usually dies here */    DISPLAY('MYINEXIT PBUFPTR = X''' || hex(PBUFPTR) || '''.');        DISPLAY('MYINEXIT PBUFLEN = X''' || hex(PBUFLEN) || '''.');        DISPLAY('MYINEXIT PRECLEN = X''' || hex(PRECLEN) || '''.');        DISPLAY('MYINEXIT FLGS = X''' || hex(FLGS) || '''.');              DISPLAY('MYINEXIT DATAPTR = X''' || hex(DATAPTR) || '''.');      

    This almost works. The displays show the expected values.

    The problem I am seeing is between the PL/I initialization from "main()" and the LE Heap Management.

    The "dataptr" variable passed is updated with the address of an allocated persistent block of storage.

    The storage is allocated using the "ALLOCATE(size)" BUILTIN function, and is used on every call to this routine to hold state information.

    When the program returns to ISPF, the storage is freed, so the intended persistent storage is not actually persistent.

    How do I allocate storage so that LE & PL/I do not free the storage when the program exits?

    Any suggestions would be appreciated.

    Frank

    fomyers