1C Copyright 1981-2016 ECMWF. 2C 3C This software is licensed under the terms of the Apache Licence 4C Version 2.0 which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. 5C 6C In applying this licence, ECMWF does not waive the privileges and immunities 7C granted to it by virtue of its status as an intergovernmental organisation 8C nor does it submit to any jurisdiction. 9C 10 11 INTEGER FUNCTION INTPNUM(KONOFF) 12C 13C----> 14C**** INTPNUM 15C 16C Purpose 17C ------- 18C 19C Returns current INTP_CYCLE version number. 20C 21C 22C Interface 23C --------- 24C 25C INUM = INTPNUM(KONOFF) 26C 27C Input 28C ----- 29C 30C KONOFF - switch for displayed message 31C = 0 if display is required on the first call 32C = non-zero if display is not required 33C 34C 35C Output 36C ------ 37C 38C Returns a 6-digit version number, aaabbc, where: 39C aaa = 3-digit major number 40C bb = 2-digit minor number 41C c = 1-digit spare number (normally 0) 42C 43C 44C Method 45C ------ 46C 47C Reads a 6-digit version number from the environment variable 48C INTP_CYCLE. If this does not give a 6-digit number, an internal 49C hard-coded default value is used. 50C 51C On the first call, the function (optionally) displays a message: 52C 53C ************************************** 54C * INTP_CYCLE version number = aaabbc * 55C ************************************** 56C 57C 58C Externals 59C --------- 60C 61C None. 62C 63C 64C Author 65C ------ 66C 67C J.D.Chambers ECMWF May 1998 68C 69C 70C----< 71C ------------------------------------------------------------------ 72C* Section 0. Variables. 73C ------------------------------------------------------------------ 74C 75C 76 IMPLICIT NONE 77C 78#include "common/grprs.h" 79C 80C Function arguments 81C 82 INTEGER KONOFF 83C 84C Local variables 85C 86 INTEGER INUMBER, ICOUNT, IOFFSET 87 SAVE INUMBER, ICOUNT 88 CHARACTER*38 CMESS 89 CHARACTER*20 YNUMBER 90C 91 DATA INUMBER/000010/, ICOUNT/0/ 92 DATA CMESS/'* INTP_CYCLE version number = ****** *'/ 93C 94C ------------------------------------------------------------------ 95C* Section 1. Initialise 96C ------------------------------------------------------------------ 97C 98 100 CONTINUE 99C 100 IF( ICOUNT.EQ.0 ) THEN 101C 102C See if the environment variable has an override value 103C 104 CALL GETENV( 'INTP_CYCLE', YNUMBER) 105 IOFFSET = INDEX( YNUMBER, ' ') 106 IF( IOFFSET.EQ.7 ) THEN 107 READ(YNUMBER,'(I6.6)') INUMBER 108 ENDIF 109C 110C First time through, display the message if required 111C 112 IF( KONOFF.EQ.0 ) THEN 113 WRITE(CMESS(31:36),'(I6.6)') INUMBER 114 WRITE(GRPRSM,*) '**************************************' 115 WRITE(GRPRSM,*) CMESS 116 WRITE(GRPRSM,*) '**************************************' 117 ENDIF 118 ICOUNT = 1 119 ENDIF 120C 121 INTPNUM = INUMBER 122C 123 RETURN 124 END 125