* Local Constants: CHARACTER * 12 FUNITS PARAMETER( FUNITS = ' erg/cm2/A/s' ) * Local Variables: CHARACTER * 12 VALUE ... * Output the flux value. WRITE( VALUE, '( 1E12.5 )' ) FLUX CALL MSG_SETC( 'FLUX', VALUE ) CALL MSG_SETC( 'FLUX', FUNITS ) CALL MSG_OUT( 'EXAMPLE_RESULT', : 'Emission flux is ^FLUX.', STATUS )
which would produce the message:
Emission flux is 2.40000E+00 (erg/cm2/A/s).
In this case, the first call to MSG_SETC assigns the supplied character string VALUE to the named token ``FLUX''.
Since this sequence of a formatted internal WRITE followed by a call to MSG_SETC is of general use, it is provided in a set of subroutines of the form:
CALL MSG_FMTx( TOKEN, FORMAT, VALUE )
where FORMAT is a valid Fortran 77 format string which can be used to encode the supplied value, VALUE. As for MSG_SETx, x corresponds to one of the five standard Fortran data types - D, R, I, L and C.
Using MSG_FMTx, the example given above can be performed by:
* Output the flux value. CALL MSG_FMTR( 'FLUX', '1E12.5', FLUX ) CALL MSG_SETC( 'FLUX', FUNITS ) CALL MSG_OUT( 'EXAMPLE_RESULT', : 'Emission flux is ^FLUX.', STATUS )
The use of the MSG_FMTx routines along with their ability to append values of any type to existing tokens is a very powerful tool for constructing tabular output from applications software.
MERS (MSG and ERR) Message and Error Reporting Systems