> I have retrieved the definition from
> QSYSINC for the format , but it does not include the definition of the
> variable length fields at the end of the formats fixed length fields ,
> so I have had to 'guess' at what they should be.
. . .
> The required parameter group has its 1st parameter as the message
> information output (*) , as I see it (and I may be wrong) the format
> fields are placed in here , but you have to implicitly define the length
> of this variable length field via the next parameter!
>
> I have created the below code and hardcoded in a message ID and message
> file and library (for test purposes only) and when running I get the
> error code CPF24B4 in QUSBND.This informs me that a serious error
> occurred whilst addressing the parameter list.
> But it does not tell me which parameter is in error.

Well, first off, just because the API returns data of indeterminate length
doesn't mean it's returning a variable-length field in the sense of a
VARLEN field in a file. You do indeed have to make an educated guess, and
give it a return buffer at least as big as you're ever likely to need. In
any event, as long as you give it an accurate length on your buffer, it
won't return any more data than you give it room for.

Secondly, remember that, except when you're defining fields within a data
structure or a file record, type B fields take a number of digits, rather
than a number of bytes. So "4B0" is a two-byte binary, since 2 bytes will
hold 4 digits, and you would have to define the field as at least 5B0 to
get a 4-byte binary. Worse, type B fields clamp to artificial floors and
ceilings based on number of digits, rather than what that number of bytes
can represent, so that 2-byte 4B0 field runs a gamut from -9999 to +9999,
not -32768 to +32767. For true binary math, there is an "I" format for
signed integers, and a "U" format for unsigned ones, but according to the
ILE RPG reference (I only recently heard about this myself, and haven't
had an opportunity to put it to practical use), they still, at least when
defined as standalone fields, expect a number of digits (either 5 or 10),
rather than the corresponding number of bytes (2 or 4).

--
JHHL



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.