Bugfix in AliPoints2Memory
[u/mrichter/AliRoot.git] / GEANT321 / giopa / grfile.F
CommitLineData
fe4da5cc 1*
2* $Id$
3*
4* $Log$
5* Revision 1.1.1.1 1995/10/24 10:21:17 cernlib
6* Geant
7*
8*
9#include "geant321/pilot.h"
10*CMZ : 3.21/02 29/03/94 15.41.20 by S.Giani
11*-- Author :
12 SUBROUTINE GRFILE(LUN,CHFILE,CHOPTT)
13C.
14C. ******************************************************************
15C. * *
16C. * Routine to open a GEANT/RZ data base. *
17C. * *
18C. * LUN logical unit number associated to the file *
19C. * *
20C. * CHFILE RZ file name *
21C. * *
22C. * CHOPT is a character string which may be *
23C. * 'N' To create a new file *
24C. * 'U' to open an existing file for update *
25C. * ' ' to open an existing file for read only *
26C. * 'Q' The initial allocation (default 1000 records) *
27C. * is given in IQUEST(10) *
28C. * 'X' Open the file in exchange format *
29C. * 'I' Read all data structures from file to memory *
30C. * 'O' Write all data structures from memory to file *
31C. * *
32C. * Note: *
33C. * If options 'I' or 'O' all data structures are read or *
34C. * written from/to file and the file is closed. *
35C. * See routine GRMDIR to create subdirectories *
36C. * See routines GROUT,GRIN to write,read objects *
37C. * *
38C. * ==>Called by : <USER> *
39C. * Author R.Brun ********* *
40C. * *
41C. ******************************************************************
42C.
43#include "geant321/gcbank.inc"
44 COMMON/QUEST/IQUEST(100)
45 CHARACTER*(*) CHFILE,CHOPTT
46 CHARACTER*8 CHOPT,CHTOP,CHTAGS(2)
47 CHARACTER*10 CHOPT1,CHOPT2
48 SAVE CHTAGS,CHTOP
49 DATA CHTAGS,CHTOP/'Object','Version',' '/
50C.
51C. ------------------------------------------------------------------
52C.
53*
54 CHOPT=CHOPTT
55 CALL CLTOU(CHOPT)
56 IOPTN=INDEX(CHOPT,'N')
57 IOPTU=INDEX(CHOPT,'U')
58 IOPTQ=INDEX(CHOPT,'Q')
59 IOPTI=INDEX(CHOPT,'I')
60 IOPTO=INDEX(CHOPT,'O')
61 IF(IOPTN.EQ.0.AND.IOPTU.EQ.0)IOPTO=0
62 IF(IOPTN.NE.0)IOPTI=0
63*
64* Open file
65*
66 CHOPT2 = CHOPT//'XW'
67 CHOPT1 = CHOPT//'X'
68 CALL RZOPEN(LUN,CHTOP,CHFILE,CHOPT2,1024,ISTAT)
69 IF(ISTAT.NE.0)GO TO 99
70*
71 IF(IOPTN.NE.0)THEN
72 IF(IOPTQ.NE.0)THEN
73 NQUOT=IQUEST(10)
74 IF(NQUOT.LT.100.OR.NQUOT.GT.100000)NQUOT=1000
75 ELSE
76 NQUOT=1000
77 ENDIF
78 CALL RZMAKE(LUN,CHTOP,2,'HI',CHTAGS,NQUOT,CHOPT1)
79 ELSE
80 CALL RZFILE(LUN,CHTOP,CHOPT1)
81 ENDIF
82*
83* Read/write initialisation structures
84*
85 IF(IOPTI.NE.0)THEN
86 CALL GRIN('INIT',0,' ')
87 ENDIF
88 IF(IOPTO.NE.0)THEN
89 CALL GROUT('INIT',1,' ')
90 ENDIF
91 IF(IOPTI.NE.0.OR.IOPTO.NE.0)THEN
92 CALL RZEND(CHTOP)
93 CLOSE(LUN)
94 ENDIF
95*
96 99 END