SUBROUTINE M3EXIT( CALLER, JDATE, JTIME, EXITTXT, EXITSTAT ) CHARACTER*(*), INTENT(IN ) :: CALLER ! name of caller INTEGER , INTENT(IN ) :: JDATE ! date YYYYDDD associated with error INTEGER , INTENT(IN ) :: JTIME ! time HHMMSS associated with error CHARACTER*(*), INTENT(IN ) :: EXITTXT ! caller-supplied error message INTEGER , INTENT(IN ) :: EXITSTAT! termination status
m3exitc() is a C wrapper calling the Fortran M3EXIT()
void m3exitc( const char * caller , int jdate , int jtime , const char * exittxt , int exitstat ) ;
Use EXITSTAT=0
to indicate normal successful completion;
nonzero to indicate program failure, in accord with normal
UNIX conventions: see /usr/include/stdlib.h
By convention,
Models-3 standard: Use M3EXIT()
with EXITSTAT
as above for all modeling programs
and tool programs, so that the process management system may
use this success/failure status.
Models-3 standard: construct error messages and caller names so that it is possible to determine uniquely from the text of the error message the line at which the error occurred, and (to the extent possible) the nature of the error.
See also M3ERR() and m3errc(), M3MESG() and m3mesgc(), and M3WARN() and m3warnc() .
#include "iodecl3.h"
if called from C.
JDATE:JTIME represented YYYYDDD:HHMMSS, or are 0.
USE M3UTILIO
(See sample programs LATLON or PRESZ for additional usage examples.)
... USE M3UTILIO ... CALL M3EXIT( 'myprog:mysub', JDATE, JTIME, & 'Corrupted variable BAR', 2 ) C generates error message with JDATE:JTIME to log, C calls SHUT3() and terminates program via EXIT( 2 ) ...
... #include "iodecl3.h" ... m3exitc( "ME", jdate, jtime, "Bad vble 'foo'", 37 ) ; /* error message followed by SHUT3(); exit( 37 ) */ ...
To: Models-3/EDSS I/O API: The Help Pages