next up previous 282
Next: Resilience
Up: MSG - Message Reporting System
Previous: Intercepting messages


Renewing annulled message tokens

Each call to msgOut, msgOutif or msgLoad will annul any defined message tokens, regardless of the success of the call. This feature of the Message Reporting System ensures that message token names can be re-used with safety in a series of calls to, say, msgOut (e.g. in order to output a table of values line by line). However, under certain circumstances it is useful to be able to restore, or renew, the values of any message tokens set prior to the call to the output routine. This can be done using the subroutine msgRenew. In order to be effective, msgRenew must be called after the call which annulled the required message tokens and prior to any further message token definitions (e.g. using the msgSetx and MSG_FMTx routines). If msgRenew is called with existing message tokens defined, no action is taken.

Here is a Fortran example of the use of msgRenew where a table of values is being output to the user and to a log file:

*  Loop to output the table.
      DO 10 I = 1, NROWS

*     Set a token for each column.
         CALL MSG_FMTI( 'COL1', '1X, I10', I )
         CALL MSG_FMTI( 'COL2', 'I7', HDNUMB( I ) )
         CALL MSG_FMTR( 'COL3', 'F10.5', X( I ) )
         CALL MSG_FMTR( 'COL4', 'F10.5', Y( I ) )
         CALL MSG_FMTR( 'COL5', 'F10.5', Z( I ) )

*     Output a row of the table to the user.
         CALL MSG_OUT( ' ', '^COL1 ^COL2 ^COL3 ^COL4 ^COL5', STATUS )

*     Renew the token values.
         CALL MSG_RENEW

*     Build a string with the row of data.
         CALL MSG_LOAD( ' ', '^COL1 ^COL2 ^COL3 ^COL4 ^COL5', OPSTR,
     :                 OPLEN, STATUS )

*     Write the string to a file.
         WRITE( OPFILE, '( 1X, A )', IOSTAT = IOSTAT ) OPSTR( 1 : OPLEN )
 10   CONTINUE



next up previous 282
Next: Resilience
Up: MSG - Message Reporting System
Previous: Intercepting messages

MERS (MSG and ERR) Message and Error Reporting Systems
Starlink User Note 104
P C T Rees
A J Chipperfield
T Jenness
23 July 2009
E-mail:ussc@star.rl.ac.uk

Copyright © 2009 Science and Technology Facilities Council