PL/I

PL/I

PL/I

 View Only
Expand all | Collapse all

How to load dynamiccal proc and declare them based on loading address?

  • 1.  How to load dynamiccal proc and declare them based on loading address?

    Posted Fri May 12, 2017 06:27 AM

    Hello,
      we are trying to convert a PLX program in a PL/I one due to no more supported
    PLX DB2 SQL precompiler for the CAF interface we are using.
    Now, in doing this, we need to load in storage only one time the DSNHLI2 module,
    store its address and in the subsequent called programs use this address to be able to
    call DSNHLI2.
    in PLX this is realized by using

    PROGRAM A  
    =========

    ?load ep('DSNHLI2') erret(alierr);  
    alierr:;                           
    rfy (r0,r15) rstd;                 
    rc15 = r15;                        
    dsnhli2P = r0;                <======= address                      
    rfy (r0,r15) unrstd;                


    then PROGRAM A call program B and pass as parameter the loaded address dsnhli2P

    in this way PROGRAM B can declare DSNHLI2 as follows:

    PROGRAM B
    ==========
     DSNHLI2      entry based(dsnhLI2p)    é CAF interface routine   
                 valrg(*);

    and can call it without need to load:

    call DSNHLI2(plxsql);


    Now, reading the PL/I manual I was thinking that the corresponding way to do this
    would be to use the FETCH ... but it s is not clear to me how can I declare in PROGRAM B
    the external procedure so that it is based on a passed pointer.
    I know LOAD works in PLX, so that even if more times LOAD is called with no DELETE
    this si not an error and only one copy is saved n storage while a counter is increased,
    so that only when a corresponding number of DELETE is done the module is removed
    from storage. But I have no idea how FETCH works in this case.

    Couls someone help me to understand how can load dynamically an external module and
    then call it is subsequent called external procedure call this load module using the
    passed load address?

    Could someone help me to understand how FETCH works and what happens if I do more FETCH
    without RELEASE?

    The problem is that we should not do FETCH CALL RELaESE all time as these procedures are
    invoked 50000, 1000000 times in our batch  program and could affect performance
    loading and removing each time from storage a module.

    thanks a lot for all the help you could provide me

    ciao
       Rossella

                              

    RoxDonadeo


  • 2.  Re: How to load dynamiccal proc and declare them based on loading address?

    Posted Fri May 12, 2017 03:46 PM

    Rossella,

    You can simply define DSNHLI2 as options(fetchable), and the run-time will take care of the rest in a manner similar to a DLL function. You don't need to do an explicit fetch or release, and you'll only have one instance of DSNHLI2 loaded for the life of your enclave.

    More labor intensive alternatives are

    - FETCH {entry-constant}, followed by an assignment of the {entry-constant} to an {entry-variable};

    - FETCH {entry-constant} SET({pointer}) if you should really need a pointer to the fetched module. You can convert the pointer via the ENTRYADDR pseudovariable to make an entry-variable.

    You can then can CALL {entry-variable}(...), but you'll be the the one that needs to communicate the pointer or entry-variable around your application.

    See the "PL/I Language Reference" for further details.

    Bernie 

     

    http://www.ibm.com/support/docview.wss?uid=swg27036735

    brataj