Index: palm/trunk/SOURCE/read_var_list.f90
===================================================================
--- palm/trunk/SOURCE/read_var_list.f90	(revision 256)
+++ palm/trunk/SOURCE/read_var_list.f90	(revision 257)
@@ -2,6 +2,7 @@
 
 !------------------------------------------------------------------------------!
-! Actual revisions:
+! Current revisions:
 ! -----------------
+! Output of messages replaced by message handling routine.
 ! +canyon_height, canyon_width_x, canyon_width_y, canyon_wall_left, 
 ! canyon_wall_south, conserve_volume_flow_mode, dp_external, dp_level_b, 
@@ -84,13 +85,11 @@
     binary_version = '3.4'
     IF ( TRIM( version_on_file ) /= TRIM( binary_version ) )  THEN
-       IF ( myid == 0 )  THEN
-          PRINT*, '+++ read_var_list: version mismatch concerning control', &
-                  ' variables'
-          PRINT*, '                   version on file    = "', &
-                  TRIM( version_on_file ), '"'
-          PRINT*, '                   version on program = "', &
-                  TRIM( binary_version ), '"'
-       ENDIF
-       CALL local_stop
+       WRITE( message_string, * ) 'version mismatch concerning control ', &
+                                  'variables',                            &
+                                  '&version on file    = "',              &
+                                  TRIM( version_on_file ), '"',           &
+                                  '&version on program = "',              &
+                                  TRIM( binary_version ), '"'
+       CALL message( 'read_var_list', 'PA0296', 1, 2, 0, 6, 0 )
     ENDIF
 
@@ -100,7 +99,7 @@
     READ ( 13 )  variable_chr
     IF ( TRIM( variable_chr ) /= 'numprocs' )  THEN
-       PRINT*, '+++ read_var_list: numprocs not found in data from prior run', &
-                    ' on PE ', myid
-       CALL local_stop
+       WRITE( message_string, * ) 'numprocs not found in data from prior run ', &
+                                  'on PE ', myid
+       CALL message( 'read_var_list', 'PA0297', 1, 2, 0, 6, 0 )
     ENDIF
     READ ( 13 )  numprocs_previous_run
@@ -112,7 +111,7 @@
     READ ( 13 )  variable_chr
     IF ( TRIM( variable_chr ) /= 'hor_index_bounds' )  THEN
-       PRINT*, '+++ read_var_list: hor_index_bounds not found in data from ', &
-                    'prior run on PE ', myid
-       CALL local_stop
+       WRITE( message_string, * ) 'hor_index_bounds not found in data from ', &
+                                  'prior run on PE ', myid
+       CALL message( 'read_var_list', 'PA0298', 1, 2, 0, 6, 0 )
     ENDIF
     READ ( 13 )  hor_index_bounds_previous_run
@@ -124,7 +123,7 @@
     READ ( 13 )  variable_chr
     IF ( TRIM( variable_chr ) /= 'nz' )  THEN
-       PRINT*, '+++ read_var_list: nz not found in data from prior run on PE ',&
-               myid
-       CALL local_stop
+       WRITE( message_string, * ) 'nz not found in data from prior run on PE ',&
+                                  myid
+       CALL message( 'read_var_list', 'PA0299', 1, 2, 0, 6, 0 )
     ENDIF
     READ ( 13 )  nz
@@ -132,7 +131,7 @@
     READ ( 13 )  variable_chr
     IF ( TRIM( variable_chr ) /= 'max_pr_user' )  THEN
-       PRINT*, '+++ read_var_list: max_pr_user not found in data from ', &
+       WRITE( message_string, * ) 'max_pr_user not found in data from ', &
                     'prior run on PE ', myid
-       CALL local_stop
+       CALL message( 'read_var_list', 'PA0300', 1, 2, 0, 6, 0 )
     ENDIF
     READ ( 13 )  max_pr_user    ! This value is checked against the number of
@@ -142,7 +141,7 @@
     READ ( 13 )  variable_chr
     IF ( TRIM( variable_chr ) /= 'statistic_regions' )  THEN
-       PRINT*, '+++ read_var_list: statistic_regions not found in data from ', &
+       WRITE( message_string, * ) 'statistic_regions not found in data from ', &
                     'prior run on PE ', myid
-       CALL local_stop
+       CALL message( 'read_var_list', 'PA0301', 1, 2, 0, 6, 0 )
     ENDIF
     READ ( 13 )  statistic_regions
@@ -579,8 +578,8 @@
 
           CASE DEFAULT
-             PRINT*, '+++ read_var_list: unknown variable named "', &
-                     TRIM( variable_chr ), '" found in'
-             PRINT*, '                   data from prior run on PE ', myid
-             CALL local_stop
+             WRITE( message_string, * ) 'unknown variable named "',         &
+                                        TRIM( variable_chr ), '" found in', &
+                                        ' data from prior run on PE ', myid 
+             CALL message( 'read_var_list', 'PA0302', 1, 2, 0, 6, 0 )
         END SELECT
 !
@@ -634,7 +633,7 @@
     READ ( 13 )  variable_chr
     IF ( TRIM( variable_chr ) /= 'numprocs' )  THEN
-       PRINT*, '+++ read_parts_of_var_list: numprocs not found in data from ', &
-                    'prior run on PE ', myid
-       CALL local_stop
+       WRITE( message_string, * ) 'numprocs not found in data from prior run ', &
+                                  'on PE ', myid
+       CALL message( 'read_parts_of_var_list', 'PA0297', 1, 2, 0, 6, 0 )
     ENDIF
     READ ( 13 )  numprocs_previous_run
@@ -646,7 +645,7 @@
     READ ( 13 )  variable_chr
     IF ( TRIM( variable_chr ) /= 'hor_index_bounds' )  THEN
-       PRINT*, '+++ read_parts_of_var_list: hor_index_bounds not found in da', &
-                    'ta from prior run on PE ', myid
-       CALL local_stop
+       WRITE( message_string, * ) 'hor_index_bounds not found in data from ', &
+                                  'prior run on PE ', myid
+       CALL message( 'read_parts_of_var_list', 'PA0298', 1, 2, 0, 6, 0 )
     ENDIF
     READ ( 13 )  hor_index_bounds_previous_run
@@ -658,34 +657,30 @@
     READ ( 13 )  variable_chr
     IF ( TRIM( variable_chr ) /= 'nz' )  THEN
-       PRINT*, '+++ read_parts_of_var_list: nz not found in restart data file'
-       CALL local_stop
+       message_string = 'nz not found in restart data file'
+       CALL message( 'read_parts_of_var_list', 'PA0303', 1, 2, 0, 6, 0 )
     ENDIF
     READ ( 13 )  nz_on_file
     IF ( nz_on_file /= nz )  THEN
-       IF ( myid == 0 )  THEN
-          PRINT*, '+++ read_parts_of_var_list: mismatch concerning number of', &
-                       ' gridpoints along z'
-          PRINT*, '                   nz on file    = "', nz_on_file, '"'
-          PRINT*, '                   nz from run   = "', nz, '"'
-       ENDIF
-       CALL local_stop
+       WRITE( message_string, * ) 'mismatch concerning number of ',      &
+                                 'gridpoints along z',                  &
+                                 '&nz on file    = "', nz_on_file, '"', &
+                                 '&nz from run   = "', nz, '"'
+       CALL message( 'read_parts_of_var_list', 'PA0304', 1, 2, 0, 6, 0 )
     ENDIF
 
     READ ( 13 )  variable_chr
     IF ( TRIM( variable_chr ) /= 'max_pr_user' )  THEN
-       PRINT*, '+++ read_parts_of_var_list: max_pr_user not found in restart', &
-                    ' data file'
-       CALL local_stop
+       message_string = 'max_pr_user not found in restart data file'
+       CALL message( 'read_parts_of_var_list', 'PA0305', 1, 2, 0, 6, 0 )
     ENDIF
     READ ( 13 )  max_pr_user_on_file
     IF ( max_pr_user_on_file /= max_pr_user )  THEN
-       IF ( myid == 0 )  THEN
-          PRINT*, '+++ read_parts_of_var_list: number of user profiles on res', &
-                       'tart data file differs from the current run'
-          PRINT*, '                   max_pr_user on file    = "', &
-                  max_pr_user_on_file, '"'
-          PRINT*, '                   max_pr_user from run   = "', &
-                  max_pr_user, '"'
-       ENDIF
+       WRITE( message_string, * ) 'number of user profiles on res', &
+                                  'tart data file differs from the current run', &
+                                  '&max_pr_user on file    = "', &
+                                  max_pr_user_on_file, '"', &
+                                  '&max_pr_user from run   = "', &
+                                  max_pr_user, '"'
+       CALL message( 'read_parts_of_var_list', 'PA0306', 0, 0, 0, 6, 0 )
        tmp_mpru = MIN( max_pr_user_on_file, max_pr_user )
     ELSE
@@ -695,19 +690,17 @@
     READ ( 13 )  variable_chr
     IF ( TRIM( variable_chr ) /= 'statistic_regions' )  THEN
-       PRINT*, '+++ read_parts_of_var_list: statistic_regions not found in ', &
-                    'restart data file'
-       CALL local_stop
+       message_string = 'statistic_regions not found in restart data file'
+       CALL message( 'read_parts_of_var_list', 'PA0307', 1, 2, 0, 6, 0 )
     ENDIF
     READ ( 13 )  statistic_regions_on_file
     IF ( statistic_regions_on_file /= statistic_regions )  THEN
-       IF ( myid == 0 )  THEN
-          PRINT*, '+++ read_parts_of_var_list: WARNING: statistic regions on', &
-                       ' restart data file differ from the current run'
-          PRINT*, '                            statistic regions on file    = "', &
-                  statistic_regions_on_file, '"'
-          PRINT*, '                            statistic regions from run   = "', &
-                  statistic_regions, '"'
-          PRINT*, '                            statistic data may be lost!'
-       ENDIF
+       WRITE( message_string, * ) 'statistic regions on restart data file differ ',& 
+                                  'from the current run',&
+                                  '&statistic regions on file    = "', &
+                                  statistic_regions_on_file, '"', &
+                                  '&statistic regions from run   = "', &
+                                   statistic_regions, '"', &
+                                  '&statistic data may be lost!'
+       CALL message( 'read_parts_of_var_list', 'PA0308', 0, 1, 0, 6, 0 )
        tmp_sr = MIN( statistic_regions_on_file, statistic_regions )
     ELSE
@@ -731,9 +724,9 @@
           CASE ( 'average_count_pr' )
              READ ( 13 )  average_count_pr
-             IF ( average_count_pr /= 0  .AND.  myid == 0 )  THEN
-                PRINT*, '+++ read_parts_of_var_list:'
-                PRINT*, '    WARNING: inflow profiles not temporally averaged.'
-                PRINT*, '    Averaging will be done now using ', &
-                        average_count_pr, ' samples.'
+             IF ( average_count_pr /= 0 )  THEN
+                WRITE( message_string, * ) 'inflow profiles not temporally averaged.',&
+                                           '&Averaging will be done now using ',      &
+                                           average_count_pr, ' samples.'
+                CALL message( 'read_parts_of_var_list', 'PA0309', 0, 1, 0, 6, 0 )
              ENDIF
 
