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



Mark, 

Won't that address become bogus when the first program terminates (with LR
on)? Oh, I see, you're calling the CLP from RPG#1.  CLP just passes the
address of parm on to RPG#2.  

My take on the problem was that he has a clp wrapper that calls RPG#1, then
RPG#2.  If this is the case, then CLP should call RPG#1, which then calls
RPG#2 directly.  Still, seems cludgy to me....


Eric DeLong
Sally Beauty Company
MIS-Project Manager (BSG)
940-898-7863 or ext. 1863



-----Original Message-----
From: MWalter@xxxxxxxxxxxxxxx [mailto:MWalter@xxxxxxxxxxxxxxx]
Sent: Tuesday, October 28, 2003 1:26 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: %Addr & Passing Parameter



If you must, you can pass the paramter pointer parameter through the CL as
a 16 byte character field. Here is a quick example

RPG 1:
 *************** Beginning of data *************************
 Dfield            S             10    INZ('THIS FIELD')
 Dcltst            PR                  extpgm('TSTPTRC1')
 D                                 *   const
  /free
   cltst(%addr(field));
   *inlr = *on;
  /end-free

CLP 1:

 *************** Beginning of data ******
 pgm parm(&addr)
 dcl var(&addr) type(*Char) len(16)
 call pgm(tstptr2) parm(&addr)
 endpgm

RPG2:

 *************** Beginning of data *******************************
 Dproc             PR                  extpgm('TSTPTR2')
 D p_field                         *   const
 Dproc             PI
 D p_field                         *   const
 Dfield            s             10    based(p_field)
  /free
    dsply field;
    return;
  /end-free

dsply returns 'THIS FIELD'


Thanks,

Mark

Mark D. Walter
Senior Programmer/Analyst
CCX, Inc.
mwalter@xxxxxxxxxx
http://www.ccxinc.com


|---------+----------------------------->
|         |           "Carel Teijgeler" |
|         |           <coteijgeler@chell|
|         |           o.nl>             |
|         |           Sent by:          |
|         |           rpg400-l-bounces@m|
|         |           idrange.com       |
|         |                             |
|         |                             |
|         |           10/28/2003 02:12  |
|         |           PM                |
|         |           Please respond to |
|         |           RPG programming on|
|         |           the AS400 /       |
|         |           iSeries           |
|         |                             |
|---------+----------------------------->
 
>---------------------------------------------------------------------------
---------------------------------------------------|
  |
|
  |       To:       rpg400-l@xxxxxxxxxxxx
|
  |       cc:
|
  |       Subject:  Re: %Addr & Passing Parameter
|
 
>---------------------------------------------------------------------------
---------------------------------------------------|




Jean,

Why have a CLP in the middle of the call? Just call the second RPGLE
programme directly. Or is there a logical explanation for the CLP?

Besides that:
1) in the CL you have defined the second parm as DEC, but in the prototype
it is CHAR. I assmue the &OKFlag is not a passed parm. In the second
programme the second parm is also DEC: a mismatch of data types.

2) You also use an array based on a pointer. Do you allocate memory for the
array?

3) The two arrays in the second programme do not have the same length.

Regards,
Carel Teijgeler.

*********** REPLY SEPARATOR  ***********

On 28-10-03 at 10:10 Jean Reksodiputro wrote:

>I'm trying to figure out how to pass an arrray from RPGLE to a CLP (just
pass
> thru) and to another RPGLE, but I'm stuck now. If the pointer guru, Scott
> Klement, or Hans & Barbara can help it would be great.
>
>Here's the thing:
>I have a wrapper CLP, where I declared this vars:
>   Dcl  &ArrWhs      *Char     1
>   Dcl  &NbrWhs      *Dec     (3 0)   0
>   Dcl  &OkFlag      *Char     1
>
>It will call an RPGLE pgm and it will build an array to be passed back.
Here's  the prototype:
>
> *Entry parms Prototype: - Array of Authorized Divisio(>Divspwhchkr
PR
>D                        2  0 dim(99)
>D                        3
>Divspwhchkr     PI
>D  p1_AuthWhs                    2  0 dim(99)
>D  p1_NbrWhs                     3
>
>Then the CL will pass that array to be used for another RPGLE program:
>d ReleaseEm       pr                  EXTPGM('IVSPRELSER' )
>d                                2  0 dim(99)
>d                                3  0
>d                                1
>d ReleaseEm       pi
>d  p1_whsArr                     2  0 dim(99)
>d  p1_numArr                     3  0
>d  p1_exitType                   1
>
>In this program I get the Address of the parameter and try to move it to
be used for the program:
>d ptr_whsArr      s               *
>d whsArr          s              2  0 dim(99) based(ptr_whsArr)
>d atWhsArr        s              3  0 dim(99) inz(*hival)
>d xx              s              3  0 inz(0)
>
>c                   if        p1_numArr > 0
>c                   if        %addr(p1_whsArr) <> *null
>c                   eval      ptr_whsArr = %addr(p1_whsArr)
>
>c                   for       xx = 1 by 1 to p1_numArr
>c                   eval      atWhsArr(xx) = whsArr(xx)
>c                   endfor
>
>c                   endif
>c                   endif
>
>But, once I assign the Address of p1_whsArr parameter, I got a corrupted
array.
> Hence, I got a decimal data error. Can someone tell me where I got it
wrong? Do
> I really need to declare the variable in CL as big as %ELEM * %LEN?



_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.






_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.




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.