|
I have successfully implemented code to make dynamic calls to service programs, or to bind at runtime; but my parms that I pass come across as jeeeuuunk. By junk I mean that I am reading something else's memory. None of my information that I specify on the dynamic call makes it to the sub procedure. I am assuming that it is possible to dynamically call a service program _and_ pass it values, but let me know if that is not true. I don't need to %Alloc the memory before I make the call do I, that doesn't seem right? I have included the supporting source if anyone can give me some hints. BTW, thanks to the archives and Barbara Morris for getting me this far ;-) -----------------------TESTACTSP-------------------------------------------- ------ H DFTACTGRP(*NO) H BNDDIR('MYBND') /Copy QSource,ObjectCp D myDS DS Qualified Inz D field1 30A D field2 30A D field3 30A D callPgm Pr LikeDS(myDS) D ExtProc(procPtr) D pArch LikeDS(myDS) D procPtr S * ProcPtr /Free myDS.field1 = 'IN'; myDS.field2 = 'IN'; myDS.field3 = 'IN'; procPtr = Object_actSubProc('ACTSPSV': 'ACTIVATEME'); myDS = callPgm(myDS); *InLR = *On; /End-Free --------------------ACTSPFN------------------------------------------------- --- H NoMain D ActivateMe Pr LikeDS(myDS) D pDS Value LikeDS(myDS) D myDS DS Qualified Inz D field1 30A D field2 30A D field3 30A //-------------------------------------- // @Author - Aaron Bartell // @Usage - ds = ActivateMe(myDS); //-------------------------------------- P ActivateMe B Export D ActivateMe PI LikeDS(myDS) D pDS Value LikeDS(myDS) D outDS DS LikeDS(myDS) Inz /Free outDS.field1 = 'Out' + pDS.field1; outDS.field2 = 'Out' + pDS.field2; outDS.field3 = 'Out' + pDS.field3; Return outDS; /End-Free P ActivateMe E -------------------ACTSPSV-------------------------------------------------- ---- StrPgmExp PgmLvl(*Current) Export Symbol(ActivateMe) EndPgmExp ---------------------------------------------------------------------------- ---- ---------------------------------OBJECTFN----------------------------------- -------- H NOMAIN /Copy QSource,ObjectCp //-------------------------------------------------------------- // @Usage: // @Author: Aaron Bartell // @Desc: Activate a sub procedure. // @Created: // @Modified: //-------------------------------------------------------------- P Object_actSubProc... P B Export D Object_actSubProc... D PI * ProcPtr D pSrvPgmName 10A Value D pProcName 50A Value // // Data Structure to set object data // D obj DS Qualified D type 2A Inz(X'0203') D name 30A D reqAuth 2A Inz(X'0000') D sysPtr S * ProcPtr D procPtr S * ProcPtr D actMark S 10I 0 Inz D procNameLen S 10I 0 Inz // // Local Prototypes // D rslvSp2 Pr ExtProc('_RSLVSP2') D pSysPtr Like(sysPtr) D pObj LikeDS(obj) D actBndPgm Pr ExtProc('QleActBndPgm') D pSysPtr Like(sysPtr) D pActMark... D Like(actMark) D pActInfo 10A Options(*Omit) D pActInfoLen 5I 0 Options(*Omit) D pErrCd 10A Options(*Omit) D getExp Pr ExtProc('QleGetExp') D pActMark... D Like(actMark) D pExpNbr 5I 0 Options(*Omit) D pProcNameLen Like(procNameLen) D pProcName Like(pProcName) D pProcPtr Like(procPtr) D pExpType 5I 0 Options(*Omit) D pErrCd 10A Options(*Omit) /Free // Get system pointer to the service program: obj.name = pSrvPgmName; rslvSp2(sysPtr: obj); actBndPgm(sysPtr: actMark: *Omit: *Omit: *Omit); // Then, get a pointer to the procedure: procNameLen = %CheckR(' ':pProcName); getExp( actMark: *Omit: procNameLen: pProcName: procPtr: *Omit: *Omit); Return procPtr; /End-Free P Object_actSubProc... P E -------------------ObjectCp------------------------------------------------- ---- D Object_actSubProc... D Pr * ProcPtr D pSrvPgmName 10A Value D pProcName 50A Value -------------------ObjectSv------------------------------------------------- ---- StrPgmExp PgmLvl(*Current) Export Symbol(Object_actSubProc) EndPgmExp
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.