In the error parameter that is returned are two 4 byte values.  The first 
4 bytes is the size of the error structure, the second 4 bytes can be used 
to determine of an error occures (usually).  The error structure also 
return the errid that  you can use to check.

I usuall setup the call as a  procedure type call.

 ** 
 * Error structure work variables. 
DG0_$GenErrDS     DS 
D G0_#BytPrv                    10I 0 Inz(%Len(G0_$GenErrDS)) 
D G0_#BytAvl                    10I 0 Inz(0) 
D G0_$ErrID                      7 
D G0_$Resv                       1 
D G0_$ErrDsc                   240        (this value can be bigger)    



Callp QUSROBJD(parms: G0_$GenErrDS)

If G0_#BytAvl > 0
  do something
endif













Bobby.

Robert Hicks
Combinatorics Consulting Company
Tel.: (248) 347 - 7222, ext. 222
Fax: (248) 347 - 7227
Email:  Robert.Hicks@xxxxxxxxxxxxxxxx






Carlos Kozuszko <ckozuszko@xxxxxxxxxxxx> 
Sent by: c400-l-bounces+robert.hicks=ccc-michigan.com@xxxxxxxxxxxx
09/10/2003 04:21 PM
Please respond to
C programming iSeries / AS400 <c400-l@xxxxxxxxxxxx>


To
c400-l@xxxxxxxxxxxx
cc

Subject
[C400-L] error handling on API call






I want to call API QUSROBJD to check if an object
exists or not. The API call is working but it sends an
escape message terminating the program when an error
occurs (file not found, etc.). How do i prevent this ?
I want to use the info provided in the error area to
check for the exception ID, but the program blows
everytime the object is not found. When i call this
API from an RPG program the program flow continues
when an error occurs, how do i simulate this behavior
?

Thanks in advance.

Carlos Kozuszko.


#include <stdlib.h>
#include <qsnddtaq.h>
#include <QUSROBJD.h>
#include <qtes.h>

typedef struct {
    int Bytes_Returned;
    int Bytes_Available;
    char Exception_ID[7];
    char Reserved;
    char Exception_Data[240];
} ERRC0100_t;

void main() {
    _TE_NAME_T objType;
    _TE_OBJLIB_T dtaq;
    Qus_OBJD0100_t objInfo;
    ERRC0100_t errInfo;
 
    /* Verificar si existen las colas */
    memcpy(dtaq.lib, "QTEMP     ", 
           sizeof(_TE_NAME_T));
    memcpy(dtaq.obj, "OUT_ABGQ  ", 
           sizeof(_TE_NAME_T));
    memcpy(objType, "*DTAQ     ", 
           sizeof(_TE_NAME_T));
    QUSROBJD(&objInfo, sizeof(objInfo), 
             "OBJD0100", &dtaq, 
             objType, &errInfo);
}


------------
Internet GRATIS es Yahoo! Conexión
4004-1010 desde Buenos Aires. Usuario: yahoo; contraseña: yahoo
Más ciudades: http://conexion.yahoo.com.ar
_______________________________________________
This is the C programming iSeries / AS400 (C400-L) mailing list
To post a message email: C400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.



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-2019 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].