SUBROUTINE GETSPEC1(TOL,TITLE,FMT,AM,MAXTYPE,MAXDIMB,NTYP,NDIMB, * NDIMB1,IGEE,MAXITER,MONBFLAG) C C To read and check control file parameters before parameter labels C CHARACTER TITLE(2)*72,FMT(2)*72,FL7*20,FL8*20,FL9*20,AM*4,A1*1 REAL*8 TOL LOGICAL Q1,MONBFLAG KERR=0 KOUT=0 C WRITE(*,'(/A\)') ' Please enter the name of the control file: ' READ(*,'(A)') FL7 INQUIRE(FILE=FL7,EXIST=Q1) IF (Q1) THEN OPEN(7,FILE=FL7,IOSTAT=K) IF (K.NE.0) THEN WRITE(*,'(2A)') * ' PROGRAM TERMINATED: Control file cannot be opened - ',FL7 STOP ENDIF ELSE WRITE(*,'(2A)') * ' PROGRAM TERMINATED: Control file cannot be found - ',FL7 STOP ENDIF C READ(7,'(4(A/),3(I4/),F8.0/I4/A/I1/A/A/A))',ERR=51,END=51) TITLE, * FL8,FL9,NTYP,NDIMB,NDIMB1,TOL,MAXITER,A1,IGEE,AM,FMT C IF (FL9.NE.'CON'.AND.FL9.NE.'PRN') THEN INQUIRE(FILE=FL9,EXIST=Q1) IF (Q1) THEN WRITE(*,'(2A)') ' ERROR: Output file already exists - ',FL9 KERR=1 ENDIF ENDIF IF (KERR.EQ.0) THEN OPEN(9,FILE=FL9,STATUS='NEW',IOSTAT=K) IF (K.NE.0) THEN WRITE(*,'(2A)') ' ERROR: Output file cannot be opened - ',FL9 KERR=1 ELSE KOUT=1 ENDIF ENDIF C INQUIRE(FILE=FL8,EXIST=Q1) IF (Q1) THEN OPEN(8,FILE=FL8,IOSTAT=K) IF (K.NE.0) THEN WRITE(*,'(2A)') ' ERROR: Data file cannot be opened - ',FL8 IF (KOUT.NE.0) * WRITE(9,'(2A)') ' ERROR: Data file cannot be opened - ',FL8 KERR=1 ENDIF ELSE WRITE(*,'(2A)') ' ERROR: Data file cannot be found - ',FL8 IF (KOUT.NE.0) * WRITE(9,'(2A)') ' ERROR: Data file cannot be found - ',FL8 KERR=1 ENDIF C IF (NTYP.LT.1.OR.NTYP.GT.MAXTYPE) THEN WRITE(*,'(A,I2,A,I3)') ' ERROR: Number of classes specified (', * NTYP,') not in range 1 to',MAXTYPE IF (KOUT.NE.0) * WRITE(9,'(A,I2,A,I3)') ' ERROR: Number of classes specified (', * NTYP,') not in range 1 to',MAXTYPE KERR=1 ENDIF IF (NDIMB.LT.1.OR.NDIMB.GT.MAXDIMB) THEN WRITE(*,'(A,I2,A,I3)') * ' ERROR: Number of parameters specified (', NDIMB, * ') not in range 1 to',MAXDIMB IF (KOUT.NE.0) WRITE(9,'(A,I2,A,I3)') * ' ERROR: Number of parameters specified (', NDIMB, * ') not in range 1 to',MAXDIMB KERR=1 ENDIF IF (NDIMB1.LT.1.OR.NDIMB1.GT.NDIMB) THEN WRITE(*,'(A,I2,A,I3)') * ' ERROR: Number of main effects specified (',NDIMB1, * ') not in range 1 to',NDIMB IF (KOUT.NE.0) WRITE(9,'(A,I2,A,I3)') * ' ERROR: Number of main effects specified (',NDIMB1, * ') not in range 1 to',NDIMB KERR=1 ENDIF IF (TOL.LE.0.0) THEN WRITE(*,'(A,F8.6,A)') * ' ERROR: Convergence tolerance specified (',TOL, * ') not greater than zero' IF (KOUT.NE.0) WRITE(9,'(A,F8.6,A)') * ' ERROR: Convergence tolerance specified (',TOL, * ') not greater than zero' KERR=1 ENDIF IF (IGEE.NE.1.AND.IGEE.NE.2) THEN WRITE(*,'(A,I1,A)') ' ERROR: GEE level specified (',IGEE, * ') not 1 or 2' IF (KOUT.NE.0) * WRITE(9,'(A,I1,A)') ' ERROR: GEE level specified (',IGEE, * ') not 1 or 2' KERR=1 ENDIF IF (AM.NE.'VMZP'.AND.AM.NE.'VMBQ') THEN WRITE(*,'(3A)') * ' ERROR: Method specified for 3rd/4th order monemts (',AM, * ') not VMZP or VMBQ' IF (KOUT.NE.0) WRITE(9,'(3A)') * ' ERROR: Method specified for 3rd/4th order monemts (',AM, * ') not VMZP or VMBQ' KERR=1 ENDIF IF (MAXITER.LT.1) THEN WRITE(*,'(2A,I2,A)') ' ERROR: Maximum convergence iterations ', * 'specified (',MAXITER,') less than 1' IF (KOUT.NE.0) * WRITE(9,'(2A,I2,A)') ' ERROR: Maximum convergence iterations ', * 'specified (',MAXITER,') less than 1' KERR=1 ENDIF MONBFLAG= (A1.EQ.'Y') C IF (KERR.NE.0) THEN WRITE(*,'(/A)') ' PROGRAM TERMINATED: See above error(s)' IF (KOUT.NE.0) * WRITE(9,'(/A)') ' PROGRAM TERMINATED: See above error(s)' STOP ENDIF C WRITE(9,'(7X,2A//2A,T40,2A//1X,A/1X,A//A,I2,T30,A,I2,T60,A,I2/A, * F8.6,T30,A,I2/A,I1,T30,2A//2A/2A)') 'QAQISH: BINARY REGRESSION ', * 'MODELS FOR MULTIPLE-CLASS CLUSTERED DATA',' Control file: ',FL7, * 'Data file: ',FL8,TITLE,' Classes: ',NTYP,'Parameters: ',NDIMB, * 'Main effects: ',NDIMB1,' Convergence value: ',TOL, * 'Convergence iterations: ',MAXITER,' GEE level: ',IGEE, * 'Method: ',AM,' Data : ',FMT(1),' frmat: ',FMT(2) RETURN C 51 WRITE(*,'(2A/2A/A)') ' PROGRAM TERMINATED: Control file was not ', * 'created correctly. There is a',' data read error or the ', * 'end-of-file is read when not expected. Check', * ' specifications before parameter labels.' STOP END