#pragma exception_handler(error,0,_C1_ALL,_C2_ALL)
        .
        .
        .
        .
        return SUCCESS;  /* normal completion */
error:  system("SNDPGMMSG 'OH-UH'");
        return ERROR;    /* abnormal completion, but handled by the #pragma
*/
} /* end function */

I recall that IBM recommends checking return codes from _R... type calls
(native I/O) for performance reasons.  
I use both where I think they're appropriate.
Instead of jump to labeled error section of code, you could just call some
function you code up for generic error handling.

Elvis


-----Original Message-----
From: c400-l-bounces+ebudimlic=centerfieldtechnology.com@xxxxxxxxxxxx
[mailto:c400-l-bounces+ebudimlic=centerfieldtechnology.com@xxxxxxxxxxxx] On
Behalf Of Chris Wolcott
Sent: Monday, October 18, 2004 4:15 PM
To: c400-l@xxxxxxxxxxxx
Subject: [C400-L] How do I do a MONMSG in a 'C' program?

I'm almost done with my C program.  While 'stress testing' it with every
known error, a few seem to cause the system to throw an *ESCAPE message
on it's own.  (_Ropen of a locked file for example.)  Is there a way my
C program can trap these?  I would not care as much if the message
showed on the screen when it ends, but right now it just terminates.  If
it was not for the fact that my program sends a SUCCESS message at the
end that is missing, I'd have no idea the program abended. 

_______________________________________________
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 ...

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