Preliminary files for CMake
[u/mrichter/AliRoot.git] / DPMJET / openfile.f
1       SUBROUTINE DPMJET_OPENINP()
2 *
3 *----------------------------------------------------------------------*
4 * Opens a file with a given unit number
5 *
6 *
7 * IOUNIT: Input unit to be assiged to the file
8 * FILNAM: Name of the file
9 *
10 *----------------------------------------------------------------------*
11 *
12       IMPLICIT NONE
13       LOGICAL EXISTS
14       INTEGER LNROOT
15       CHARACTER*1000 FILNAM
16       CHARACTER*1000 CHROOT
17       CHROOT=' '
18       CALL GETENVF('ALICE_ROOT',CHROOT)
19       LNROOT = LNBLNK(CHROOT)
20       IF(LNROOT.LE.0) THEN
21          FILNAM='dpmjet.dat'
22       ELSE
23          FILNAM=CHROOT(1:LNROOT)//'/DPMJET/dpmjet.dat'
24       ENDIF
25       INQUIRE(FILE=FILNAM,EXIST=EXISTS)
26       IF(.NOT.EXISTS) THEN
27          PRINT*,'***********************************'
28          PRINT*,'*           openfile              *'
29          PRINT*,'*        ---------------          *'
30          PRINT*,'*   File dpmjet.dat not found     *'
31          PRINT*,'*         Program STOP            *'
32          PRINT*,'*   Check ALICE_ROOT environment  *'
33          PRINT*,'*           variable              *'
34          PRINT*,'***********************************'
35          STOP
36       ENDIF
37       OPEN (10, FILE="dpmjet.inp", STATUS="OLD")
38       OPEN (23, FILE=FILNAM, STATUS="OLD")
39       RETURN
40       END