|
> > It all makes sense, thanks por pointing me out how to handle the char(*) api > parms, but im still having problems. In the prototype i've changed: > First of all, before we spend too much more time... Why aren't you just calling this procedure the "normal" way? like this: eval Rtn = MAX(4: 3: 10) I'm assuming you've found some special need for calling it with this API instead? Your prototype looks good to me. Make sure you're initializing the 'array' variable so that each element is set to 1. (Otherwise, you it won't know that you're trying to pass integers instead of pointers) > Parameter1, Parameter2 and Parameter3 are now passed as integers (so the api > will get the address of that integer values), but know i get the MCH3601 > error saying that the pointer has no valid address. > Is the api converting the address i send to a char(*) correctly ? > I'm kinda lost... It's not trying to convert anything. char(*) is just used because the char data type any accept bytes of any value, and that's what we have here. In reality, all it's doing is passing the address of your variable, no conversion is being done. In the API itself, it's determining what type of data is in the area of memory you specified based on the numbers that you've put into the array of parameter formats. So, when the number is 1, it knows that your addresses point to integers, and it therefore treats the corresponding parameter as an integer. Since I don't have the service program you're trying to call, I made a quick test program that has a MAX procedure, and tried calling it. The following code works on my system: D DS_P_Error DS D zBytp 10I 0 inz(%size(P_Error)) D zByta 10I 0 D zErrid 7 D zError 1 D zExdta 240 D P_Error 256 overlay(DS_P_Error) d array s 10i 0 dim(3) inz(1) d qzruclsp pr extpgm('QZRUCLSP') d QualSrvPgm... d 20a const d ExportName... d 4096A options(*varsize) const d ReturnValueFormat... d 10i 0 const d ParametersFormat... d 10i 0 const dim(3) d NumberOfParameters... d 10i 0 const d ErrorCode... d 256a d ReturnValue... d 10I 0 options(*nopass) d Parameter1... d 10I 0 options(*nopass) d Parameter2... d 10I 0 options(*nopass) d Parameter3... d 10I 0 options(*nopass) D p1 s 10I 0 inz(4) D p2 s 10I 0 inz(3) D p3 s 10I 0 inz(10) D rtn s 10I 0 c callp qzruclsp('TEST LIBSCK': c 'MAX'+x'00': c 1: array: 3: p_error: c Rtn: p1: p2: p3) c* callp SndAPIErr(p_error) c if zByta > 0 c 'error' dsply zErrid c else c 'success' dsply Rtn c endif c eval *inlr = *on * * This is the service program that I'm calling (as a test, * since I don't have the BABIB service program available. * H NOMAIN D MAX PR 10I 0 D p1 10I 0 value D p2 10I 0 value D p3 10I 0 value P MAX B EXPORT D MAX PI 10I 0 D p1 10I 0 value D p2 10I 0 value D p3 10I 0 value D themax s 10I 0 c eval themax = p1 c if p2 > themax c eval themax = p2 c endif c if p3 > themax c eval themax = p3 c endif c return themax P E
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.