Hi Scott,

Since the thread also discusses passing the error structure to an API call
and preventing corruption of same, your passing of zero "bytes provided"
prevents the API from providing error feedback. I realize this is sample
code and you called it "ErrorNull", but was hoping to see a "correct"
example of using the error structure. Here is an include I use:

// Error code structure.
d errc0100 ds
d errc01bytpro 10i 0 inz(%size(errc0100))
d errc01bytava 10i 0 inz
d errc01excid 7a inz
d errc01resaaa 1a inz(x'00')
d errc01excdta 250a inz

The amended call would be (pardon the spacing):

reset errc0100;
QSYRUSRI( USRI0100
: %size(USRI0100)
: 'USRI0100'
: '*CURRENT'
: errc0100 );

This way before an API call, one can just reset the structure, then check
the bytes available or exception ID after the call.

Only those portions of the message pertaining to the error code structure
were retained.

Hopefully Simon won't beat us up too much about not using expanded names,
such as errc0100_bytes_provided instead of errc01bytpro. :)

--Loyd


On Wed, Dec 23, 2009 at 6:24 PM, Scott Klement
<midrange-l@xxxxxxxxxxxxxxxx>wrote:


Since apparently nobody can come up with a good example of this API, I
threw one together. I probably made it more complicated than I needed
to... but it should (at least) be coded properly.


D QSYRUSRI PR ExtPgm('QSYRUSRI')
D RcvVar 65535a options(*varsize)
D RcvVarLen 10i 0 const
D Format 8a const
D UsrPrf 10a const
D ErrorCode 32783a options(*varsize)

D ErrorNull ds qualified
D BytesProv 10i 0 inz(0)
D BytesAvail 10i 0 inz(0)

QSYRUSRI( USRI0100
: %size(USRI0100)
: 'USRI0100'
: '*CURRENT'
: ErrorNull );


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.