subroutine hec_online_getfile c c routine to request name of run file for online monitoring c c use cfopen (cernlib) instead of regular fortran open c because regular open will not see links to files staged from c cern tape. c syntax: c call cfopen(lundes,medium,nwrec, 'w', 0, 'run201.dat', istat) c lundes = lun descriptor (output) c medium = 0 = disk file, 1 = tape file etc. c nwrec = record length c 'w' = file is for writing, reading, etc. c 0 = meaningless c implicit none c c datacard common c include'hec_par.inc' !shared parameters include'hec_datacard.inc' ! datacard values include'hec_online.inc' ! online common c c local variables c integer ierr, ios,lundes c c checkfile flag set to true c runfile = .true. ios = 0 irun=0 c c query keyboard for run number to analyze in normal mode. In c "autorun" mode the run number is supplied by the calling c script and this prompt is unneccessary. c if (auto_run .eq. 0) then print *, ' *** ENTER RUN NUMBER TO MONITOR (0 to exit)' read(5,*,iostat=ios) irun if (ios .ne. 0) then print *, ' *** Error reading input from keyboard' runfile = .false. irun = -1 return endif else irun = auto_rnnum endif c if (irun .gt. 0) then c c check that data file for this run actually exists c if(irun.lt.10000)then write(infname,8)irun else write(infname,9)irun endif print*, infname print *, ' *** hec_online_getfile searching ', + 'for data file ',infname c c see if file exists (try to open it) c call cfopen(lundes,0,6120, 'r', 0, infname, ierr) if (ierr .ne. 0) then print *, ' *** Cannot open named file: file does not exist' runfile = .false. irun = -1 return endif c c rewind and close file c call cfrew(lundes,0) call cfclos(lundes,0) c c opened successfully c print *, ' *** Successfully opened ',infname c c initialize epio for reading c call hec_io_ini c endif c 8 format('data/run_',I4,'.dat') 9 format('data/run_',I5,'.dat') return end