program filman c********************************************************************** c c FILMAN.TSK c c This program (running as the task FIL...) transmits the stored c file specification to the user task on receipt of a request. c This task is not permanently active, but is requested by the c user task to run when a file open request is to be made. A loop c is entered to exhaust all such requests in the receive queue. c c Version 1.00 May 1982 c c Steve Thompson c School of Chemical Engineering c Olin Hall c Cornell University c Ithaca NY 14853 c (607) 256 3895 c c*********************************************************************** include 'filparam.inc' c logical filopn integer*2 recbuf(15) c data filopn / .false. / c c-------Explicit call to ASSIGN to avoid calling ourselves. c call assign(5,'TI:') c c-------Modify default OTS error handling c call errset(28,.true.,.false.,.true.,.false.) ! Open errors call errset(29,.true.,.false.,.true.,.false.) ! ditto call errset(30,.true.,.false.,.true.,.false.) ! ditto call errset(35,.true.,.false.,.true.,.false.) ! Segment error on read c c-------Get some data or exit c 100 call receiv(,recbuf,,idsw) ! Get some data if(idsw.ne.1)then if(filopn)close(unit=1) call exst(1) endif c c-------Verify logical unit number c lun = recbuf(3) if((lun.le.0).or.(lun.gt.maxlun))then type 910,lun recbuf(3) = 0 go to 200 endif c c-------Open data base file and read record c call getrec if(.not.filopn)call openf(filopn) if(.not.filopn)go to 100 read(unit=1,rec=recnum) record do 10 i = 1,8 recbuf(i+2) = record(i,lun) 10 continue 200 call send(recbuf(1),recbuf(3),,idsw) go to 100 c c-------Format statements c 910 format(' FILMAN -- *WARNING* Illegal lun - ',I6) end subroutine getrec c********************************************************************* c c This routine gets information about TI:, and sets up the c pointer recnum for proper access to the data base file. c c********************************************************************** include 'filparam.inc/nolist' c dimension lunbuf(6) c c-------Get logical unit information on TI: (lun=5) c call getlun(5,lunbuf,idsw) if(idsw.ne.1)then type 901 call exst(4) endif if((lunbuf(1).eq.'TT').or.(lunbuf(1).eq.'VT'))go to 100 type 902,lunbuf(1) call exst(4) 100 recnum = ishft(ishft(lunbuf(2),8),-8) + 1 if(lunbuf(1).eq.'VT')recnum = recnum + maxtty + 1 return c c-------Format statements c 901 format(' FILMAN -- *FATAL* Get unit information failed') 902 format(' FILMAN -- *FATAL* TI: device is unknown - ',A2) end subroutine openf(filopn) logical filopn c********************************************************************** c c This routine is called to open the data base file. If there are c any errors, a severe error exit is taken after the fifth retry. c There is a 1-second pause between tries. c c********************************************************************** c itry = 0 10 itry = itry + 1 open(unit=1,file='LB:[1,7]FILESPEC.SYS',status='old', 1 access='direct',readonly,err=100) filopn = .true. return 100 if(itry.eq.5)go to 501 ! Hard error call mark(3,1,2,idsw) ! Mark time, flag #3 if(idsw.ne.1)return ! If MRKT$ fails, just return call waitfr(3) ! Wait for event flag #3 go to 10 c c-------Error returns c 501 type 901 call exst(4) c c-------Format statements c 901 format(' FILMAN -- Open error on data base file') end