× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: QSYSINC not in V3R7M0 what to do?
  • From: "paul cunnane" <paul@xxxxxxxxxxx>
  • Date: Tue, 3 Oct 2000 09:45:22 +0100

> I'm attempting to write an API interface for the QSPRWTRI API.
> So far I have coded the parameter specs, but then I get to the
> Error Code which is a pointer character to an error structure.
> Reading the manual on the API points me to "Error Code Parameter"
> in the System API Reference.  Going there, there are 2 possible
> structures that can be returned, and to make it even more fun,
> yet another character pointer the the Exception data is used.

Jim, I think you are making this more complicated than it needs to be.  When
coding API calls, I tend to use a structure like:

  * API error structure.
 D error           ds           116
 D  bytesProv              1      4b 0 inz(0)
 D  bytesAvail             5      8b 0 inz(0)
 D  messageID              9     15a
 D  pad1                  16     16a
 D  messageData           17    116a

I set the bytesProv value to 0 if I don't want to bother with the error
handling myself, and to 15 if I do.  When bytesProv is 0, the API throws an
exception if something goes wrong.  When it is 15, the API returns normally
(even with an error condition) and the messageID contains the escape message
that was sent by the API.

If you need the message data as well, code a bigger structure and set the
bytesProv value accordingly.

The CHAR * in the API manual does not mean that you need to pass a pointer
(your C heritage is showing!).  It simply means that a variable-sized
character value can be passed to the API.

--
Paul


+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

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.