I started off with the attachments as a character field but changed it to a pointer (admittedly, it should have been by VALUE, not CONST, I agree) because the documentation confusingly refers to the 6th and 8th parameters needing to be "null". If I define this as character, I'm not sure it's possible to omit these parameters and still use the error structure. Or would *OMIT be allowable here?

Pete


"Scott Klement" <midrange-l@xxxxxxxxxxxxxxxx> wrote in message news:mailman.2946.1224400035.30674.midrange-l@xxxxxxxxxxxxxxx
Hi Peter,

Sorry about this, but I'm going to pick your prototype apart ;)

D CrtSndMail PR EXTPROC('QtmsCreateSendEmail')
D iaRecipients 32767A CONST OPTIONS(*VARSIZE)

You'll have problems if iaRecipients ever exceeds 32767 bytes, since
you've defined this as CONST, which gives RPG the right to make a copy
of it into temporary memory, and pass the copy. If it makes a copy,
it'll only pass the first 32767 bytes... So if there's any chance of
exceeding that size, remove the CONST.


D iuRcvCount 10U 0 CONST

This should be 10I 0, not 10U 0. That's not the cause of your problems,
but the API does designate this as a signed field, not unsigned, so
you're best off using 10I 0.


D iaRcvFormat 8A CONST
D iaNote 32767A CONST OPTIONS(*VARSIZE)
D iaNoteFormat 8A CONST
D ipAttachments...
D * CONST OPTIONS(*NOPASS)

You have ipAttachments this defined as a pointer -- but the API is
expecting character. That's simply incorrect, and will produce the
dreaded "unexpected results".

You may be thinking of passing a pointer by VALUE. You see, passing a
normal field by reference causes the address of the field to be passed
(under the covers). Therefore, passing a pointer by value is equivalent
to passing a regular field by reference.

However, in this case, you've passed a pointer by reference -- which is
in no way equivalent to passing a character field.



D iuAtcCount 10U 0 CONST OPTIONS(*NOPASS)

Again, should be 10I 0.


D ipAtcFormat * CONST OPTIONS(*NOPASS)

Again, this should be a character field, not a pointer.



EVAL apierror:x
00000 00000110 00000014 E3C3D7F5 F3F0F8F0 - ........TCP53080
00010 A2A49797 40404040 40404040 40404040 - supp

It seems strange that debug is only showing the first 32 bytes of a
sructure that you claim is 272 bytes long?! Or did you abbreviate it
when you posted it to the mailing list?

At any rate, the crucial problems I see are with the two parameters where you have them defined as pointers instead of character.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.