Hiya Ken,

I'm not familiar with the QsyAddServerEntry API... and have never tried to call it. But, off the top of my head (and based on the C definition you posted) I'd assume the prototype should look like this:

D QsyAddServerEntry...
D PR ExtProc('QsyAddServerEntry')
D User * value options(*string)
D Server 200A const options(*varsize)
D ServerLen 10i 0 value
D UserId 1000A const options(*varsize)
D UserIdLen 10i 0 value
D Passwd 696a const options(*varsize)
D PasswdLen 10i 0 value
D ErrorCode 32767a options(*varsize)

The important bits:

1) The C definition of char[10] on the first parm does not mean that no null-terminator is needed. C will still add a x'00' to the string. The documentation is vague about whether the x'00', so I'd use options(*string) just to be safe. (Unless you ask IBM and they tell you otherwise.)

2) When a C prototype does not specify a pointer or an array (such as with the "int" parameters in this C prototype) they are always passed by value. VALUE is the default. In RPG, you have to add the VALUE keyword, or it'll pass by reference. (This was the biggest issue I had with your original prototype)

3) The error code parameter can be much larger than 256. Not sure why you picked such a small number.

Anyway, give this a try...



On 11/8/2011 11:47 AM, Danforth, Ken wrote:
I want to use the QsyAddServerEntry API in an RPG program, but I'm
having a heck of a time getting it to work. I suspect my prototype is
defined incorrectly. I've created loads of prototypes for system APIs
but this one is stumping me. The IBM documentation for the API looks
like this:

Add Server Authentication Entry (QsyAddServerEntry) API Syntax for
QsyAddServerEntry:

#include<qsysvrfn.h>

void QsyAddServerEntry
(char User_profile[10],
char *Server_name,
int Length_of_server_name,
char *User_ID,
int Length_of_user_ID,
char *Password,
int Length_of_password,
void *Error_code);


My prototype currently looks like this:

DAddSvrAutE PR ExtProc('QsyAddServerEntry')
D User 10a Const
D Server 200a Const Options(*Varsize)
D ServerLen 10i 0 Const
D UserId 1000a Const Options(*Varsize)
D UserIdLen 10i 0 Const
D Password 696a Const Options(*Varsize)
D PasswordLen 10i 0 Const
D APIErr 256a Options(*Varsize)

I'm getting error code CPF3C1D stating that the length of parameter 3 is
invalid.

Can anyone tell me what the RPG prototype should look like for this API?

Ken Danforth
kdanforth@xxxxxxxxxx


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.