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



In the below example, is Proc1(ptr) really passing a pointer to a pointer?
That would be bad, and if that's what is happening then that could be the
problem with the API call.




                                                                           
             "Wilt, Charles"                                               
             <CWilt@xxxxxxxxxx                                             
             om>                                                        To 
             Sent by:                  "RPG programming on the AS400 /     
             rpg400-l-bounces@         iSeries" <rpg400-l@xxxxxxxxxxxx>    
             midrange.com                                               cc 
                                                                           
                                                                    Fax to 
             01/27/2006 10:39                                              
             AM                                                    Subject 
                                       RE: CONST vs. VALUE on a pointer    
                                       parameter                           
             Please respond to                                             
              RPG programming                                              
              on the AS400 /                                               
                  iSeries                                                  
             <rpg400-l@midrang                                             
                  e.com>                                                   
                                                                           
                                                                           




CONST = pass by constant reference ( a pointer in other words)
VALUE = pass by value

Using the following:
D data         s       10a
D ptr          s         *    inz(%addr(data))

D proc1        pr
D  in                    *    const

D proc2        pr
D  in                    *    value

D proc3        pr
D  in                    *

Then:
Proc1(data) --> passes the addr of data, doesn't allow data to be
changed
Proc1(ptr) --> passes the addr of ptr, doesn't allow ptr to be changed

Proc2(data) --> won't compile, since the value of data is 10A and we
said we're passes a pointer.
Proc2(ptr) --> passes the value of ptr, ie. the addr of data. Allows
data to be changed.

Proc3(data) --> passes the addr of data, allows data to be changed
Proc3(ptr) --> passes the addr of ptr, allows ptr to be changed

These two calls are equivalent:
Proc2(ptr)
Proc3(data)

Proc1(data) is almost the same, except data can't be changed.



HTH,

Charles Wilt
--
iSeries Systems Administrator / Developer
Mitsubishi Electric Automotive America
ph: 513-573-4343
fax: 513-398-1121


> -----Original Message-----
> From: rpg400-l-bounces@xxxxxxxxxxxx
> [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of darren@xxxxxxxxx
> Sent: Friday, January 27, 2006 10:09 AM
> To: rpg400-l@xxxxxxxxxxxx
> Subject: CONST vs. VALUE on a pointer parameter
>
>
> I attempted to call the Qp0lGetAttr API to get the creation
> date of a file
> in the IFS.  I used the following prototype.
>
>      D Qp0lGetAttr     PR            10I 0 ExtProc('Qp0lGetAttr')
>      D  path                           *   Const
>      D  AttArrPtr                      *   Const
>      D  BuffPtr                        *   Const
>      D  BuffLenSent                  10U 0 Const
>      D  BuffLenNeed                  10U 0
>      D  BuffLenRet                   10U 0
>      D  FollowLink                   10U 0 Value
>
>
> The above did not work, apparently because I had used Const.
> The program
> compiles fine both ways, but the API returns a -1 indicating
> that some kind
> of error occurred.  I can toggle the 'path' parameter from
> Value to Const
> and get it to fail, with everything else as shown below.  My
> reason for
> using Const was to document that the variable being pointed
> to was an Input
> only variable per the API's specs.  Can someone in the know,
> educate me as
> to the different between Const and Value in this case?
>
>      D Qp0lGetAttr     PR            10I 0 ExtProc('Qp0lGetAttr')
>      D  path                           *   Value
>      D  AttArrPtr                      *   Value
>      D  BuffPtr                        *   Value
>      D  BuffLenSent                  10U 0 Value
>      D  BuffLenNeed                  10U 0
>      D  BuffLenRet                   10U 0
>      D  FollowLink                   10U 0 Value
>
> --
> 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 ...

Replies:

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.