source: LMDZ6/branches/contrails/libf/phylmd/rrtm/posnam.F90 @ 5428

Last change on this file since 5428 was 1990, checked in by Laurent Fairhead, 11 years ago

Corrections à la version r1989 pour permettre la compilation avec RRTM
Inclusion de la licence CeCILL_V2 pour RRTM


Changes to revision r1989 to enable RRTM code compilation
RRTM part put under CeCILL_V2 licence

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
File size: 2.6 KB
Line 
1SUBROUTINE POSNAM(KULNAM,CDNAML)
2
3!**** *POSNAM* - position namelist file for reading
4
5!     Purpose.
6!     --------
7!     To position namelist file at correct place for reading
8!     namelist CDNAML. Replaces use of Cray specific ability
9!     to skip to the correct namelist.
10
11!**   Interface.
12!     ----------
13!        *CALL* *POSNAM*(..)
14
15!        Explicit arguments :     KULNAM - file unit number (input)
16!        --------------------     CDNAML - namelist name    (input)
17
18!        Implicit arguments :     None
19!        --------------------
20
21!     Method.
22!     -------
23!        See documentation
24
25!     Externals.   None
26!     ----------
27
28!     Reference.
29!     ----------
30!        ECMWF Research Department documentation of the IFS
31
32!     Author.
33!     -------
34!        Mats Hamrud *ECMWF*
35
36!     Modifications.
37!     --------------
38!        Original : 93-06-22
39!        M.Hamrud      01-Oct-2003 CY28 Cleaning
40!        M.Hamrud      01-Dec-2003 CY28R1 Cleaning
41!      R. El Khatib 04-08-10 Apply norms + proper abort if namelist is missing
42!     --------------------------------------------------------------
43
44USE PARKIND1  ,ONLY : JPIM     ,JPRB
45USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
46
47IMPLICIT NONE
48
49INTEGER(KIND=JPIM),INTENT(IN)    :: KULNAM
50CHARACTER(LEN=*)  ,INTENT(IN)    :: CDNAML
51
52
53CHARACTER (LEN = 40) ::  CLINE
54CHARACTER (LEN =  1) ::  CLTEST
55
56INTEGER(KIND=JPIM) :: ILEN, IND1, ISTATUS, ISCAN
57REAL(KIND=JPRB)    :: ZHOOK_HANDLE
58
59#include "abor1.intfb.h"
60
61!      -----------------------------------------------------------
62
63!*       1.    POSITION FILE
64!              -------------
65
66IF (LHOOK) CALL DR_HOOK('POSNAM',0,ZHOOK_HANDLE)
67
68CLINE='                                        '
69REWIND(KULNAM)
70ILEN=LEN(CDNAML)
71ISTATUS=0
72ISCAN=0
73print *,'On cherche a lire:',CDNAML
74DO WHILE (ISTATUS==0 .AND. ISCAN==0)
75  READ(KULNAM,'(A)',IOSTAT=ISTATUS) CLINE
76! print *,'CLINE,ISTATUS= ',CLINE,ISTATUS
77  SELECT CASE (ISTATUS)
78  CASE (:-1)
79    CLINE='POSNAM:CANNOT LOCATE '//CDNAML//' '
80    CALL ABOR1(CLINE)
81  CASE (0)
82    IF (INDEX(CLINE(1:10),'&') == 0) THEN
83      ISCAN=0
84    ELSE
85      IND1=INDEX(CLINE,'&'//CDNAML)
86      IF (IND1 == 0) THEN
87        ISCAN=0
88      ELSE
89        CLTEST=CLINE(IND1+ILEN+1:IND1+ILEN+1)
90        IF (   (LGE(CLTEST,'0').AND.LLE(CLTEST,'9')) &
91         & .OR.(LGE(CLTEST,'A').AND.LLE(CLTEST,'Z')) ) THEN
92          ISCAN=0
93        ELSE
94          ISCAN=1
95        ENDIF
96      ENDIF
97    ENDIF
98  CASE (1:)
99    CLINE='POSNAM:READ ERROR IN NAMELIST FILE'
100    CALL ABOR1(CLINE)
101  END SELECT
102ENDDO
103BACKSPACE(KULNAM)
104
105!     ------------------------------------------------------------------
106
107IF (LHOOK) CALL DR_HOOK('POSNAM',1,ZHOOK_HANDLE)
108END SUBROUTINE POSNAM
Note: See TracBrowser for help on using the repository browser.