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.