C%%%CATINIT.FOR C-- CATINIT -- EDINBURGH VERSION -- 17FEB87 C-- C-- VAX files are set up by this program with names coded here C-- data file CATDATA C-- author indx CATINDA C-- title indx CATINDT C-- subject indx CATINDS C-- recordno indx CATINDN C-- control file CATCONT C-- C-- C-- C-- The on-line catalogue requires a data-record file, and 4 index C-- files. These are contiguous files, with record length 256 bytes C-- ( 1 sector on Perkin-Elmer systems). C-- C-- Logical units: C-- 2 Data record file C-- 5 terminal input C-- 6 terminal output C-- 3 Author index C-- 4 Title index C-- 8 Subject index C-- 9 SRN index (seq. record number) C-- 10 CONTROL file ( this is needed by loading prog CATLD02 ) C-- C-- C-- VAX file names here CHARACTER*24 FNAME(5) DATA FNAME/'CATDATA','CATINDA','CATINDT', * 'CATINDS','CATINDN' / CHARACTER*24 CONFIL DATA CONFIL /'CATCONT'/ C----------------------------------------------------------------- CHARACTER*256 BUFF INTEGER INUM(8),NOVA,NOVS,NOVT,NOVN,NDHI,MAXDAT, LUTAB(4) DATA LUTAB/3,4,8,9/ C----------------------------------------------------------------- WRITE(6,*) 'CATINIT --- EDINBURGH initialisation -- 17FEB87' C-- C-- prompt for data file max sector C-- WRITE(6,*) 'Input maximum sector for data-file (unit 1) ' READ(5,*) MAXDAT C-- C-- prompt for file parameters C-- WRITE(6,900) 900 FORMAT('Input 8 numbers defining max. key, max. sector',/, *' for Author, Title, Subject and SRN indexes') READ(5,*) INUM C-- C-- Initialise control file. This is a single 80 byte record in C-- a file by itself. It is used to control multiple access by users C-- making amendmendments or additions to the file. It is not C-- relevant to the search program CATS05 & not the same as the C-- 'log' of user activities in CATS05. OPEN( UNIT=10, FILE=CONFIL,ACCESS='DIRECT',STATUS='NEW', * FORM='FORMATTED',RECL=80, IOSTAT=ISTAT,NREC=1) WRITE(6,*) 'Created control file with name ', CONFIL WRITE(10,950,REC=1) 950 FORMAT(' ') CLOSE (10) C-- C-- create data file here and C-- initialise data-records C-- BUFF=' ' C-- VAX OPEN record length is 256 = 64 words OPEN(UNIT=2,RECL=256,FORM='UNFORMATTED',ACCESS='DIRECT', * FILE=FNAME(1), STATUS='NEW', NREC=MAXDAT) WRITE(6,*) 'Created data-file name=', FNAME(1) WRITE(6,*) 'DATA-FILE setting sectors to blank 1-', MAXDAT DO 10 I=1,MAXDAT WRITE(2,REC=I) BUFF 10 CONTINUE WRITE(6,*) 'Data-file initialised. Now setting indexes to hex00' C-- C-- initialise indexes on units 3,4,8,9 C-- DO 11 J=1,4 LU=LUTAB(J) MAXSEC=INUM(J*2) CALL INIT(LU,FNAME(J+1),MAXSEC) 11 CONTINUE C-- C-- all indexes now initialised C-- C-- C-- set highest data-file sector used NDHI=1 C-- write and 'end-of-file' record I=NDHI+1 BUFF='|END OF FILE|' WRITE(2,REC=I) BUFF C-- C-- write parameters to sector 1 of data-file. This is used by all C-- catalogue programs to access the data correctly C-- C-- C-- set highest overflow used for the A,T,S,N indexes NOVA=INUM(1) NOVT=INUM(3) NOVS=INUM(5) NOVN=INUM(7) C-- BUFF=' ' WRITE(BUFF,9900) INUM,NOVA,NOVT,NOVS,NOVN,NDHI,MAXDAT 9900 FORMAT(14I8) C-- set marker showing all is OK (bytes 255:256) BUFF(255: ) = 'OK' WRITE(2,REC=1) BUFF C-- C-- initialisation complete C-- WRITE(6,902) 902 FORMAT(//,' All files initialised OK') CALL EXIT END C----------------------------------------------------------------- C---- INIT ------------------------------------------------------- C----------------------------------------------------------------- SUBROUTINE INIT(LU,FNAME,MAXSEC) C-- C-- C-- initialise the index files -- set all bytes to hex 00 C-- C-- ARGUMENTS C-- C-- LU integer logical unit for file C-- FNAME character string defining file name (new file expected C-- MAXSEC integer value of maximum sector in file INTEGER LU,MAXSEC CHARACTER*24 FNAME C-- INTEGER INDWD(64) COMMON/B/ INDWD C-- VAX OPEN record length is 256 bytes = 64 words OPEN(UNIT=LU,RECL=256,FORM='UNFORMATTED',ACCESS='DIRECT', * FILE=FNAME, STATUS='NEW',NREC=MAXSEC) WRITE(6,*) 'Created index file name = ' ,FNAME DO 10 II=1,64 10 INDWD(II)=0 DO 200 I=1,MAXSEC WRITE(LU,REC=I) INDWD 200 CONTINUE WRITE(6,9001) LU, MAXSEC 9001 FORMAT(' LU=', I3,' Index sectors initialised in range 1-',I8) RETURN END SUBROUTINE EXIT STOP END