C
      SUBROUTINE DATINP(DOM,NOM,ML,NL,DNS,VP,VS,THK,LS,SDEP,LO,ODEP
     *                 ,MOB,NOB,ROB,RAD)
C
      IMPLICIT REAL*8(A-H,O-Z)
      COMPLEX*16 VP(ML),VS(ML)
      DIMENSION DNS(ML),THK(ML),ROB(MOB)
      CHARACTER FNAME*30
      COMMON / CN / C1,N1,C2,N2
C
C *** INPUT OF SOIL DATA ***
C
      WRITE(*,*)
      WRITE(*,1000)
   10 WRITE(*,1010)
      READ(*,'(A)')FNAME
      IF(FNAME(1:1).EQ.' ')GOTO 10
 1000 FORMAT( ' From SUBROUTINE DATINP :')
 1010 FORMAT(/' Enter Soil Data File Name ',\)

      OPEN (7,FILE=FNAME)
      READ(7,1200)NL
      DO 100 IL=1,NL
        READ(7,1210)DNS(IL),VPP,VSS,THK(IL),QF
        VP(IL)=VPP*DCMPLX(1.D0,0.5D0/QF)
        VS(IL)=VSS*DCMPLX(1.D0,0.5D0/QF)
  100 CONTINUE
      CLOSE(7)
 1200 FORMAT(I10)
 1210 FORMAT(5F10.0)
C
C *** DATA ECHO ***
C
      WRITE(*,2000)NL
      DO 200 IL=1,NL
        WRITE(*,2010)IL,DNS(IL),VP(IL),VS(IL),THK(IL)
  200 CONTINUE
 2000 FORMAT(/' Total Layers Number            =',I5/
     *       /' Layer Num., Density , Vp(real), Vp(imag)'
     *        ', Vs(real), Vs(imag),Thickness')
 2010 FORMAT(I5,5X,6F10.3)
C
   20 WRITE(*,3000)
      READ(*,*)DOM,NOM
 3000 FORMAT(/' Enter Delta Omega and Omega Number        ? :',\)
C
      WRITE(*,4000)
      READ(*,*)C1
      WRITE(*,4010)
      READ(*,*)C2
      WRITE(*,4020)
      READ(*,*)N1
      WRITE(*,4030)
      READ(*,*)N2
C
 4000 FORMAT(/' Enter the lowest phase vel. C1        : ',\)
 4010 FORMAT( ' Enter the second phase vel. C2(>C1)   : ',\)
 4020 FORMAT( ' Enter div. num. for int. (0-OM/C2)    : ',\)
 4030 FORMAT( ' Enter div. num. for int. (OM/C2-OM/C1): ',\)
C
C *** INPUT OF SOURCE DEPTH ***
C
   30 WRITE(*,5000)NL
      READ(*,*)LS
      IF(LS.EQ.0)GOTO 30
      IF(LS.GT.NL)GOTO 30
      WRITE(*,5010)THK(LS)
      READ(*,*)SDEP
 5000 FORMAT(/' Total layers number =',I5,
     *       /' Enter source layer number (from top layer) : ',\)
 5010 FORMAT( ' Source layer thickness =',F10.4,
     *       /' Enter source depth from upper boundary     : ',\)
C
C *** INPUT OF OP DEPTH ***
C
   40 WRITE(*,5100)NL
      READ(*,*)LO
      IF(LO.EQ.0)GOTO 40
      IF(LO.GT.NL)GOTO 40
      WRITE(*,5110)THK(LO)
      READ(*,*)ODEP
 5100 FORMAT(/' Total layers number =',I5,
     *       /' Enter OP layer number (from top layer)     : ',\)
 5110 FORMAT( ' Source layer thickness =',F10.4,
     *       /' Enter OP depth from upper boundary         : ',\)
C
C *** INPUT OF OB DATA ***
C
   50 WRITE(*,6000)
      READ(*,*)NOB
      IF(NOB.GT.MOB)THEN
        WRITE(*,*)'NOB > MOB !!! : Re-Enter NOB : MOB=',MOB
        GOTO 50
      END IF
      IF(NOB.EQ.0)GOTO 50
C
      DO 300 I=1,NOB
        WRITE(*,6010)I
        READ(*,*)ROB(I)
  300 CONTINUE
      WRITE(*,6020)
      READ(*,*)RAD
      RAD=RAD*0.01745329252D0
C
 6000 FORMAT(/' Enter Number of OB Point               : ',\)
 6010 FORMAT( ' Enter R-axis of OB Point of Num. =',I3,'  : ',\)
 6020 FORMAT(/' Enter Angle of OB from X-axis (degree) : ',\)
C
C *** CHECK *** 
C
      WRITE(*,7000)
      READ(*,*)IY
      IF(IY.NE.0)GOTO 20
 7000 FORMAT(/' Is all data OK? (Yes=0 enter) : ',\)
C
      WRITE(*,*)
C
      RETURN
      END
