M3EXIT() and m3exitc

Fortran version:

        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

C version:

m3exitc() is a C wrapper calling the Fortran M3EXIT()

    void m3exitc( const char * caller   ,
                  int           jdate   ,
                  int           jtime   ,
                  const char  * exittxt ,
                  int           exitstat ) ;


Generates a completion or error message to the program log indicating the caller, simulation date and time if appropriate (the date and time are omitted from the message if they are zero), and the user-supplied exit text, shuts down the I/O API using SHUT3() to flush files to disk, etc. and kills the program by a CALL EXIT( ERRSTAT )

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.

Fortran Usage:

For Fortran-90 declarations and interface checking:

(See sample programs LATLON or PRESZ for additional usage examples.)

    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 )

C Usage:

    #include "iodecl3.h"
    m3exitc( "ME", jdate, jtime, "Bad vble 'foo'", 37 ) ;
        /*  error message followed by SHUT3(); exit( 37 ) */

Previous: M3ERR

Next: M3MESG

Up: Utility Routines

To: Models-3/EDSS I/O API: The Help Pages