/[MITgcm]/MITgcm/eesupp/src/mdsfindunit.F
ViewVC logotype

Contents of /MITgcm/eesupp/src/mdsfindunit.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download)
Mon Nov 26 00:13:05 2012 UTC (12 years, 7 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint65, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e
Changes since 1.2: +44 -38 lines
avoid reserved unit numbers (errorMessageUnit, scrUnit1, eeDataUnit ...)

1 C $Header: /u/gcmpack/MITgcm/eesupp/src/mdsfindunit.F,v 1.2 2006/08/22 18:57:53 ce107 Exp $
2 C $Name: $
3
4 #include "CPP_EEOPTIONS.h"
5
6 SUBROUTINE MDSFINDUNIT( ioUnit, myThid )
7 C OUT:
8 C ioUnit (integer) :: unit number
9 C
10 C MDSFINDUNIT returns a valid, unused unit number for f77 I/O
11 C The routine stops the program is an error occurs in the process
12 C of searching the I/O channels.
13 C
14 C Created: 03/20/99 adcroft@mit.edu
15
16 IMPLICIT NONE
17
18 #include "EEPARAMS.h"
19
20 C Arguments
21 INTEGER ioUnit
22 INTEGER myThid
23 C Local
24 INTEGER ii
25 LOGICAL op
26 INTEGER ios
27 CHARACTER*(MAX_LEN_MBUF) msgBuf
28 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
29
30 C Sweep through a valid range of unit numbers
31 ioUnit=-1
32 DO ii=9,999
33 IF ( ioUnit.EQ.-1 ) THEN
34 C- skip reserved unit numbers
35 IF ( ii.NE.errorMessageUnit
36 & .AND. ii.NE.standardMessageUnit
37 & .AND. ii.NE.scrUnit1 .AND. ii.NE.scrUnit2
38 & .AND. ii.NE.eeDataUnit .AND. ii.NE.modelDataUnit
39 & ) THEN
40 INQUIRE(unit=ii,iostat=ios,opened=op)
41 IF ( ios.NE.0 ) THEN
42 WRITE(msgBuf,'(A,I4)')
43 & ' MDSFINDUNIT: inquiring unit number =', ii
44 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
45 & SQUEEZE_RIGHT, myThid )
46 WRITE(msgBuf,'(A)')
47 & ' MDSFINDUNIT: inquire statement failed!'
48 CALL PRINT_ERROR( msgBuf, myThid )
49 STOP 'ABNORMAL END: S/R MDSFINDUNIT'
50 ENDIF
51 IF ( .NOT.op ) THEN
52 ioUnit=ii
53 ENDIF
54 ENDIF
55 ENDIF
56 ENDDO
57
58 C Was there an available unit number
59 IF ( ioUnit.EQ.-1 ) THEN
60 WRITE(msgBuf,'(A)')
61 & ' MDSFINDUNIT: could not find an available unit number!'
62 CALL PRINT_ERROR( msgBuf, myThid )
63 STOP 'ABNORMAL END: S/R MDSFINDUNIT'
64 ENDIF
65
66 RETURN
67 END

  ViewVC Help
Powered by ViewVC 1.1.22