× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Don't use CL for DSPF. My opinion only but using CL for DSPF always ends up 
being a nightmare. When I had to do things like this, I simply created a 
standard RPG program to do things like get a parameter. Then I would just 
insert the fields I needed and away I went. 

The other issue is that I always use unique named fields in a display file and 
I always issue a move into those fields. Using the same names for program 
fields as display file fields is just a great way to create a program that is a 
pain to maintain. We ended up with I_xxxx, O_xxxx, B_xxxx for field names I for 
input, O for output and B for both fields. 

I believe strongly in explicit moves, not implicit. It takes a bit more effort 
but it sure saves time in the long run.
 
Again my opinions only. 

-----Original Message-----
From: John [mailto:jking@xxxxxxxxxxx]
Sent: Monday, February 14, 2005 12:43 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: MCH0602 Boundary alignment error whille calling *srvpgm from
CLLE


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 thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.