PROGRAM CONTROL C C Program to create control file for input to the program QAQISH C CHARACTER TITLE(2)*72,FMT(2)*72,LBL*16,DFILE*20,PFILE*20,AM*4,A1*1 REAL*8 B,TOL DIMENSION IB(99),IX(99) LOGICAL Q1 DATA IZERO/0/ C DO 5 I=1,22 5 WRITE(*,'(A)') WRITE(*,'(2A//2A\)') ' Welcome to CONTROL, a program to create ', * 'a QAQISH run control file.',' Enter the label of the control ', * 'file to be created --> ' READ(*,'(A)') DFILE INQUIRE(FILE=DFILE,EXIST=Q1) IF (Q1) THEN WRITE(*,'(2A\)') ' This file already exists. Do you want to ', * 'overwrite it? (Y/N) --> ' READ(*,'(A)') A1 IF (A1.NE.'Y'.AND.A1.NE.'y') STOP ENDIF OPEN(7,FILE=DFILE) C WRITE(*,'(/2A/2A)') ' On the next two lines, enter a heading ', * 'for the output:',' ------------------------------------', * '------------------------------------' WRITE(*,'(A\)') ' > ' READ(*,'(A)') TITLE(1) WRITE(*,'(A\)') ' > ' READ(*,'(A)') TITLE(2) C WRITE(*,'(/A\)') ' Enter the label for the data file --> ' READ(*,'(A)') DFILE WRITE(*,'(/A\)') ' Enter the label for the output file --> ' READ(*,'(A)') PFILE C WRITE(*,'(/A\)') ' Enter the number of classes --> ' READ(*,'(BN,I2)') NTYP WRITE(*,'(/A\)') ' Enter the number of regression parameters --> ' READ(*,'(BN,I2)') NDIMB WRITE(*,'(/A\)') ' Enter the number of main effects --> ' READ(*,'(BN,I2)') NDIMB1 C WRITE(*,'(/2A\)') ' Enter the tolerance wanted for convergence ', * '--> ' READ(*,'(BN,F8.6)') TOL WRITE(*,'(/2A\)') ' Enter the maximum number of iterations ', * 'allowed for convergence --> ' READ(*,'(BN,I2)') MAXITER WRITE(*,'(/2A\)') ' Do you want to display the estimates for ', * 'each iteration? (Y/N) --> ' READ(*,'(A)') A1 C WRITE(*,'(/A\)') ' Enter the GEE level wanted (1 or 2) --> ' READ(*,'(BN,I2)') IGEE WRITE(*,'(/2A/A\)') ' Enter the method wanted for the 3rd/4th ', * 'order moment calculations',' (VMZP or VMBQ) --> ' READ(*,'(A)') AM C WRITE(7,'(4(A/),3(I4/),F8.6/I4/A/I1/A)') TITLE,DFILE,PFILE,NTYP, * NDIMB,NDIMB1,TOL,MAXITER,A1,IGEE,AM C WRITE(*,'(/5(2A/)I3,2A/2A/2A/2A))') ' Now enter the FORTRAN', * ' read format for the input data under the dashed', * ' lines below. You may use up to 144 characters (2', * ' 72-character lines).',' Press the ENTER key after entering', * ' each line. If the second line is not',' needed just press', * ' the ENTER key without entering anything. Remember the', * ' FIRST TWO VALUES MUST BE READ AS INTEGERS (I format) and the', * ' FOLLOWING',NDIMB1+1,' VALUES READ AS REAL NUMBERS (F format).', * ' Also remember to ENCLOSE THE',' FORMAT IN PARENTHESES. This', * ' format will not be subject to any error',' checking until an', * ' attempt is made to use it, so enter it carefully.', * ' ------------------------------------', * '------------------------------------' WRITE(*,'(A\)') ' > ' READ(*,'(A)') FMT(1) WRITE(*,'(A\)') ' > ' READ(*,'(A)') FMT(2) WRITE(7,'(A/A)') FMT C DO 15 I=1,NDIMB WRITE(*,'(/A,I3,A\)') ' Enter for parameter',I, * ': Identifying label --> ' READ(*,'(A)') LBL WRITE(*,'(25X,A\)') ' Initial estimate --> ' READ(*,'(D10.0)') B IF (B.GT.99999.D0) B= 99999.0 IF (B.LT.-9999.D0) B= -9999.0 15 WRITE(7,'(A,F10.4)') LBL,B C WRITE(*,'(//2A)') ' Enter MAIN EFFECTS regression ', * 'specifications for each class' DO 20 I=1,NTYP WRITE(*,'(/A,I3,A\)') ' Enter number of dimensions for class',I, * ' --> ' READ(*,'(BN,I2)') IDIM WRITE(7,'(3I4)') I,IZERO,IDIM IF (IDIM.GT.0) THEN DO 19 J=1,IDIM WRITE(*,'(A,I3,A\)') ' Enter parameter index',J,' --> ' READ(*,'(BN,I2)') IB(J) WRITE(*,'(A,I3,A\)') ' Enter regressor index',J,' --> ' 19 READ(*,'(BN,I2)') IX(J) WRITE(7,'(40I2)') (IB(J),IX(J),J=1,IDIM) ENDIF 20 CONTINUE C WRITE(*,'(//2A)') ' Enter WITHIN CLASS ODDS RATIOS ', * 'regression specifications for each class' DO 25 I=1,NTYP WRITE(*,'(/A,I3,A\)') ' Enter number of dimensions for class',I, * ' --> ' READ(*,'(BN,I2)') IDIM WRITE(7,'(3I4)') I,I,IDIM IF (IDIM.GT.0) THEN DO 24 J=1,IDIM WRITE(*,'(A,I3,A\)') ' Enter parameter index',J,' --> ' READ(*,'(BN,I2)') IB(J) WRITE(*,'(A,I3,A\)') ' Enter regressor index',J,' --> ' 24 READ(*,'(BN,I2)') IX(J) WRITE(7,'(40I2)') (IB(J),IX(J),J=1,IDIM) ENDIF 25 CONTINUE C WRITE(*,'(//2A)') ' Enter BETWEEN CLASS ODDS RATIOS ', * 'regression specifications for each class' DO 30 I=1,NTYP-1 DO 30 J=I+1,NTYP WRITE(*,'(/2A,I3,A,I3,A\)') ' Enter number of dimensions for ', * 'classes',I,' and',J,' --> ' READ(*,'(BN,I2)') IDIM WRITE(7,'(3I4)') I,J,IDIM IF (IDIM.GT.0) THEN DO 29 K=1,IDIM WRITE(*,'(A,I3,A\)') ' Enter parameter index',K,' --> ' READ(*,'(BN,I2)') IB(K) WRITE(*,'(A,I3,A\)') ' Enter regressor index',K,' --> ' 29 READ(*,'(BN,I2)') IX(K) WRITE(7,'(40I2)') (IB(K),IX(K),K=1,IDIM) ENDIF 30 CONTINUE C ENDFILE 7 WRITE(*,'(A)') STOP END