|
Hi Nick,prototype it
Hi All I am having trouble with the QSNDDTAQ API when trying to
d SndDtaQ pr extpgm('QSNDDTAQ')
d QName 10a
d QLibrary 10a
d DataLen 5s 0
d Data 2500a options(*varsize)
d Wait 5s 0 options(*nopass:*omit)
QSNDDTAQ is just a program. Like any program, it'll get fouled up if
you don't pass the parameters it's expecting. Calling QSNDDTAQ with the
wrong parameters won't work any better than calling your own RPG program
if you pass the wrong parameters. The point is: the parameters inhttp://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/apis/qsnddtaq.htm
your prototype MUST match what the program is expecting.
IBM documents what the program is expecting at the following link:
The first four parameters listed on that page are in the "required
parameter group". That means you must always pass them. The first two
parameters are for the data queue name and library, and like your
prototype, they're expecting a 10-character alphanumeric variable.
However, unlike your prototype, they define the field as input-only.
You have it defined as both input and output. To make it input-only,
you should add the CONST keyword.
The third parameter is a packed decimal field, 5 digits long with zero
decimal positions. you have it defined as 5,0, but you have it as zoned
decimal (S) instead of packed decimal (P). They also have it defined as
input-only, whereas you've specified both input and output.
The fourth parameter is alphanumeric, but the API specifies that it can
be any size. You've correctly coded options(*VARSIZE) to allow other
sizes, but you've place a 2500 character limit, and I don't understand
why. Then, once again, you've specified the field as both input and
output despite that the API says it's input-only.
Then, you have a 5th parameter called "wait". I'm not sure where that
came from -- the API doesn't have this parameter.
The API has an optional parameter group that would require a 5th and 6th
parameter to be passed together. If you pass one, you have to passparameter.
both. The parameters are for a length (which is packed 3,0) and a key
(which is char). The word "wait" doesn't really make sense for these
parameters, so I can only assume you coded it by mistake -- perhaps you
were copying the prototype for the QRCVDTAQ API, which has a wait
Also, for some reason, you specified *OMIT on the "wait" parameter,
which the API does not allow (that would cause a null pointer to be
passed to the API -- which doesn't make sense). But this is essentially
a moot point since there isn't a "wait" parameter to begin with.
When all of this is done, your prototype should look like this:
D SndDtaQ PR ExtPgm('QSNDDTAQ')
D QName 10a const
D QLibrary 10a const
D QDataLen 5p 0 const
D Data 65535a const options(*varsize)
Summary:
a) Data len is now packed rather than zoned.
b) All parameters (which are input-only) have been coded as CONST
c) Data now allows up to 64k -- the maximum allowed in RPG at V5R4.
d) The non-existent "wait" parameter has been removed.
The CONST part isn't strictly necessary -- but why not code it? It
makes the prototype more self documenting, and lets you use constants,
expressions, and alternative data types for the parameters, and it's not
particularly difficult to type.
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.