Another way is to use 
#pragma exception_handler

It does a good job intercepting Escape codes.

> -----Original Message-----
> From: Carlos Kozuszko [mailto:ckozuszko@xxxxxxxxxxxx]
> Sent: 10. september 2003. A. 22:22
> To: c400-l@xxxxxxxxxxxx
> 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 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].