FLASH-X
Doxygen Generated Documentation From Interface Source Code
ut_getFreeFileUnit.F90
Go to the documentation of this file.
1!! NOTICE
2!! Copyright 2022 UChicago Argonne, LLC and contributors
3!!
4!! Licensed under the Apache License, Version 2.0 (the "License");
5!! you may not use this file except in compliance with the License.
6!!
7!! Unless required by applicable law or agreed to in writing, software
8!! distributed under the License is distributed on an "AS IS" BASIS,
9!! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10!! See the License for the specific language governing permissions and
11!! limitations under the License.
12!!
25integer function ut_getFreeFileUnit ()
26
28
29 implicit none
30
31 logical :: connected
32 integer :: number
33!
34!
35! ...Get a free unit number within range 7-999.
36!
37!
39
40 do number = 7,999
41 inquire (UNIT = number, OPENED = connected)
42 if (.not.connected) then
43 ut_getFreeFileUnit = number
44 exit
45 end if
46 end do
47!
48!
49! ...Abort, if none found.
50!
51!
52 if (ut_getFreeFileUnit == 0) then
53 call Driver_abort('[ut_getFreeFileUnit] ERROR: no free unit number < 1000 found')
54 end if
55!
56!
57! ...Ready!
58!
59!
60 return
61end function ut_getFreeFileUnit
integer function ut_getFreeFileUnit()