|
Hello all, I've written a *srvpgm to experiment with the RPG-based getter/setter methods discussed in recent newsletters and lists. A simple one with two modules: 'client_getrecord' to retrieve a PF record in to an ExtName DS in the *srvpgm and 'client_getclname' to return a 30-char name to the calling pgm. Everything works well when 'client_getclname' is called from RPGLE, but when called from CLLE it issues 'MCH0602 Boundary alignment of pointer or template not valid.' The debugger shows the *srvpgm is working as expected and the error occurs as soon as the "return" statement is executed - but only when called from CLLE and the returned field is defined in a DSPF referenced in the CL's DCLF. If the returned field is a standalone-field defined with "DCL *CHAR 30" the program executes without error. I was really hoping to rely on the DSPF to handle field lengths and get away from hardcoded CL, but it doesn't look like that'll work here. It seems counterproductive to have to define an intermediate 'workfield' just to make CL happy. Has anyone else found a solution for this? +++++++++++++++++++++++++++++ P CLIENT_getClName... P B Export D CLIENT_getClName... D PI Like( ##Name ) C Return clName P CLIENT_getClName... P E This code works: /free //************************************* // Retrieve client name //************************************* w_Cli = '001'; w_Div = '01'; w_success = CLIENT_getRecord(w_Cli : w_Div ); w_clName = CLIENT_getclName; /end-free This code works: DCL &clNameX *CHAR 30 CALLPRC PRC('CLIENT_GETRECORD') PARM(&sfCli &sfDiv) RTNVAL(&Success) CALLPRC PRC('CLIENT_GETCLNAME') RTNVAL(&clNameX) This code results in MCH0602 (where &clName is defined in the DSPF): DCLF FILE(PROMPT) CALLPRC PRC('CLIENT_GETRECORD') PARM(&sfCli &sfDiv) RTNVAL(&Success) CALLPRC PRC('CLIENT_GETCLNAME') RTNVAL(&clName) Many thanks, JK
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.