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


Renewing annulled message tokens

Each call to MSG_OUT, MSG_OUTIF or MSG_LOAD 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, MSG_OUT (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 MSG_RENEW. In order to be effective, MSG_RENEW must be called after the call which annulled the required message tokens and prior to any further message token definitions (e.g. using the MSG_SETx and MSG_FMTx routines). If MSG_RENEW is called with existing message tokens defined, no action is taken.

Here is an example of the use of MSG_RENEW 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 211
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
22 October 2001
E-mail:ussc@star.rl.ac.uk

Copyright © 2001 Council for the Central Laboratory of the Research Councils