Google
 

Trailing-Edge - PDP-10 Archives - decus_20tap3_198111 - decus/20-0079/1spice.for
There are no other files named 1spice.for in the archive.
*DECK L1SPICE
C*    PROGRAM SPICE (INPUT,OUTPUT,TAPE5=INPUT,TAPE6=OUTPUT)
C*           PLEASE NOTE! CHANGES MADE IN THIS PROGRAM BY THE DEC
C*          BENCHMARK GROUP ASSUME THE FOLLOWING FORM; WHEN CHANGING
C*          A LINE, THE ORIGINAL IS COMMENTED WITH A 'C*' AND THE CHANGE
C*          EITHER PRECEDES OR FOLLOWS THE CHANGE. LINES ADDED TO THE
C*          PROGRAM ARE NOT INDEXED IN THE LAST 8 COLUMNS.

C*          THE CHANGES IN VARIABLE SIZES ARE NOT NOTED IN THE PROGRAM
C*          BUT ARE LISTED HERE:
C*          JOBNAM(16)_JOBNAM(8)
C*
C*
C
C  SPICE IS AN ELECTRONIC CIRCUIT SIMULATION PROGRAM THAT WAS DEVELOPED
C  BY THE INTEGRATED CIRCUITS GROUP OF THE ELECTRONICS RESEARCH
C  LABORATORY AND THE DEPARTMENT OF ELECTRICAL ENGINEERING AND
C  COMPUTER SCIENCES AT THE UNIVERSITY OF CALIFORNIA, BERKELEY,
C  CALIFORNIA.  THE PROGRAM SPICE IS AVAILABLE FREE OF CHARGE TO ANY
C  INTERESTED PARTY.  THE SALE, RESALE, OR USE OF THIS PROGRAM FOR
C  PROFIT WITHOUT THE EXPRESS WRITTEN CONSENT OF THE DEPARTMENT OF
C  ELECTRICAL ENGINEERING AND COMPUTER SCIENCES, UNIVERSITY OF
C  CALIFORNIA, BERKELEY, CALIFORNIA, IS AN INFRINGEMENT OF COPYRIGHT
C  LAW AND IS STRICTLY FORBIDDEN.
C
C  VERSION 1
C
      COMMON NODPLC(800),YNL(2001),TSTORE(2001),TRACUR(1700),VN(401),
     1   VNIM1(401),IORDER(401),IUR(402),IUC(800),MATLOC(1800)
      COMMON/INDATA/NUMEL,NUNODS,NUMNOD,NOSTOP,JELCNT(20),LOCATE(21),
     1   ICURNT(21),JUNODE(401),NAME(200),LOCAL(200),MNAME(200)
      COMMON/PARAM/VALUE(200),SOURCE(150),SYMVAL(25,25)
      COMMON/MODELS/NUMMOD,MODNAM(25),KIND(25)
      COMMON/MISCEL/NOGO,IGOOF,NOPRNT,IACCT,JOBNAM(16),RTIMES(15)
      COMMON/CARDS/ID,NUMFLD,ICARD1,KEOF
      COMMON/STATUS/MODE,OMEGA,TIMEE,DELTA,DELOLD,ICALC                         4
      COMMON/KNSTNT/TWOPI,XLOG2,XLOG10,RAD,BOLTZ,CHARGE,VT
      COMMON/POINTS/IUS,ILS,MIRROR,NSTOP,NUMVS,LASTUT,LASTLT
      COMMON/OUTDAT/ROUT(101,10),FREQ(101),IONUM,IONAM(10),IOPND(10),
     1   IONND(10),IOFLG(10),NUMOR(3),IOVAR(10,2),IACVAR(5)
      COMMON/OCNTRL/IPRCOM(10,2),IPLCOM(10,2),PLTLIM(10,2,2),
     1   IACPRT(5,4),IACPLT(5,4),ACPLIM(5,4,2)
      COMMON/ITER/GMIN,PERTOL,VNTOL,IPASS1,IFINAL,ITERNO,IFIND
      COMMON/DC/ICVFLG,ITCELM,TCSTAR,TCSTOP,TCINCR,KSSOP,KINEL,KOVAR
      COMMON/TRAN/JTRFLG,TSTEP,TSTOP,TSTART,NOTINT,STEPS(5),ENDPTS(5),
     1   KFROUT,FORFRE,KFPTS
      COMMON/AC/JACFLG,FSTART,FSTOP,IDFREQ,FINCR,INOISE,NOSPRT,
     1   NOSOUT,NOSIN
      COMMON/TEMPER/TEMPS(6),NUMTEM,ITEMNO
      COMMON/SENVAR/NSENS,KSNOUT(10)
      COMMON/DESIGN/JDSFLG,NSPEC,NDES,ERROR,NOELEM(30),NELTPE(30),
     1   NOUNUM(10),DESVAL(10),WEIGHT(10)
      COMMON/TBLOK/FNDATA(25,5)
C
C
      DIMENSION ADATE(2),ATIME(2)
      DATA IVERSE /4H 1L /
C
C  CONSTANTS AND INITIALIZATION
C
      IACCT=0
      KEOF=0
C*    CALL DATE(KDATE,KTIME)
      CALL DATE(ADATE)
      CALL TIME(ATIME(1),ATIME(2))
      VNIM1(1)=0.0
      JUNODE(1)=0
      IUS=402
      ILS=1202
      MIRROR=800
      BOLTZ=1.38053E-23
      CHARGE=1.602095E-19
      GMIN=1.0E-12
      PERTOL=0.001
      VNTOL=50.0E-6
      TEMPS(1)=27.0
      TWOPI=8.0*ATAN2(1.0,1.0)
      RAD=360.0/TWOPI
      XLOG2=ALOG(2.0)
      XLOG10=ALOG(10.0)
C
C  BEGIN JOB  ...  READ AND PRINT TITLE CARD
C
	OPEN(UNIT=5,DEVICE='DSK',ACCESS='SEQIN',DIALOG='')
	OPEN(UNIT=6,DEVICE='DSK',FILE='SPCOUT.DAT',ACCESS='SEQOUT')
   10 CALL SECOND(T1)
      NOGO=0
      IF (KEOF.EQ.1) GO TO 100
C*    READ (5,11) (JOBNAM(I),I=1,8)
      READ (5,11,END=100) (JOBNAM(I),I=1,16)
C* 11 FORMAT (8A10)
   11 FORMAT (16A5)
C*    IF (EOF,5) 100,20
   20 WRITE (6,21) (JOBNAM(I),I=1,16),ADATE,ATIME,IVERSE                        5
   21 FORMAT (1H1///5(1X,125(1H*)/)///1X,16A5,26X,'-----  SPICE  -----'
     1   ///21X,'DATE  ',A5,A4,12X,'CLOCK  ',A5,A4,12X,'VERSION  ',A4///        IC  77
     2   1X,125(1H*)/////)
      DO 30 I=1,15
   30 RTIMES(I)=0.0
C
C  BEGIN THE JOB
C
      CALL READIN
      IF (NOGO.EQ.1) GO TO 50
      CALL ERRCHK
      IF (NOGO.EQ.1) GO TO 50
      CALL ANLYZE
      IF (NOGO.EQ.1) GO TO 50
C
C  FINISHED
C
      WRITE (6,41)
   41 FORMAT (////5X,'JOB CONCLUDED'//)
      GO TO 60
   50 WRITE (6,51)
   51 FORMAT (////5X,'JOB ABORTED'//)
   60 CALL SECOND(T2)
      ET=T2-T1
C      COST=0.11667*ET
C COST DELETED 6-17-74
      WRITE (6,61) ET
   61 FORMAT (5X,'TOTAL JOB TIME ',F10.3,' SEC'//)
C
C  JOB ACCOUNTING
C
      IF (IACCT.EQ.0) GO TO 10
C*    WRITE (6,66) (JOBNAM(I),I=1,8),KDATE,KTIME,IVERSE
      WRITE (6,66) (JOBNAM(I),I=1,16),ADATE,ATIME,IVERSE
C* 66 FORMAT (1H6/////1X,8A10//5X,'DATE  ',A9,10X,'CLOCK  ',A9,10X,
C*   1   'VERSION  ',A4)
   66 FORMAT (1H1/////1X16A5//5X,'DATE  ',A5,A4,10X,'CLOCK  ',A5,A4,10X,
     1   'VERSION  ',A4)
      WRITE (6,71) NUNODS,NUMNOD,NUMEL,(JELCNT(I),I=7,10)
   71 FORMAT (///3X,'NUNODS',1X,'NUMNOD',2X,'NUMEL',2X,'BJTS',2X,
     1   'DIODES',2X,'JFETS',2X,'MFETS'//7(4X,I3))
      WRITE (6,76) NUMTEM,ICVFLG,JTRFLG,JACFLG,NOSOUT,NOGO
   76 FORMAT (///3X,'NUMTEM',1X,'ICVFLG',1X,'JTRFLG',1X,'JACFLG',1X,
     1   'NOSOUT',3X,'NOGO'//6(4X,I3))
      WRITE (6,81) (RTIMES(I),I=1,10),ET
   81 FORMAT (////10X,6HREADIN,14X,F10.3//10X,5HSETUP,15X,F10.3//
     1   10X,6HTRCURV,14X,F10.3,10X,F10.3//
     2   10X,4HDCAN,16X,F10.3,10X,F10.3//10X,4HACAN,16X,F10.3//
     3   10X,6HTRANAN,14X,F10.3,10X,F10.3//10X,6HOUTPUT,14X,F10.3//
     4   10X,5HTOTAL,15X,F10.3)
      GO TO 10
  100 CALL EXIT
      END
      SUBROUTINE ELPRNT
      COMMON NODPLC(800),YNL(2001),TSTORE(2001),TRACUR(1700),VN(401),
     1   VNIM1(401),IORDER(401),IUR(402),IUC(800),MATLOC(1800)
      COMMON/INDATA/NUMEL,NUNODS,NUMNOD,NOSTOP,JELCNT(20),LOCATE(21),
     1   ICURNT(21),JUNODE(401),NAME(200),LOCAL(200),MNAME(200)
      COMMON/PARAM/VALUE(200),SOURCE(150),SYMVAL(25,25)
      COMMON/MODELS/NUMMOD,MODNAM(25),KIND(25)
      COMMON/MISCEL/NOGO,IGOOF,NOPRNT,IACCT,JOBNAM(16),RTIMES(15)
      COMMON/KNSTNT/TWOPI,XLOG2,XLOG10,RAD,BOLTZ,CHARGE,VT
      COMMON/TRAN/JTRFLG,TSTEP,TSTOP,TSTART,NOTINT,STEPS(5),ENDPTS(5),
     1   KFROUT,FORFRE,KFPTS
C
C
      DIMENSION ITABLE(1),NNODS(10)
      EQUIVALENCE (ITABLE(1),YNL(1))
      DATA NNODS /2,2,2,2,4,2,3,2,3,4/
C*    DATA IPULSE,ISINE,IEXP,IBLNK/5HPULSE,8HSINUSOID,3HEXP,1H /
      DATA IPULSE,ISINE,IEXP,IBLNK/5HPULSE,5HSINUS,3HEXP,1H /
C
C  PRINT LISTING OF ELEMENTS
C
      IF (NOPRNT.EQ.1) GO TO 250
C*    WRITE (6,11) (JOBNAM(I),I=1,8)
      WRITE (6,11) (JOBNAM(I),I=1,16)
C* 11 FORMAT (1H7/////1X,125(1H*)///1X,8A10,26X,'-----  SPICE  -----'
C*   1   ///21X,'CIRCUIT SUMMARY'///1X,125(1H*))
   11 FORMAT (1H1/////1X,125(1H*)///1X,16A5,26X,'-----  SPICE  -----'
     1   ///21X,'CIRCUIT SUMMARY',///1X,125(1H*))
C
C  PRINT EXTERNAL MODELS
C
      ISTART=LOCATE(20)
      ISTOP=LOCATE(21)-1
      IF (ISTART.GT.ISTOP) GO TO 50
      WRITE (6,21)
   21 FORMAT (///1X,5H**** ,'EXTERNAL MODEL ELEMENTS'//6X,'NAME',
     1   4X,'MODEL',4X,'NODES'//)
      DO 40 I=ISTART,ISTOP
      MNAM=MNAME(I)
      LOC=LOCAL(I)-1
      JSTOP=VALUE(I)
      DO 30 J=1,JSTOP
      NODE1=NODPLC(LOC+J)
   30 ITABLE(J)=JUNODE(NODE1)
      WRITE (6,31) NAME(I),MODNAM(MNAM),(ITABLE(J),J=1,JSTOP)
   31 FORMAT (6X,R7,1X,R7,1X,20(I3,2X))
   40 CONTINUE
C
C  PRINT RESISTORS, CAPACITORS, AND INDUCTORS
C
   50 ISTOP=LOCATE(4)-1
      IF (ISTOP.LT.1) GO TO 80
      WRITE (6,51)
   51 FORMAT (///1X,5H**** ,'RESISTORS, CAPACITORS, AND INDUCTORS'//6X,
     1   'NAME',9X,'NODES',15X,'VALUE'//)
      DO 70 I=1,ISTOP
      LOC=LOCAL(I)
      NODE1=NODPLC(LOC)
      NODE2=NODPLC(LOC+1)
      WRITE (6,61) NAME(I),JUNODE(NODE1),JUNODE(NODE2),VALUE(I)
   61 FORMAT (6X,R7,4X,I3,2X,I3,12X,1PE9.2)
   70 CONTINUE
C
C  PRINT VOLTAGE CONTROLLED CURRENT SOURCES
C
   80 ISTART=LOCATE(5)
      ISTOP=LOCATE(6)-1
      IF (ISTART.GT.ISTOP) GO TO 110
      WRITE (6,81)
   81 FORMAT (///1X,5H**** ,'VOLTAGE CONTROLLED CURRENT SOURCES'//6X,
     1   'NAME',9X,1H+,4X,1H-,3X,2H+C,3X,2H-C,4X,'VALUE',6X,'DELAY'//)
      DO 100 I=ISTART,ISTOP
      LOC=LOCAL(I)
      NODE1=NODPLC(LOC)
      NODE2=NODPLC(LOC+1)
      NODE3=NODPLC(LOC+2)
      NODE4=NODPLC(LOC+3)
      MNAM=MNAME(I)
      WRITE (6,91) NAME(I),JUNODE(NODE1),JUNODE(NODE2),JUNODE(NODE3),
     1   JUNODE(NODE4),VALUE(I),SOURCE(MNAM)
   91 FORMAT (6X,R7,4X,4(I3,2X),1PE9.2,2X,E9.2)
  100 CONTINUE
C
C  PRINT TRANSISTORS
C
  110 ISTART=LOCATE(7)
      ISTOP=LOCATE(8)-1
      IF (ISTART.GT.ISTOP) GO TO 140
      WRITE (6,111)
  111 FORMAT (///1X,5H**** ,'BIPOLAR JUNCTION TRANSISTORS'//6X,
     1   'NAME',9X,1HC,4X,1HB,4X,1HE,9X,'MODEL',8X,'AREA'//)
      DO 130 I=ISTART,ISTOP
      LOC=LOCAL(I)
      NODE1=NODPLC(LOC)
      NODE2=NODPLC(LOC+1)
      NODE3=NODPLC(LOC+2)
      WRITE (6,121) NAME(I),JUNODE(NODE1),JUNODE(NODE2),JUNODE(NODE3),
     1   MNAME(I),VALUE(I)
  121 FORMAT (6X,R7,4X,3(I3,2X),7X,R7,2X,F9.3)
  130 CONTINUE
C
C  PRINT DIODES
C
  140 ISTART=LOCATE(8)
      ISTOP=LOCATE(9)-1
      IF (ISTART.GT.ISTOP) GO TO 170
      WRITE (6,141)
  141 FORMAT (///1X,5H**** ,'DIODES'//6X,'NAME',9X,1H+,4X,1H-,14X,
     1   'MODEL',8X,'AREA'//)
      DO 160 I=ISTART,ISTOP
      LOC=LOCAL(I)
      NODE1=NODPLC(LOC)
      NODE2=NODPLC(LOC+1)
      WRITE (6,151) NAME(I),JUNODE(NODE1),JUNODE(NODE2),MNAME(I),
     1   VALUE(I)
  151 FORMAT (6X,R7,4X,2(I3,2X),12X,R7,2X,F9.3)
  160 CONTINUE
C
C  PRINT JFETS
C
  170 ISTART=LOCATE(9)
      ISTOP=LOCATE(10)-1
      IF (ISTART.GT.ISTOP) GO TO 200
      WRITE (6,171)
  171 FORMAT (///1X,5H**** ,'JFETS'//6X,'NAME',9X,1HD,4X,1HG,4X,1HS,
     1   9X,'MODEL',8X,'AREA'//)
      DO 190 I=ISTART,ISTOP
      LOC=LOCAL(I)
      NODE1=NODPLC(LOC)
      NODE2=NODPLC(LOC+1)
      NODE3=NODPLC(LOC+2)
      WRITE (6,121) NAME(I),JUNODE(NODE1),JUNODE(NODE2),JUNODE(NODE3),
     1   MNAME(I),VALUE(I)
  190 CONTINUE
C
C  PRINT MOSFETS
C
  200 ISTART=LOCATE(10)
      ISTOP=LOCATE(11)-1
      IF (ISTART.GT.ISTOP) GO TO 230
      WRITE (6,201)
  201 FORMAT (///1X,5H**** ,'MOSFETS'//6X,'NAME',9X,1HD,4X,1HG,4X,
     1   1HS,4X,1HB,4X,'MODEL',8X,'AREA'//)
      DO 220 I=ISTART,ISTOP
      LOC=LOCAL(I)
      NODE1=NODPLC(LOC)
      NODE2=NODPLC(LOC+1)
      NODE3=NODPLC(LOC+2)
      NODE4=NODPLC(LOC+3)
      WRITE (6,211) NAME(I),JUNODE(NODE1),JUNODE(NODE2),JUNODE(NODE3),
     1   JUNODE(NODE4),MNAME(I),VALUE(I)
  211 FORMAT (6X,R7,4X,4(I3,2X),2X,R7,2X,F9.3)
  220 CONTINUE
C
C  PROCESS INDEPENDENT SOURCES
C
  230 WRITE (6,241)
  241 FORMAT (///1X,5H**** ,'INDEPENDENT SOURCES'//6X,'NAME',
     1   9X,1H+,4X,1H-,13X,'DC VALUE',3X,'AC VALUE',3X,'AC PHASE',
     2   4X,'TRANSIENT'//)
  250 DO 370 ID=4,6,2
      ISTART=LOCATE(ID)
      ISTOP=LOCATE(ID+1)-1
      IF (ISTART.GT.ISTOP) GO TO 370
      DO 360 I=ISTART,ISTOP
      LOC=LOCAL(I)
      NODE1=NODPLC(LOC)
      NODE2=NODPLC(LOC+1)
      MNAM=MNAME(I)
      ITYPE=SOURCE(MNAM+3)
      IF (NOPRNT.EQ.1) GO TO 270
      NAM=IBLNK
      IF (ITYPE.EQ.1) NAM=IPULSE
      IF (ITYPE.EQ.2) NAM=IEXP
C*    IF (ITYPE.EQ.3) NAM=ISINE
      IF (ITYPE.NE.3) GO TO 259
      WRITE (6,262) NAME(I),JUNODE(NODE1),JUNODE(NODE2),SOURCE(MNAM),
     1   SOURCE(MNAM+1),SOURCE(MNAM+4)
  262 FORMAT(6X,R7,4X,I3,2X,I3,12X,1PE9.2,2X,E9.2,2X,E9.2,4X,
     1   'SINUSOID')
      GO TO 270
  259 WRITE (6,261) NAME(I),JUNODE(NODE1),JUNODE(NODE2),SOURCE(MNAM),
     1   SOURCE(MNAM+1),SOURCE(MNAM+4),NAM
  261 FORMAT (6X,R7,4X,I3,2X,I3,12X,1PE9.2,2X,E9.2,2X,E9.2,4X,A8)
  270 IF (JTRFLG.EQ.0) GO TO 350
      IF (ITYPE.EQ.0) GO TO 350
      GO TO (280,300,320),ITYPE
C
C  PULSE SOURCE
C
  280 IF (SOURCE(MNAM+2).EQ.1.0) GO TO 290
      IF (SOURCE(MNAM+7).LT.TSTEP) SOURCE(MNAM+7)=TSTEP
      IF (SOURCE(MNAM+8).LT.TSTEP) SOURCE(MNAM+8)=TSTEP
      IF (SOURCE(MNAM+9).LT.TSTEP) SOURCE(MNAM+9)=TSTEP
      IF (SOURCE(MNAM+10).EQ.0.0) SOURCE(MNAM+10)=TSTOP
      IF (SOURCE(MNAM+10).LT.TSTEP) SOURCE(MNAM+10)=TSTEP
      TEMP=TSTEP+SOURCE(MNAM+8)+SOURCE(MNAM+9)+SOURCE(MNAM+10)
      IF (SOURCE(MNAM+11).EQ.0.0) SOURCE(MNAM+11)=TSTOP
      IF (SOURCE(MNAM+11).LT.TEMP) SOURCE(MNAM+11)=TEMP
  290 IF (NOPRNT.EQ.1) GO TO 350
      JSTART=MNAM+5
      JSTOP=MNAM+11
      WRITE (6,291) (SOURCE(J),J=JSTART,JSTOP)
  291 FORMAT (72X,'VALUES',4X,1PE9.2,3X,E9.2/72X,'DELAY',5X,E9.2/
     1   72X,'RISETIME',2X,E9.2/72X,'FALLTIME',2X,E9.2/72X,'WIDTH',
     2   5X,E9.2/72X,'PERIOD',4X,E9.2)
      GO TO 350
C
C  EXPONENTIAL SOURCE
C
  300 IF (SOURCE(MNAM+2).EQ.1.0) GO TO 310
      IF (SOURCE(MNAM+7).LT.TSTEP) SOURCE(MNAM+7)=TSTEP
      IF (SOURCE(MNAM+8).LT.TSTEP) SOURCE(MNAM+8)=TSTEP
      TEMP=SOURCE(MNAM+7)+TSTEP
      IF (SOURCE(MNAM+9).LT.TEMP) SOURCE(MNAM+9)=TEMP
      IF (SOURCE(MNAM+10).LT.TSTEP) SOURCE(MNAM+10)=TSTEP
  310 IF (NOPRNT.EQ.1) GO TO 350
      JSTART=MNAM+5
      JSTOP=MNAM+10
      WRITE (6,311) (SOURCE(J),J=JSTART,JSTOP)
  311 FORMAT (72X,'VALUES',4X,1PE9.2,3X,E9.2/72X,'DELAY1',4X,E9.2/
     1   72X,'TAU1',6X,E9.2/72X,'DELAY2',4X,E9.2/72X,'TAU2',6X,E9.2)
      GO TO 350
C
C  SINUSOIDAL SOURCE
C
  320 IF (SOURCE(MNAM+2).EQ.1.0) GO TO 330
      IF (SOURCE(MNAM+7).EQ.0.0) SOURCE(MNAM+7)=1.0/TSTOP
      IF (SOURCE(MNAM+8).LT.TSTEP) SOURCE(MNAM+8)=TSTEP
  330 IF (NOPRNT.EQ.1) GO TO 350
      JSTART=MNAM+5
      JSTOP=MNAM+9
      WRITE (6,331) (SOURCE(J),J=JSTART,JSTOP)
  331 FORMAT (72X,'OFFSET',4X,1PE9.2/72X,'AMPLITUDE',1X,E9.2/72X,
     1   'FREQUENCY',1X,E9.2/72X,'DELAY',5X,E9.2/72X,'THETA',5X,E9.2)
  350 SOURCE(MNAM+2)=1.0
  360 CONTINUE
  370 CONTINUE
      DO 420 ID=4,6,2
      ISTART=LOCATE(ID)
      ISTOP=LOCATE(ID+1)-1
      IF (ISTART.GT.ISTOP) GO TO 420
      DO 410 I=ISTART,ISTOP
      MNAM=MNAME(I)
      ITYPE=SOURCE(MNAM+3)
      IF (SOURCE(MNAM+2).EQ.0.0) GO TO 410
      TEMP=SOURCE(MNAM+4)/RAD
      SOURCE(MNAM+4)=SOURCE(MNAM+1)*SIN(TEMP)
      SOURCE(MNAM+1)=SOURCE(MNAM+1)*COS(TEMP)
      IF (JTRFLG.EQ.0) GO TO 400
      IF (ITYPE.EQ.0) GO TO 400
      GO TO (380,400,390),ITYPE
  380 SOURCE(MNAM+8)=SOURCE(MNAM+7)+SOURCE(MNAM+8)
      TEMP=SOURCE(MNAM+9)
      SOURCE(MNAM+9)=SOURCE(MNAM+8)+SOURCE(MNAM+10)
      SOURCE(MNAM+10)=SOURCE(MNAM+9)+TEMP
      GO TO 400
  390 TEMP=SOURCE(MNAM+7)*TWOPI
      SOURCE(MNAM+7)=SOURCE(MNAM+8)
      SOURCE(MNAM+8)=SOURCE(MNAM+9)
      SOURCE(MNAM+9)=TEMP
  400 SOURCE(MNAM+2)=0.0
  410 CONTINUE
  420 CONTINUE
C
C  INVERT RESISTANCE AND INDUCTANCE VALUES
C
      ISTOP=LOCATE(2)-1
      IF (ISTOP.LT.1) GO TO 480
      DO 470 I=1,ISTOP
  470 VALUE(I)=1.0/VALUE(I)
  480 ISTART=LOCATE(3)
      ISTOP=LOCATE(4)-1
      IF (ISTART.GT.ISTOP) GO TO 500
      DO 490 I=ISTART,ISTOP
      VALUE(I)=1.0/VALUE(I)
  490 CONTINUE
C
C  CONSTRUCT NODE TABLE
C
  500 ISTOP=NUNODS+1
      DO 510 I=1,ISTOP
  510 IUR(I)=1
      DO 570 ID=1,10
      ISTART=LOCATE(ID)
      ISTOP=LOCATE(ID+1)-1
      IF (ISTART.GT.ISTOP) GO TO 570
      DO 560 I=ISTART,ISTOP
      JSTART=LOCAL(I)
      JSTOP=JSTART+NNODS(ID)-1
      DO 550 J=JSTART,JSTOP
      NODE=NODPLC(J)
      ISPOT=IUR(NODE+1)
      K=IUR(NUNODS+1)
  520 K=K-1
      IF (K.LT.ISPOT) GO TO 530
      ITABLE(K+1)=ITABLE(K)
      GO TO 520
  530 ITABLE(ISPOT)=I
      K=NODE
      KSTOP=NUNODS+1
  540 K=K+1
      IF (K.GT.KSTOP) GO TO 550
      IUR(K)=IUR(K)+1
      GO TO 540
  550 CONTINUE
  560 CONTINUE
  570 CONTINUE
C
C  CHECK FOR SINGULAR NODES AND CUTSETS OF CAPACITORS AND/OR
C  CURRENT SOURCES
C
      DO 630 I=2,NUNODS
      JSTART=IUR(I)
      JSTOP=IUR(I+1)-1
      IF (JSTART.GE.JSTOP) GO TO 620
      DO 610 J=JSTART,JSTOP
      IELNUM=ITABLE(J)
      IF (IELNUM.LT.LOCATE(2)) GO TO 630
      IF (IELNUM.LT.LOCATE(3)) GO TO 610
      IF (IELNUM.LT.LOCATE(4)) GO TO 630
      IF (IELNUM.LT.LOCATE(6)) GO TO 610
      GO TO 630
  610 CONTINUE
      NOGO=1
      WRITE (6,611) JUNODE(I)
  611 FORMAT (//5X,'----------  INPUT DATA CONTAINS CUTSET OF '
     1   'CAPACITORS AND/OR CURRENT SOURCES AT NODE ',I5//)
      GO TO 630
  620 NOGO=1
      WRITE (6,621) JUNODE(I)
  621 FORMAT (//5X,'----------  LESS THAN TWO ELEMENTS ARE CONNECTED '
     1   'TO NODE ',I5//)
  630 CONTINUE
C
C  PRINT NODE TABLE
C
      IF (NOPRNT.EQ.1) RETURN
      WRITE (6,801)
  801 FORMAT (1H1,5H**** ,'NODE TABLE'//5X,'NODE',5X,
     1   'ELEMENTS CONNECTED')
      ISTOP=IUR(NUNODS+1)-1
      DO 810 I=1,ISTOP
      IELNUM=ITABLE(I)
      ITABLE(I)=NAME(IELNUM)
  810 CONTINUE
      DO 830 I=1,NUNODS
      JSTART=IUR(I)
      JSTOP=IUR(I+1)-1
      IF (JSTART.GT.JSTOP) GO TO 830
      WRITE (6,821) JUNODE(I),(ITABLE(J),J=JSTART,JSTOP)
  821 FORMAT (/3X,I5,3X,15(1X,R7)/(11X,15(1X,R7)))
  830 CONTINUE
      RETURN
      END
      SUBROUTINE CIRCHK
      COMMON/INDATA/NUMEL,NUNODS,NUMNOD,NOSTOP,JELCNT(20),LOCATE(21),
     1   ICURNT(21),JUNODE(401),NAME(200),LOCAL(200),MNAME(200)
      COMMON/MISCEL/NOGO,IGOOF,NOPRNT,IACCT,JOBNAM(16),RTIMES(15)
      COMMON/KNSTNT/TWOPI,XLOG2,XLOG10,RAD,BOLTZ,CHARGE,VT
      COMMON/OUTDAT/ROUT(101,10),FREQ(101),IONUM,IONAM(10),IOPND(10),
     1   IONND(10),IOFLG(10),NUMOR(3),IOVAR(10,2),IACVAR(5)
      COMMON/OCNTRL/IPRCOM(10,2),IPLCOM(10,2),PLTLIM(10,2,2),
     1   IACPRT(5,4),IACPLT(5,4),ACPLIM(5,4,2)
      COMMON/DC/ICVFLG,ITCELM,TCSTAR,TCSTOP,TCINCR,KSSOP,KINEL,KOVAR
      COMMON/TRAN/JTRFLG,TSTEP,TSTOP,TSTART,NOTINT,STEPS(5),ENDPTS(5),
     1   KFROUT,FORFRE,KFPTS
      COMMON/AC/JACFLG,FSTART,FSTOP,IDFREQ,FINCR,INOISE,NOSPRT,
     1   NOSOUT,NOSIN
      COMMON/TEMPER/TEMPS(6),NUMTEM,ITEMNO
      COMMON/SENVAR/NSENS,KSNOUT(10)
      COMMON/DESIGN/JDSFLG,NSPEC,NDES,ERROR,NOELEM(30),NELTPE(30),
     1   NOUNUM(10),DESVAL(10),WEIGHT(10)
C
C
C*    DATA IBLNK,ILLIN,ILDEC,ILOCT /1H ,6HLINEAR,6HDECADE,6HOCTAVE/
      DATA IBLNK /1H /
C
C  CHECK OUTPUT REQUESTS
C
      IF (IONUM.EQ.0) GO TO 400
      IF (NOPRNT.EQ.1) GO TO 25
      WRITE (6,21)
   21 FORMAT (///1X,5H**** ,'OUTPUT REQUESTS'//8X,'NAME',5X,
     1   'ELEMENT',5X,'+NODE',5X,'-NODE')
   25 IKNT=0
   30 IKNT=IKNT+1
      IF (IKNT.GT.IONUM) GO TO 400
      IF (IOFLG(IKNT).EQ.0) GO TO 30
      IF (IOFLG(IKNT).EQ.3) GO TO 30
      IPNOD=IOPND(IKNT)
      IF (IOFLG(IKNT).EQ.2) GO TO 100
C
C  VOLTAGE OUTPUT
C
      INNOD=IONND(IKNT)
      IF (NOPRNT.EQ.1) GO TO 55
      WRITE (6,51) IONAM(IKNT),IPNOD,INNOD
   51 FORMAT (/8X,R7,13X,I5,5X,I5)
   55 IF (IPNOD.EQ.INNOD) GO TO 200
      JKNT=0
   60 JKNT=JKNT+1
      IF (JKNT.GT.NUNODS) GO TO 200
      IF (IPNOD.NE.JUNODE(JKNT)) GO TO 60
      IOPND(IKNT)=JKNT
      JKNT=0
   70 JKNT=JKNT+1
      IF (JKNT.GT.NUNODS) GO TO 200
      IF (INNOD.NE.JUNODE(JKNT)) GO TO 70
      IONND(IKNT)=JKNT
      GO TO 30
C
C  CURRENT OUTPUT
C
  100 IF (NOPRNT.EQ.1) GO TO 105
      WRITE (6,101) IONAM(IKNT),IPNOD
  101 FORMAT (/8X,R7,3X,R7)
  105 CALL IDEN (IPNOD,ID,ITEMP)
      IF (ID.NE.6) GO TO 200
      IOPND(IKNT)=ITEMP
      IONND(IKNT)=1
      GO TO 30
C
C  OUTPUT VARIABLE ERROR
C
  200 IOFLG(IKNT)=0
      IOPND(IKNT)=1
      IONND(IKNT)=1
      WRITE (6,201) IONAM(IKNT)
  201 FORMAT (//5X,'----------  OUTPUT VARIABLE  ',R7,' HAS NOT BEEN '
     1   'DEFINED CORRECTLY'//)
      GO TO 30
C
C  CHECK DC ANALYSIS REQUESTS
C
  400 IF (ICVFLG.EQ.0) GO TO 500
      IF (NOPRNT.EQ.1) GO TO 425
      WRITE (6,421) ITCELM,TCSTAR,TCSTOP,TCINCR
  421 FORMAT (///1X,5H**** ,'TRANSFER CURVES'//5X,'VARIABLE SOURCE',5X,
     1   'FIRST VALUE',6X,'LAST VALUE',6X,'INCREMENT'//9X,R7,10X,1PE9.2,
     2   7X,E9.2,7X,E9.2)
C
C  TRANSFER CURVES
C
  425 CALL IDEN (ITCELM,ID,ITEMP)
      IF (ID.EQ.4) GO TO 430
      IF (ID.EQ.6) GO TO 430
      GO TO 480
  430 ITCELM=ITEMP
      IF (TCINCR.EQ.0.0) GO TO 445
      TEMP=(TCSTOP-TCSTAR)/TCINCR
      IF (TEMP.GT.0.0) GO TO 440
      TCINCR=-TCINCR
      TEMP=-TEMP
  440 ICVFLG=IFIX(TEMP+0.5)+1
      IF (ICVFLG.LT.2) ICVFLG=2
      IF (ICVFLG.LT.102) GO TO 450
  445 ICVFLG=101
      TCINCR=(TCSTOP-TCSTAR)/100.0
      WRITE (6,446) TCINCR
  446 FORMAT (//5X,'---  WARNING  ---  SOURCE INCREMENT INCREASED TO ',
     1   1PE8.2)
  450 IF (NUMOR(1).GT.0) GO TO 500
      IF (JDSFLG.GT.0) GO TO 500
      ICVFLG=0
      WRITE (6,471)
  471 FORMAT (//5X,'----------  TRANSFER CURVE REQUESTED BUT NO DC '
     1   'OUTPUTS HAVE BEEN DEFINED'//)
      GO TO 500
  480 ICVFLG=0
      WRITE (6,481)
  481 FORMAT (//5X,'----------  TRANSFER CURVE VARIABLE SOURCE HAS NOT '
     1   'BEEN DEFINED'//)
C
C  SMALL SIGNAL TRANSFER FUNCTION
C
  500 IF (KINEL.EQ.0) GO TO 800
      IF (NOPRNT.EQ.1) GO TO 505
      WRITE (6,501) KOVAR,KINEL
  501 FORMAT (///1X,5H**** ,'TRANSFER FUNCTION'//5X,'OUTPUT',5X,'INPUT'
     2   //5X,R7,4X,R7)
  505 CALL IDEN(KINEL,ID,ITEMP)
      IF (ID.EQ.4) GO TO 510
      IF (ID.EQ.6) GO TO 510
      GO TO 550
  510 KINEL=ITEMP
      IKNT=0
  520 IKNT=IKNT+1
      IF (IKNT.GT.IONUM) GO TO 550
      IF (KOVAR.NE.IONAM(IKNT)) GO TO 520
      IF (IOFLG(IKNT).EQ.0) GO TO 550
      KOVAR=IKNT
      GO TO 800
  550 KINEL=0
      WRITE (6,551)
  551 FORMAT (//5X,'----------  TRANSFER FUNCTION INPUT SOURCE AND/OR '
     1   'OUTPUT VARIABLE HAVE NOT BEEN DEFINED CORRECTLY'//)
C
C  CHECK AC ANALYSIS REQUESTS
C
  800 IF (JACFLG.EQ.0) GO TO 1200
      JACFLG=FINCR
      IF (NOPRNT.EQ.1) GO TO 815
      NAM=IBLNK
C*    IF (IDFREQ.EQ.1) NAM=ILLIN
C*    IF (IDFREQ.EQ.2) NAM=ILDEC
C*    IF (IDFREQ.EQ.3) NAM=ILOCT
C*    WRITE (6,811) FSTART,FSTOP,NAM,JACFLG
C*811 FORMAT (///1X,5H**** ,'FREQUENCY VARIATION'//5X,'FIRST FREQ',5X,
C*   1   'LAST FREQ',5X,'VARIATION',5X,'POINTS'//5X,1PE9.2,6X,E9.2,7X,
C*   2   A8,3X,I5)
      IF (IDFREQ.EQ.1) GO TO 801
      IF (IDFREQ.EQ.2) GO TO 803
      IF (IDFREQ.EQ.3) GO TO 805
  801 WRITE(6,802) FSTART,FSTOP,JACFLG
  802 FORMAT(///1X,5H**** ,'FREQUENCY VARIATION'//5X,'FIRST FREQ',5X,
     1   'LAST FREQ',5X,'VARIATION',5X,'POINTS',//5X,1PE9.2,6X,E9.2,7X,
     2   '  LINEAR',3X,I5)
      GO TO 815
  803 WRITE(6,804) FSTART,FSTOP,JACFLG
  804 FORMAT(///1X,5H**** ,'FREQUENCY VARIATION'//5X,'FIRST FREQ',5X,
     1   'LAST FREQ',5X,'VARIATION',5X,'POINTS',//5X,1PE9.2,6X,E9.2,7X,
     2   '  DECADE',3X,I5)
      GO TO 815
  805 WRITE(6,806) FSTART,FSTOP,JACFLG
  806 FORMAT(///1X,5H**** ,'FREQUENCY VARIATION'//5X,'FIRST FREQ',5X,
     1   'LAST FREQ',5X,'VARIATION',5X,'POINTS',//5X,1PE9.2,6X,E9.2,7X,
     2   '  OCTAVE',3X,I5)
  815 IF (IDFREQ.EQ.0) GO TO 860
      IF (FSTART.LE.0.0) GO TO 860
      IF (FSTOP.LE.0.0) GO TO 860
      IF (FSTART.GT.FSTOP) GO TO 860
      IF (IDFREQ.GT.1) GO TO 840
      IF (JACFLG.LT.2) JACFLG=2
      IF (JACFLG.LT.102) GO TO 830
      JACFLG=101
      WRITE (6,821) JACFLG
  821 FORMAT (//5X,'---  WARNING  ---  NUMBER OF AC FREQUENCY POINTS '
     1   'REDUCED TO ',I5)
  830 FINCR=(FSTOP-FSTART)/FLOAT(JACFLG-1)
      GO TO 900
  840 FACTOR=XLOG10
      IF (IDFREQ.EQ.3) FACTOR=XLOG2
      TEMP=ALOG(FSTOP/FSTART)/FACTOR
      JACFLG=IFIX(TEMP*JACFLG+0.5)+1
      IF (JACFLG.LT.2) JACFLG=2
      IF (JACFLG.LT.102) GO TO 850
      JACFLG=101
      NUMPTS=101/IFIX(TEMP+0.5)
      WRITE (6,821) NUMPTS
  850 FINCR=EXP(FACTOR*TEMP/FLOAT(JACFLG-1))
      GO TO 900
  860 JACFLG=0
      WRITE (6,861)
  861 FORMAT (//5X,'----------  AC FREQUENCY VARIATION HAS NOT BEEN '
     1   'DEFINED CORRECTLY'//)
C
C  NOISE ANALYSIS
C
  900 IF (NOSOUT.NE.0) GO TO 910
      INOISE=0
      GO TO 1000
  910 IF (NOPRNT.EQ.1) GO TO 915
      WRITE (6,911) NOSOUT,NOSIN,NOSPRT
  911 FORMAT (///1X,5H**** ,'NOISE ANALYSIS'//5X,'OUTPUT',5X,'INPUT',
     1   5X,'SUMMARY INTERVAL'//5X,R7,4X,R7,5X,I5)
  915 CALL IDEN (NOSIN,ID,ITEMP)
      IF (ID.EQ.4) GO TO 920
      IF (ID.EQ.6) GO TO 920
      GO TO 970
  920 NOSIN=ITEMP
      IKNT=0
  930 IKNT=IKNT+1
      IF (IKNT.GT.IONUM) GO TO 970
      IF (NOSOUT.NE.IONAM(IKNT)) GO TO 930
      IF (IOFLG(IKNT).NE.1) GO TO 970
      NOSOUT=IKNT
      IF (NOSPRT.GT.JACFLG) NOSPRT=JACFLG
      IKNT=NOSPRT
      IF (INOISE.EQ.0) GO TO 965
      IKNT=IKNT+IACPRT(INOISE,1)+IACPRT(INOISE,2)+IACPLT(INOISE,1)
     1   +IACPLT(INOISE,2)
  965 IF (IKNT.GT.0) GO TO 1000
  970 NOSOUT=0
      NOSPRT=0
      INOISE=0
      WRITE (6,971)
  971 FORMAT (//5X,'----------  NOISE ANALYSIS INPUT SOURCE AND/OR '
     1   'OUTPUT VARIABLE HAVE NOT BEEN DEFINED CORRECTLY'//)
 1000 IF ((NUMOR(3)+NOSPRT).GT.0) GO TO 1200
      JACFLG=0
      WRITE (6,1001)
 1001 FORMAT (//5X,'----------  SMALL SIGNAL ANALYSIS REQUESTED BUT NO '
     1   'AC OUTPUTS HAVE BEEN DEFINED'//)
C
C  CHECK TRANSIENT ANALYSIS REQUESTS
C
 1200 IF (JTRFLG.EQ.0) GO TO 1400
      IF (NOPRNT.EQ.1) GO TO 1240
      WRITE (6,1211) TSTEP,TSTOP,TSTART,(STEPS(I),ENDPTS(I),I=1,NOTINT)
 1211 FORMAT (///1X,5H**** ,'TRANSIENT TIME VARIATION'//5X,
     1   'TIME INCREMENT',5X,'LAST TIME',5X,'START TIME'//7X,1PE9.2,
     2   8X,E9.2,6X,E9.2//5X,'INTERVALS',5(5X,'DELTA',3X,'END POINT')//
     3   14X,5(3X,E9.2,1X,E9.2))
C
C  FOURIER ANALYSIS
C
 1240 IF (KFROUT.EQ.0) GO TO 1350
      IF (NOPRNT.EQ.1) GO TO 1245
      WRITE (6,1241) KFROUT,FORFRE
 1241 FORMAT (///1X,5H**** ,'FOURIER ANALYSIS'//5X,'OUTPUT',5X,
     1   'FUNDAMENTAL'//5X,R7,5X,1PE9.2)
 1245 IKNT=0
 1250 IKNT=IKNT+1
      IF (IKNT.GT.IONUM) GO TO 1310
      IF (KFROUT.NE.IONAM(IKNT)) GO TO 1250
      IF (IOFLG(IKNT).EQ.0) GO TO 1310
      JKNT=0
 1260 JKNT=JKNT+1
      IF (JKNT.GT.NUMOR(2)) GO TO 1270
      IF (IOVAR(JKNT,2).NE.IKNT) GO TO 1260
      GO TO 1280
 1270 NUMOR(2)=JKNT
      IOVAR(JKNT,2)=IKNT
 1280 KFROUT=JKNT
      IF (FORFRE.EQ.0.0) GO TO 1300
      KFPTS=IFIX(1.0/(FORFRE*TSTEP)+0.5)
      IF (KFPTS.LT.10) GO TO 1300
      IF (KFPTS.GE.JTRFLG) GO TO 1300
      GO TO 1350
 1300 KFROUT=0
      WRITE (6,1301)
 1301 FORMAT (//5X,'----------  FOURIER ANALYSIS FREQUENCY IS '
     1   'INCOMPATIBLE WITH TRANSIENT TIME VARIATION'//)
      GO TO 1350
 1310 KFROUT=0
      WRITE (6,1311)
 1311 FORMAT (//5X,'----------  FOURIER ANALYSIS OUTPUT HAS NOT BEEN '
     1   'DEFINED CORRECTLY'//)
 1350 IF (NUMOR(2).GT.0) GO TO 1400
      JTRFLG=0
      WRITE (6,1351)
 1351 FORMAT (//5X,'----------  TRANSIENT ANALYSIS REQUESTED BUT NO '
     1   'TRANSIENT OUTPUTS HAVE BEEN DEFINED'//)
C
C  CHECK SENSITIVITY REQUESTS
C
 1400 IF (NSENS.EQ.0) GO TO 1600
      IF (NOPRNT.EQ.1) GO TO 1405
      WRITE (6,1401) (KSNOUT(I),I=1,NSENS)
 1401 FORMAT (///1X,5H**** ,'SENSITIVITY OUTPUTS'//10(2X,R7))
      IFLAG=0
 1405 IKNT=0
 1410 IKNT=IKNT+1
      IF (IKNT.GT.NSENS) GO TO 1440
      JKNT=0
 1420 JKNT=JKNT+1
      IF (JKNT.GT.IONUM) GO TO 1430
      IF (KSNOUT(IKNT).NE.IONAM(JKNT)) GO TO 1420
      KSNOUT(IKNT)=JKNT
      GO TO 1410
 1430 IFLAG=1
      WRITE (6,1431) KSNOUT(IKNT)
 1431 FORMAT (//5X,'----------  SENSITIVITY OUTPUT ',R7,' HAS NOT '
     1   'BEEN CORRECTLY DEFINED'//)
      GO TO 1410
 1440 IF (IFLAG.EQ.0) GO TO 1600
      NSENS=0
C
C  CHECK DESIGN PARAMETER SPECIFICATIONS
C
 1600 IF (JDSFLG.EQ.0) GO TO 3000
      IF (NOPRNT.EQ.1) GO TO 1620
      WRITE (6,1611) (NOELEM(I),I=1,NDES)
 1611 FORMAT (///1X,5H**** ,'DC DESIGN PARAMETERS'//(10(2X,R7)/))
 1620 IKNT=0
 1630 IKNT=IKNT+1
      IF (IKNT.GT.NDES) GO TO 1800
      CALL IDEN(NOELEM(IKNT),ID,ITEMP)
      IF (ID.EQ.0) GO TO 1660
      NOELEM(IKNT)=ITEMP
      NELTPE(IKNT)=ID
      GO TO 1630
 1660 JDSFLG=0
      NOGO=1
      WRITE (6,1661) NOELEM(IKNT)
 1661 FORMAT (//5X,'----------  DESIGN PARAMETER ',R7,' HAS NOT BEEN '
     1   'CORRECTLY DEFINED'//)
      GO TO 1630
C
C  CHECK DESIGN OUTPUT SPECIFICATIONS
C
 1800 IF (NSPEC.EQ.0) GO TO 1870
      IF (NOPRNT.EQ.1) GO TO 1810
      WRITE (6,1801) (NOUNUM(I),DESVAL(I),WEIGHT(I),I=1,NSPEC)
 1801 FORMAT (///1X,5H**** ,'DC DESIGN OUTPUT SPECIFICATIONS'//1X,
     1  'NAME',13X,'VALUE',10X,'WEIGHT'//10(1X,R7,6X,1PE10.3,6X,E10.3/))
 1810 IKNT=0
 1820 IKNT=IKNT+1
      IF (IKNT.GT.NSPEC) GO TO 3000
      JKNT=0
 1830 JKNT=JKNT+1
      IF (JKNT.GT.IONUM) GO TO 1860
      IF (NOUNUM(IKNT).NE.IONAM(JKNT)) GO TO 1830
      NOUNUM(IKNT)=JKNT
      GO TO 1820
 1860 JDSFLG=0
      NOGO=1
      WRITE (6,1861) NOUNUM(IKNT)
 1861 FORMAT (//5X,'----------  DESIGN OUTPUT VARIABLE ',R7,' HAS NOT '
     1   'BEEN DEFINED CORRECTLY'//)
      GO TO 1820
 1870 JDSFLG=0
      NOGO=1
      WRITE (6,1871)
 1871 FORMAT (//5X,'----------  NO DESIGN OUTPUTS SPECIFIED'//)
C
C  CHECK TEMP COEFFICIENTS
C
 3000 IF (NOPRNT.EQ.1) RETURN
      ISTART=1
      IF (NUMTEM.GT.1) ISTART=2
      WRITE (6,3001) (TEMPS(I),I=ISTART,NUMTEM)
 3001 FORMAT (//1X,5H**** ,'CIRCUIT TEMPERATURES (DEG C)',5(5X,F8.2)//)
      RETURN
      END
      SUBROUTINE OVTPVT
      COMMON/INDATA/NUMEL,NUNODS,NUMNOD,NOSTOP,JELCNT(20),LOCATE(21),
     1   ICURNT(21),JUNODE(401),NAME(200),LOCAL(200),MNAME(200)
      COMMON/MISCEL/NOGO,IGOOF,NOPRNT,IACCT,JOBNAM(16),RTIMES(15)
      COMMON/STATUS/MODE,OMEGA,TIMEE,DELTA,DELOLD,ICALC                         5
      COMMON/KNSTNT/TWOPI,XLOG2,XLOG10,RAD,BOLTZ,CHARGE,VT
      COMMON/OUTDAT/ROUT(101,10),FREQ(101),IONUM,IONAM(10),IOPND(10),
     1   IONND(10),IOFLG(10),NUMOR(3),IOVAR(10,2),IACVAR(5)
      COMMON/OCNTRL/IPRCOM(10,2),IPLCOM(10,2),PLTLIM(10,2,2),
     1   IACPRT(5,4),IACPLT(5,4),ACPLIM(5,4,2)
      COMMON/DC/ICVFLG,ITCELM,TCSTAR,TCSTOP,TCINCR,KSSOP,KINEL,KOVAR
      COMMON/TRAN/JTRFLG,TSTEP,TSTOP,TSTART,NOTINT,STEPS(5),ENDPTS(5),
     1   KFROUT,FORFRE,KFPTS
      COMMON/AC/JACFLG,FSTART,FSTOP,IDFREQ,FINCR,INOISE,NOSPRT,
     1   NOSOUT,NOSIN
      COMMON/TEMPER/TEMPS(6),NUMTEM,ITEMNO
C
C
      DIMENSION PUTOUT(2,101,5)
      EQUIVALENCE (PUTOUT(1,1,1),ROUT(1,1))
      DIMENSION ITAB(10),INAM(10),IDID(10),VOUT(10)
      DIMENSION ITITLE(4),IHEAD(10)
C*    DATA ITITLE /10H REAL PART,10H IMAG PART,
C*   1             10H MAGNITUDE,10H   PHASE  /
      DATA ITITLE /5H REAL,5H IMAG,5H MAGN,5HPHASE/
C*    DATA LSNOIS,LSTIME /10H   NOISE  ,10H    TIME  /
      DATA LSNOIS,LSTIME/5HNOISE,5H TIME/
C
C
      IF (ICALC.LT.2) RETURN
      CALL SECOND(T1)
      GO TO (10,200,20),MODE
C
C  DC TRANSFER CURVES
C
   10 IFLAG=1
C*    NAMHDR=NAME(ITCELM)
      NAMHDR=NAME(ITCELM)
C      NAMHDR=NAME(ITCELM)*"10
      GO TO 50
C
C  TRANSIENT ANALYSIS
C
   20 IFLAG=2
      NAMHDR=LSTIME
C
C  PRINTS
C
   50 KNTR=0
      IKNT=0
   60 IKNT=IKNT+1
      IF (IKNT.GT.NUMOR(IFLAG)) GO TO 70
      IF (IPRCOM(IKNT,IFLAG).EQ.0) GO TO 60
      ITEMP=IOVAR(IKNT,IFLAG)
      KNTR=KNTR+1
      ITAB(KNTR)=IKNT
      INAM(KNTR)=IONAM(ITEMP)
      GO TO 60
   70 IF (KNTR.EQ.0) GO TO 140
      IF (IFLAG.EQ.2) GO TO 90
C*    WRITE (6,81) (JOBNAM(I),I=1,8),TEMPS(ITEMNO)
      WRITE (6,81) (JOBNAM(I),I=1,16),TEMPS(ITEMNO)
C* 81 FORMAT (1H7/////1X,125(1H*)///1X,8A10,26X,'-----  SPICE  -----'
   81 FORMAT (1H1/////1X,125(1H*)///1X,16A5,26X,'-----  SPICE  -----'
     1   ///21X,'DC TRANSFER CURVES',37X,'TEMPERATURE ',F10.3,
     2   ' DEG C'///1X,125(1H*)//)
      GO TO 100
C* 90 WRITE (6,91) (JOBNAM(I),I=1,8),TEMPS(ITEMNO)
   90 WRITE (6,91) (JOBNAM(I),I=1,16),TEMPS(ITEMNO)
C* 91 FORMAT (1H7/////1X,125(1H*)///1X,8A10,26X,'-----  SPICE  -----'
   91 FORMAT (1H1/////1X,125(1H*)///1X,16A5,26X,'-----  SPICE  -----'
     1   ///21X,'TRANSIENT ANALYSIS',37X,'TEMPERATURE ',F10.3,
     2   ' DEG C'///1X,125(1H*)//)
  100 WRITE (6,101) NAMHDR,(INAM(I),I=1,KNTR)
C*101 FORMAT (3X,R7,2X,10(5X,R7))
  101 FORMAT (5X,A5,10(9X,R4))
C      WRITE (6,111)
C  111 FORMAT (//1HX)
      DO 130 I=1,ICALC
      DO 120 J=1,KNTR
      IKNT=ITAB(J)
  120 VOUT(J)=ROUT(I,IKNT)
      WRITE (6,121) FREQ(I),(VOUT(J),J=1,KNTR)
  121 FORMAT (1X,1PE9.2,2X,10(2X,E10.3))
  130 CONTINUE
C      WRITE (6,131)
C  131 FORMAT (1HY)
C
C  PLOTS
C
  140 IKNT=0
  150 IKNT=IKNT+1
      IF (IKNT.GT.NUMOR(IFLAG)) GO TO 1000
      IF (IPLCOM(IKNT,IFLAG).EQ.0) GO TO 150
      ITEMP=IOVAR(IKNT,IFLAG)
      IF (IFLAG.EQ.2) GO TO 160
C*    WRITE (6,81) (JOBNAM(I),I=1,8),TEMPS(ITEMNO)
      WRITE (6,81) (JOBNAM(I),I=1,16),TEMPS(ITEMNO)
      GO TO 170
C*160 WRITE (6,91) (JOBNAM(I),I=1,8),TEMPS(ITEMNO)
  160 WRITE (6,91) (JOBNAM(I),I=1,16),TEMPS(ITEMNO)
  170 WRITE (6,171) NAMHDR,IONAM(ITEMP)
C*171 FORMAT (3X,R7,5X,R7//)
  171 FORMAT (5X,A5,9X,R4//)
      IF (IPLCOM(IKNT,IFLAG).EQ.2) GO TO 180
      CALL PLOT (0,IKNT,0,1,0.0,0.0)
      GO TO 150
  180 CALL PLOT (0,IKNT,0,0,PLTLIM(IKNT,IFLAG,1),PLTLIM(IKNT,IFLAG,2))
      GO TO 150
C
C  AC ANALYSIS
C
C  PRINTS
C
  200 KNTR=0
      IF (INOISE.EQ.0) GO TO 220
      IF (IACPRT(INOISE,1).EQ.0) GO TO 210
      KNTR=KNTR+1
      INAM(KNTR)=IONAM(NOSOUT)
      IHEAD(KNTR)=LSNOIS
      IDID(KNTR)=1
      ITAB(KNTR)=INOISE
  210 IF (IACPRT(INOISE,2).EQ.0) GO TO 220
      KNTR=KNTR+1
      INAM(KNTR)=NAME(NOSIN)
      IHEAD(KNTR)=LSNOIS
      IDID(KNTR)=2
      ITAB(KNTR)=INOISE
  220 IKNT=0
      IFLAG=0
  230 IKNT=IKNT+1
      IF (IKNT.GT.NUMOR(3)) GO TO 250
      ITEMP=IACVAR(IKNT)
      IF (IOFLG(ITEMP).EQ.3) GO TO 230
      JKNT=0
  240 JKNT=JKNT+1
      IF (JKNT.GT.4) GO TO 230
      IF (IACPRT(IKNT,JKNT).EQ.0) GO TO 240
      KNTR=KNTR+1
      INAM(KNTR)=IONAM(ITEMP)
      IHEAD(KNTR)=ITITLE(JKNT)
      IDID(KNTR)=JKNT
      ITAB(KNTR)=IKNT
      IF (KNTR.LT.10) GO TO 240
      IF (IFLAG.EQ.1) GO TO 260
      IFLAG=1
      GO TO 270
  250 IF (KNTR.EQ.0) GO TO 400
      IF (IFLAG.EQ.0) GO TO 270
      IFLAG=0
  260 WRITE (6,261)
  261 FORMAT (1H1/////)
      GO TO 280
C*270 WRITE (6,271) (JOBNAM(I),I=1,8),TEMPS(ITEMNO)
  270 WRITE (6,271) (JOBNAM(I),I=1,16),TEMPS(ITEMNO)
  271 FORMAT (1H1/////1X,125(1H*)///1X,16A5,26X,'-----  SPICE  -----'
     1   ///21X,'AC ANALYSIS',44X,'TEMPERATURE ',F10.3,
     2   ' DEG C'///1X,125(1H*)//)
  280 WRITE (6,281) (INAM(I),I=1,KNTR)
  281 FORMAT (//2X,'FREQUENCY ',10(5X,R7))
      WRITE (6,291) (IHEAD(I),I=1,KNTR)
  291 FORMAT (4X,4H(HZ),4X,10(2X,A10))
C      WRITE (6,111)
      DO 370 I=1,ICALC
      KKNT=0
  300 KKNT=KKNT+1
      IF (KKNT.GT.KNTR) GO TO 360
      ITEMP=ITAB(KKNT)
      ITYPE=IDID(KKNT)
      GO TO (310,320,330,340),ITYPE
  310 VOUT(KKNT)=PUTOUT(1,I,ITEMP)
      GO TO 300
  320 VOUT(KKNT)=PUTOUT(2,I,ITEMP)
      GO TO 300
  330 VOUT(KKNT)=SQRT(PUTOUT(1,I,ITEMP)*PUTOUT(1,I,ITEMP)
     1   +PUTOUT(2,I,ITEMP)*PUTOUT(2,I,ITEMP))
      GO TO 300
  340 XMAG=SQRT(PUTOUT(1,I,ITEMP)*PUTOUT(1,I,ITEMP)
     1   +PUTOUT(2,I,ITEMP)*PUTOUT(2,I,ITEMP))
      IF (XMAG.GT.1.0E-20) GO TO 350
      VOUT(KKNT)=0.0
      GO TO 300
  350 VOUT(KKNT)=RAD*ATAN2(PUTOUT(2,I,ITEMP),PUTOUT(1,I,ITEMP))
      GO TO 300
  360 WRITE (6,121) FREQ(I),(VOUT(J),J=1,KNTR)
  370 CONTINUE
C      WRITE (6,131)
      IF (IFLAG.EQ.0) GO TO 400
      KNTR=0
      GO TO 240
C
C  PLOTS
C
  400 IF (INOISE.EQ.0) GO TO 500
      IF (IACPLT(INOISE,1).EQ.0) GO TO 450
      DO 410 I=1,ICALC
      XMAG=PUTOUT(1,I,INOISE)
      IF (XMAG.LT.1.0E-20) XMAG=1.0E-20
      PUTOUT(1,I,INOISE)=ALOG10(XMAG)
  410 CONTINUE
C*    WRITE (6,421) (JOBNAM(I),I=1,8),TEMPS(ITEMNO)
      WRITE (6,421) (JOBNAM(I),I=1,16),TEMPS(ITEMNO)
  421 FORMAT (1H1/////1X,125(1H*)///1X,8A10,26X,'-----  SPICE  -----'
     1   ///21X,'NOISE ANALYSIS',41X,'TEMPERATURE ',F10.3,
     2   ' DEG C'///1X,125(1H*)//)
      WRITE (6,431) IONAM(NOSOUT)
  431 FORMAT (2X,'FREQUENCY',4X,'NOISE AT ',R7,'   (/RT HZ)'//)
      IF (IACPLT(INOISE,1).EQ.2) GO TO 440
      CALL PLOT (1,INOISE,1,1,0.0,0.0)
      GO TO 450
  440 CALL PLOT (1,INOISE,1,0,ACPLIM(INOISE,1,1),ACPLIM(INOISE,1,2))
  450 IF (IACPLT(INOISE,2).EQ.0) GO TO 500
      DO 460 I=1,ICALC
      XMAG=PUTOUT(2,I,INOISE)
      IF (XMAG.LT.1.0E-20) XMAG=1.0E-20
      PUTOUT(2,I,INOISE)=ALOG10(XMAG)
  460 CONTINUE
C*    WRITE (6,421) (JOBNAM(I),I=1,8),TEMPS(ITEMNO)
      WRITE (6,421) (JOBNAM(I),I=1,16),TEMPS(ITEMNO)
      WRITE (6,471) NAME(NOSIN)
  471 FORMAT (2X,'FREQUENCY',4X,'EQU NOISE AT  ',R7,'  (/RT HZ)'//)
      IF (IACPLT(INOISE,2).EQ.2) GO TO 480
      CALL PLOT (2,INOISE,1,1,0.0,0.0)
      GO TO 500
  480 CALL PLOT(2,INOISE,1,0,ACPLIM(INOISE,2,1),ACPLIM(INOISE,2,2))
  500 IKNT=0
  510 IKNT=IKNT+1
      IF (IKNT.GT.NUMOR(3)) GO TO 1000
      ITEMP=IACVAR(IKNT)
      IF (IOFLG(ITEMP).EQ.3) GO TO 510
      IF (IACPLT(IKNT,1).EQ.0) GO TO 530
C*    WRITE (6,271) (JOBNAM(I),I=1,8),TEMPS(ITEMNO)
      WRITE (6,271) (JOBNAM(I),I=1,16),TEMPS(ITEMNO)
      WRITE (6,511) IONAM(ITEMP)
  511 FORMAT (2X,'FREQUENCY',4X,'REAL PART OF ',R7//)
      IF (IACPLT(IKNT,1).EQ.2) GO TO 520
      CALL PLOT (1,IKNT,0,1,0.0,0.0)
      GO TO 530
  520 CALL PLOT (1,IKNT,0,0,ACPLIM(IKNT,1,1),ACPLIM(IKNT,1,2))
  530 IF (IACPLT(IKNT,2).EQ.0) GO TO 560
C*    WRITE (6,271) (JOBNAM(I),I=1,8),TEMPS(ITEMNO)
      WRITE (6,271) (JOBNAM(I),I=1,16),TEMPS(ITEMNO)
      WRITE (6,541) IONAM(ITEMP)
  541 FORMAT (2X,'FREQUENCY',4X,'IMAGINARY PART OF ',R7//)
      IF (IACPLT(IKNT,2).EQ.2) GO TO 550
      CALL PLOT (2,IKNT,0,1,0.0,0.0)
      GO TO 560
  550 CALL PLOT (2,IKNT,0,0,ACPLIM(IKNT,2,1),ACPLIM(IKNT,2,2))
  560 IF (IACPLT(IKNT,3).NE.0) GO TO 570
      IF (IACPLT(IKNT,4).NE.0) GO TO 570
      GO TO 510
  570 DO 590 I=1,ICALC
      XMAG=SQRT(PUTOUT(1,I,IKNT)*PUTOUT(1,I,IKNT)
     1   +PUTOUT(2,I,IKNT)*PUTOUT(2,I,IKNT))
      IF (XMAG.GT.1.0E-20) GO TO 580
      PUTOUT(1,I,IKNT)=-20.0
      PUTOUT(2,I,IKNT)=0.0
      GO TO 590
  580 PUTOUT(2,I,IKNT)=RAD*ATAN2(PUTOUT(2,I,IKNT),PUTOUT(1,I,IKNT))
      PUTOUT(1,I,IKNT)=ALOG10(XMAG)
  590 CONTINUE
      IF (IACPLT(IKNT,3).EQ.0) GO TO 630
C*    WRITE (6,271) (JOBNAM(I),I=1,8),TEMPS(ITEMNO)
      WRITE (6,271) (JOBNAM(I),I=1,16),TEMPS(ITEMNO)
      WRITE (6,611) IONAM(ITEMP)
  611 FORMAT (2X,'FREQUENCY',4X,'MAGNITUDE OF ',R7//)
      IF (IACPLT(IKNT,3).EQ.2) GO TO 620
      CALL PLOT (1,IKNT,1,1,0.0,0.0)
      GO TO 630
  620 CALL PLOT (1,IKNT,1,0,ACPLIM(IKNT,3,1),ACPLIM(IKNT,3,2))
  630 IF (IACPLT(IKNT,4).EQ.0) GO TO 510
C*    WRITE (6,271) (JOBNAM(I),I=1,8),TEMPS(ITEMNO)
      WRITE (6,271) (JOBNAM(I),I=1,16),TEMPS(ITEMNO)
      WRITE (6,641) IONAM(ITEMP)
  641 FORMAT (2X,'FREQUENCY',4X,'PHASE OF ',R7,' (DEGREES)'//)
      IF (IACPLT(IKNT,4).EQ.2) GO TO 650
      CALL PLOT (2,IKNT,0,0,-180.0,180.0)
      GO TO 510
  650 CALL PLOT (2,IKNT,0,0,ACPLIM(IKNT,4,1),ACPLIM(IKNT,4,2))
      GO TO 510
 1000 IF (MODE.LT.3) GO TO 1010
      IF (KFROUT.EQ.0) GO TO 1010
      CALL FOURAN
 1010 CALL SECOND(T2)
      RTIMES(10)=RTIMES(10)+T2-T1
      RETURN
      END
      SUBROUTINE PLOT (ISPOT,INUM,ILOG,IAUTO,PMIN,PMAX)
      COMMON/STATUS/MODE,OMEGA,TIMEE,DELTA,DELOLD,ICALC                         2
      COMMON/KNSTNT/TWOPI,XLOG2,XLOG10,RAD,BOLTZ,CHARGE,VT
      COMMON/OUTDAT/ROUT(101,10),FREQ(101),IONUM,IONAM(10),IOPND(10),
     1   IONND(10),IOFLG(10),NUMOR(3),IOVAR(10,2),IACVAR(5)
C
C
      DIMENSION PUTOUT(2,101,5)
      EQUIVALENCE (PUTOUT(1,1,1),ROUT(1,1))
      DIMENSION COOR(5),IPOINT(21)
C*    DATA IPOINT /5755555555555555B,2*5555555555555555B,
C*   1             5557555555555555B,2*5555555555555555B,
C*   1             5555575555555555B,2*5555555555555555B,
C*   1             5555555755555555B,2*5555555555555555B,
C*   1             5555555557555555B/
      DATA IPOINT /"134402010040,4*"100402010040,
     1                "134402010040,4*"100402010040,
     1                "134402010040,4*"100402010040,
     1                "134402010040,4*"100402010040,
     1                "0562010040/
C*    DATA ILET1,ILET2,ISHIFT /10B,12B,100B/
      DATA ILET1,ILET2,ISHIFT /-11,3,"200/
C
C
      IF (IAUTO.EQ.1) GO TO 10
      IF (ILOG.EQ.1) GO TO 5
      XMIN=PMIN
      DEL=PMAX-PMIN
      IF (DEL.GT.0.0) GO TO 2
      XMIN=PMAX
      DEL=-DEL
    2 IF (DEL.LT.1.0E-20) DEL=1.0E-20
      DEL=DEL/4.0
      GO TO 185
    5 XMIN=PMIN
      IF (XMIN.LT.1.0E-20) XMIN=1.0E-20
      XMIN=ALOG10(XMIN)
      XMAX=PMAX
      IF (XMAX.LT.1.0E-20) XMAX=1.0E-20
      XMAX=ALOG10(XMAX)
      DEL=XMAX-XMIN
      IF (DEL.GT.0.0) GO TO 8
      XMIN=XMAX
      DEL=-DEL
    8 IF (DEL.LT.0.0001) DEL=0.0001
      DEL=DEL/4.0
      GO TO 185
C
C  DETERMINE MAX AND MIN VALUES
C
   10 IF (ISPOT.EQ.0) GO TO 22
      XMAX=PUTOUT(ISPOT,1,INUM)
      XMIN=XMAX
      DO 20 I=2,ICALC
      IF (PUTOUT(ISPOT,I,INUM).LT.XMIN) XMIN=PUTOUT(ISPOT,I,INUM)
      IF (PUTOUT(ISPOT,I,INUM).GT.XMAX) XMAX=PUTOUT(ISPOT,I,INUM)
   20 CONTINUE
      GO TO 25
   22 XMAX=ROUT(1,INUM)
      XMIN=XMAX
      DO 24 I=2,ICALC
      IF (ROUT(I,INUM).LT.XMIN) XMIN=ROUT(I,INUM)
      IF (ROUT(I,INUM).GT.XMAX) XMAX=ROUT(I,INUM)
   24 CONTINUE
C
C  SCALING
C
   25 AVER=(XMAX+XMIN)/2.0
      DEL=XMAX-XMIN
      DELMIN=ABS(AVER)*1.0E-3
      IF (ILOG.EQ.0) GO TO 26
      IF (DELMIN.LT.0.0001) DELMIN=0.0001
      GO TO 27
   26 IF (DELMIN.LT.1.0E-20) DELMIN=1.0E-20
   27 IF (DEL.LT.DELMIN) DEL=DELMIN
      IEXP=-IFIX(ALOG10(DEL))
      FACTOR=EXP(IEXP*XLOG10)
      DEL=DEL*FACTOR
      IF (DEL.LT.0.75) FACTOR=FACTOR*10.0
      IF (DEL.GT.8.0) FACTOR=FACTOR/10.0
      IAVER=IFIX(FACTOR*AVER+0.5)
      AVER=FLOAT(IAVER)/FACTOR
      DEL1=XMAX-AVER
      DEL=AVER-XMIN
      IF (DEL1.GT.DEL) DEL=DEL1
      DEL=DEL*FACTOR
      IF (DEL.GT.1.0) GO TO 28
      DEL=1.0
      GO TO 40
   28 IF (DEL.GT.2.0) GO TO 30
      DEL=2.0
      GO TO 40
   30 IF (DEL.GT.4.0) GO TO 35
      DEL=4.0
      GO TO 40
   35 DEL=8.0
   40 DEL=DEL/FACTOR
      XMIN=AVER-DEL
      DEL=DEL/2.0
C
C  DETERMINE COORDINATES
C
  185 COOR(1)=XMIN
      SMALL=DEL*1.0E-4
      DO 190 I=1,4
      COOR(I+1)=COOR(I)+DEL
      IF (ABS(COOR(I+1)).LT.SMALL) COOR(I+1)=0.0
  190 CONTINUE
      IF (ILOG.EQ.0) GO TO 210
      DO 200 I=1,5
  200 COOR(I)=EXP(XLOG10*COOR(I))
  210 DEL=DEL/25.0
C
C  PRINT COORDINATES
C
C      WRITE (6,211)
C  211 FORMAT (1HX)
      WRITE (6,216) (COOR(I),I=1,5)
  216 FORMAT (/8X,5(15X,1PE10.3)//26X,51(1X,1H-))
C
C  BEGIN PLOTTING
C
      DO 250 I=1,ICALC
      IF (ISPOT.GT.0) GO TO 232
      VOUT=ROUT(I,INUM)
      GO TO 235
  232 VOUT=PUTOUT(ISPOT,I,INUM)
  235 JPOINT=IFIX((VOUT-XMIN)/DEL+0.5)
      IF (JPOINT.LT.0) JPOINT=0
      IF (JPOINT.GT.103) JPOINT=103
      IF (ILOG.EQ.0) GO TO 240
      VOUT=EXP(XLOG10*VOUT)
C*240 JADDR=JPOINT/8+1
  240 JADDR=JPOINT/5+1
C*    JSPOT=JPOINT-(JADDR-1)*8
      JSPOT=JPOINT-(JADDR-1)*5
      LNEW=ILET1
      IF ((JPOINT/25)*25.EQ.JPOINT) LNEW=ILET2
      ITEMP=IPOINT(JADDR)
      JTEMP=1
C*    JSTOP=7-JSPOT
      JSTOP=4-JSPOT
      IF (JSTOP.LT.1) GO TO 244
      DO 242 J=1,JSTOP
  242 JTEMP=JTEMP*ISHIFT
  244 IPOINT(JADDR)=ITEMP-LNEW*JTEMP
      WRITE (6,246) FREQ(I),VOUT,(IPOINT(J),J=1,21)
C*246 FORMAT (1X,1PE10.3,3X,E10.3,3X,13R8)
  246 FORMAT (1H*,1PE10.3,3X,E10.3,3X,20R5,R4)
      IPOINT(JADDR)=ITEMP
  250 CONTINUE
      WRITE (6,256)
  256 FORMAT (26X,51(1X,1H-)//)
C      WRITE (6,261)
C  261 FORMAT (1HY)
      RETURN
      END
      SUBROUTINE READIN
      COMMON NODPLC(800),YNL(2001),TSTORE(2001),TRACUR(1700),VN(401),
     1   VNIM1(401),IORDER(401),IUR(402),IUC(800),MATLOC(1800)
      COMMON/INDATA/NUMEL,NUNODS,NUMNOD,NOSTOP,JELCNT(20),LOCATE(21),
     1   ICURNT(21),JUNODE(401),NAME(200),LOCAL(200),MNAME(200)
      COMMON/PARAM/VALUE(200),SOURCE(150),SYMVAL(25,25)
      COMMON/MODELS/NUMMOD,MODNAM(25),KIND(25)
      COMMON/MISCEL/NOGO,IGOOF,NOPRNT,IACCT,JOBNAM(16),RTIMES(15)
      COMMON/CARDS/ID,NUMFLD,ICARD1,KEOF
      COMMON/STATUS/MODE,OMEGA,TIMEE,DELTA,DELOLD,ICALC                         0
      COMMON/KNSTNT/TWOPI,XLOG2,XLOG10,RAD,BOLTZ,CHARGE,VT
      COMMON/OUTDAT/ROUT(101,10),FREQ(101),IONUM,IONAM(10),IOPND(10),
     1   IONND(10),IOFLG(10),NUMOR(3),IOVAR(10,2),IACVAR(5)
      COMMON/OCNTRL/IPRCOM(10,2),IPLCOM(10,2),PLTLIM(10,2,2),
     1   IACPRT(5,4),IACPLT(5,4),ACPLIM(5,4,2)
      COMMON/DC/ICVFLG,ITCELM,TCSTAR,TCSTOP,TCINCR,KSSOP,KINEL,KOVAR
      COMMON/TRAN/JTRFLG,TSTEP,TSTOP,TSTART,NOTINT,STEPS(5),ENDPTS(5),
     1   KFROUT,FORFRE,KFPTS
      COMMON/AC/JACFLG,FSTART,FSTOP,IDFREQ,FINCR,INOISE,NOSPRT,
     1   NOSOUT,NOSIN
      COMMON/TEMPER/TEMPS(6),NUMTEM,ITEMNO
      COMMON/SENVAR/NSENS,KSNOUT(10)
      COMMON/DESIGN/JDSFLG,NSPEC,NDES,ERROR,NOELEM(30),NELTPE(30),
     1   NOUNUM(10),DESVAL(10),WEIGHT(10)
      COMMON/TBLOK/FNDATA(25,5)
C
C  READIN AND ERRCHK USE YNL, TSTORE, AND MATLOC FOR TEMPORARY STORAGE
C
C        TSTORE
C
C            1          NAME1(400)
C          401          MNAME1(400)
C          801          LOCAL1(400)
C         1201          IDNO(400)
C         1601          VALUE1(400)
C
C           YNL
C
C            1          FIELD(100)     ITABLE(2001)
C          101          ICODE(100)
C          201          IFIELD(10)
C
C        MATLOC
C
C            1          NODPL1(800)
C
      DIMENSION FIELD(1),ICODE(1)
      EQUIVALENCE (FIELD(1),YNL(1)),(ICODE(1),YNL(101))
      DIMENSION NAME1(1),MNAME1(1),LOCAL1(1),IDNO(1),VALUE1(1)
      EQUIVALENCE (NAME1(1),TSTORE(1)),(MNAME1(1),TSTORE(401)),
     1   (LOCAL1(1),TSTORE(801)),(IDNO(1),TSTORE(1201)),
     2   (VALUE1(1),TSTORE(1601))
      DIMENSION NODPL1(1)
      EQUIVALENCE (NODPL1(1),MATLOC(1))
C
C  KEYWORDS AND FORMAT INFORMATION IS STORED IN LOCAL ARRAYS
      DIMENSION MODTYP(11),MTYPE(10),MOTYPE(10),TCODE(10),NAMPAR(25,5)
      DIMENSION NNODS(10)
C
C*    DATA IBLNK /55555555555555B/
      DATA IBLNK /"100402010040/
C*    DATA ISHIFT/1000000000000B/
      DATA ISHIFT /"40000/
C*    DATA JSHIFT /10000000000B/
      DATA JSHIFT /"200/
C*    DATA KSHIFT /100000000B/
      DATA KSHIFT /"40000/
C*    DATA ILETI,ILETN,ILETV/11B,16B,26B/
      DATA ILETI,ILETN,ILETV/"111,"116,"126/
C*    DATA LSAC,LSDC,LSDE,LSEX,LSFO,LSIM,LSIN,LSLI,LSMA,LSNO,LSOC,LSOP,
C*   1   LSOU,LSPH,LSPL,LSPR,LSPU,LSRE,LSSI,LSTC,LSTR/103B,403B,405B,
C*   2   530B,617B,1115B,1116B,1411B,1501B,1617B,1703B,1720B,1725B,
C*   3   2010B,2014B,2022B,2025B,2205B,2311B,2403B,2422B/
      DATA LSAC,LSDC,LSDE,LSEX,LSFO,LSIM,LSIN,LSLI,LSMA,LSNO,LSOC,LSOP,
     1   LSOU,LSPH,LSPL,LSPR,LSPU,LSRE,LSSI,LSTC,LSTR/
     2   "20303,"21103,"21105,"21330,"21517,"22315,"22316,
     3   "23111,"23301,"23517,"23703,"23720,"23725,"24110,
     4   "24114,"24122,"24125,"24505,"24711,"25103,"25122/

      DATA NNODS/2,2,2,2,4,2,3,2,3,4/

C*    DATA MODTYP /162016B,201620B,160720B,200720B,045555B,230204B,
C*   1   161206B,201206B,161517B,201517B,305555B/
      DATA MTYPE /1,1,2,2,3,3,4,4,5,5/
      DATA MOTYPE /1,1,2,2,3,4,5,5,6,6/
      DATA TCODE /1.0,-1.0,1.0,-1.0,0.0,0.0,1.0,-1.0,1.0,-1.0/
      DATA MODTYP/"4724116,"5023520,"4721720,"5021720,"4210040,
     1   "5160504,"4722506,"5022506,"4723317,"5023317,"5410040/
C*    DATA NAMPAR /      0,020655B,022255B,220255B,220355B,220555B,
C*   1   030323B,240655B,242255B,031205B,031203B,112355B,200555B,
C*   2   200355B,260155B,050755B,9*0,
C*   3         0,020615B,022215B,220255B,220355B,220555B,030323B,
C*   4   240655B,242255B,031205B,031203B,112355B,260155B,260255B,
C*   5   033555B,111355B,160555B,033755B,111322B,160355B,200555B,
C*   6   150555B,200355B,150355B,050755B,
C*   7   222355B,242455B,031217B,112355B,165555B,201011B,050755B,18*0,
C*   8         0,262417B,020524B,140115B,220455B,222355B,030723B,
C*   9   030704B,200255B,112355B,15*0,
C*   A         0,262417B,201011B,020524B,070115B,140115B,220455B,
C*   B   222355B,030723B,030704B,030702B,030204B,030223B,200255B,
C*   C   112355B,10*0/
      DATA NAMPAR /       0,"4121440,"4124440,"5120440,"5120640,
     1   "5121240,"4160723,"5221440,"5224440,"4162505,"4162503,
     2   "4464640,"5021240,"5020640,"5320240,"4261640,9*0,
     3          0,"4121515,"4124515,"5120440,"5120640,"5121240,
     4   "4160723,"5221440,"5224440,"4162505,"4162503,"4464640,
     5   "5320240,"5320440,"4154440,"4462640,"4721240,"4155040,
     6   "4462722,"4720640,"5021240,"4661240,"5020640,"4660640,
     7   "4261640,"5124640,"5225040,"4162517,"4464640,"4710040,
     8   "5022111,"4261640,18*0    ,       0,
     9   "5325117,"4121324,"4620315,"5121040,"5124640,"4161723,
     A   "4161704,"5020440,"4464640,15*0    ,      0,
     B   "5325117,"5022111,"4121324,"4360315,"4620315,"5121040,
     C   "5124640,"4161723,"4161704,"4161702,"4160504,"4160523,
     D   "5020440,"4464640,10*0/
C*    DATA LSKFN,LSFNA/130616B,061601B/
      DATA LSKFN,LSFNA/"4561516,"4323501/
C
C  INITIALIZE VARIABLES
C
      CALL SECOND(T1)
      VT=BOLTZ*(TEMPS(1)+273.0)/CHARGE
      ICARD1=1
      ICVFLG=0
      INOISE=0
      IONUM=0
      JACFLG=0
      JDSFLG=0
      JTRFLG=0
      KEXMOD=0
      KFROUT=0
      KINEL=0
      KSSOP=0
      LOCSOR=0
      NDES=0
      NOPRNT=0
      NOSOUT=0
      NOSPRT=0
      NOSTOP=0
      NOTINT=0
      NSENS=0
      NSPEC=0
      NUMEL=0
      NUMMOD=0
      NUMNOD=0
      NUMTEM=1
      NUNODS=0
      DO 1 I=1,3
    1 NUMOR(I)=0
      DO 2 I=1,25
      DO 2 J=1,5
    2 FNDATA(I,J)=0.0
      DO 10 I=1,20
   10 JELCNT(I)=0
C
C GET A CARD
C
   25 IF (KEOF.EQ.1) GO TO 5000
      IGOOF=0
      CALL CARD
      IF (IGOOF.EQ.0) GO TO 50
      NOGO=1
      GO TO 25
C
C  ELEMENT AND DEVICE CARDS
C
   50 IF (ID.GT.20) GO TO 300
      NUMEL=NUMEL+1
      IF (NUMEL.GT.400) GO TO 260
      IKNT=1
      IF (ID.NE.4) GO TO 60
      IF (ICODE(2).EQ.0) GO TO 60
      ID=5
      IKNT=2
   60 IF (KEXMOD.EQ.0) GO TO 70
      IF (ID.EQ.20) GO TO 280
      IDNO(NUMEL)=ID+20
      GO TO 80
   70 IDNO(NUMEL)=ID
      JELCNT(ID)=JELCNT(ID)+1
   80 NAME1(NUMEL)=FIELD(1)
      LOCAL1(NUMEL)=NOSTOP+1
      MNAME1(NUMEL)=IBLNK
      VALUE1(NUMEL)=0.0
      IF (ID.EQ.20) GO TO 230
      ISTOP=NNODS(ID)
      IF ((IKNT+ISTOP).GT.NUMFLD) GO TO 4000
      IF ((NOSTOP+ISTOP).GT.800) GO TO 260
      DO 90 I=1,ISTOP
   90 NODPL1(NOSTOP+I)=FIELD(IKNT+I)
      NOSTOP=NOSTOP+ISTOP
      GO TO (100,100,100,110,105,110,200,200,200,200),ID
C
C  RESISTORS, CAPACITORS, AND INDUCTORS
C
  100 IF (NUMFLD.LT.4) GO TO 250
      VALUE1(NUMEL)=FIELD(4)
      IF (VALUE1(NUMEL).LE.0.0) GO TO 250
      GO TO 25
C
C  CONTROLLED SOURCES
C
  105 MNAM=LOCSOR+1
      MNAME1(NUMEL)=MNAM
      LOCSOR=LOCSOR+1
      IF (LOCSOR.GT.150) GO TO 260
      SOURCE(MNAM)=0.0
      IF (NUMFLD.LT.7) GO TO 25
      VALUE1(NUMEL)=FIELD(7)
      IF (NUMFLD.LT.8) GO TO 25
      SOURCE(MNAM)=FIELD(8)
      GO TO 25
C
C  INDEPENDENT SOURCES
C
  110 MNAM=LOCSOR+1
      MNAME1(NUMEL)=MNAM
      LOCSOR=LOCSOR+5
      IF (LOCSOR.GT.150) GO TO 260
      DO 120 I=MNAM,LOCSOR
  120 SOURCE(I)=0.0
      IKNT=3
  130 IKNT=IKNT+1
      IF (IKNT.GT.NUMFLD) GO TO 25
      IF (ICODE(IKNT).EQ.1) GO TO 140
      IF (IKNT.GT.4) GO TO 270
      SOURCE(MNAM)=FIELD(IKNT)
      GO TO 25
  140 ITEMP=IFIX(FIELD(IKNT))/JSHIFT
      JKNT=0
      IF (ITEMP.EQ.LSDC) JKNT=1
      IF (ITEMP.EQ.LSAC) JKNT=2
      IF (ITEMP.EQ.LSPU) JKNT=3
      IF (ITEMP.EQ.LSEX) JKNT=4
      IF (ITEMP.EQ.LSSI) JKNT=5
      IF (JKNT.EQ.0) GO TO 270
      IKNT=IKNT+1
      IF (IKNT.GT.NUMFLD) GO TO 25
      IF (ICODE(IKNT).EQ.1) GO TO 140
      GO TO (150,160,170,170,170),JKNT
  150 SOURCE(MNAM)=FIELD(IKNT)
      GO TO 130
  160 SOURCE(MNAM+1)=FIELD(IKNT)
      IKNT=IKNT+1
      IF (IKNT.GT.NUMFLD) GO TO 25
      IF (ICODE(IKNT).EQ.1) GO TO 140
      SOURCE(MNAM+4)=FIELD(IKNT)
      GO TO 130
  170 IF (SOURCE(MNAM+3).NE.0.0) GO TO 270
      SOURCE(MNAM+3)=JKNT-2
      JKNT=LOCSOR+1
      LOCSOR=LOCSOR+7
      IF (LOCSOR.GT.150) GO TO 260
      DO 180 I=JKNT,LOCSOR
  180 SOURCE(I)=0.0
  190 SOURCE(JKNT)=FIELD(IKNT)
      IKNT=IKNT+1
      IF (IKNT.GT.NUMFLD) GO TO 25
      IF (ICODE(IKNT).EQ.1) GO TO 140
      JKNT=JKNT+1
      IF (JKNT.GT.LOCSOR) GO TO 270
      GO TO 190
C
C  DEVICE CARDS
C
  200 VALUE1(NUMEL)=1.0
      IKNT=NNODS(ID)+2
      IF (IKNT.GT.NUMFLD) GO TO 25
      MNAME1(NUMEL)=FIELD(IKNT)
      IF ((IKNT+1).GT.NUMFLD) GO TO 25
      VALUE1(NUMEL)=FIELD(IKNT+1)
      IF (VALUE1(NUMEL).LE.0.0) GO TO 250
      GO TO 25
C
C  EXTERNAL MODEL ELEMENT
C
  230 IF (NUMFLD.LT.3) GO TO 4000
      MNAME1(NUMEL)=FIELD(NUMFLD)
      ISTOP=NUMFLD-2
      IF ((NOSTOP+ISTOP).GT.800) GO TO 260
      DO 240 I=1,ISTOP
  240 NODPL1(NOSTOP+I)=FIELD(I+1)
      NOSTOP=NOSTOP+ISTOP
      VALUE1(NUMEL)=ISTOP
      GO TO 25
C
C  ELEMENT CARD ERRORS
C
  250 NOGO=1
      WRITE (6,251)
  251 FORMAT (//5X,'----------  VALUE IS NOT GREATER THAN ZERO'//)
      GO TO 25
  260 NOGO=1
      WRITE (6,261)
  261 FORMAT (//5X,'----------  ELEMENT LIMIT EXCEEDED'//)
      GO TO 25
  270 NOGO=1
      WRITE (6,271)
  271 FORMAT (//5X,'----------  SOURCE VALUES SPECIFIED INCORRECTLY'//)
      GO TO 25
  280 NOGO=1
      WRITE (6,281)
  281 FORMAT (//5X,'----------  EXTERNAL MODELS CANNOT BE NESTED'//)
      GO TO 25
C
C  CONTROL CARDS
C
  300 ID=ID-20
      GO TO (5000,400,800,1200,1400,1600,1800,2800,3000,
     1   3200,3400,3600),ID
C
C  MODEL CARD
C
  400 IF (NUMFLD.LT.2) GO TO 4100
      IF (ICODE(1).EQ.0) GO TO 600
      NAM=FIELD(1)
      IKNT=0
  410 IKNT=IKNT+1
      IF (IKNT.GT.NUMMOD) GO TO 420
      IF (NAM.NE.MODNAM(IKNT)) GO TO 410
      GO TO 600
  420 IF (NUMMOD.GE.20) GO TO 610
      NUMMOD=NUMMOD+1
      MODNAM(NUMMOD)=NAM
      IF (ICODE(2).EQ.0) GO TO 620
C*    NAM=FIELD(2)/KSHIFT
      NAM=FIELD(2)
      IKNT=0
  430 IKNT=IKNT+1
      IF (IKNT.GT.11) GO TO 620
      IF (NAM.NE.MODTYP(IKNT)) GO TO 430
      IF (IKNT.EQ.11) GO TO 700
      SYMVAL(NUMMOD,1)=TCODE(IKNT)
      ITYPE=MTYPE(IKNT)
      KIND(NUMMOD)=MOTYPE(IKNT)
      DO 440 I=2,25
  440 SYMVAL(NUMMOD,I)=0.0
      ISPOT=0
      IF (SYMVAL(NUMMOD,1).NE.0.0) ISPOT=1
      IPOINT=2
  450 IPOINT=IPOINT+1
      IF (IPOINT.GT.NUMFLD) GO TO 25
      IF (IPOINT.GT.26) GO TO 630
      IF (ICODE(IPOINT).EQ.1) GO TO 460
      ISPOT=ISPOT+1
      SYMVAL(NUMMOD,ISPOT)=FIELD(IPOINT)
      GO TO 450
C*460 NAM=FIELD(IPOINT)/KSHIFT
  460 NAM=FIELD(IPOINT)
      IF ((IPOINT+1).GT.NUMFLD) GO TO 25
      IF (NAM.NE.LSKFN) GO TO 462
      FNDATA(NUMMOD,1)=FIELD(IPOINT+1)
      GO TO 466
  462 IF (NAM.NE.LSFNA) GO TO 468
      FNDATA(NUMMOD,2)=FIELD(IPOINT+1)
  466 IPOINT=IPOINT+2
      IF (IPOINT.GT.NUMFLD) GO TO 25
      IF (ICODE(IPOINT).EQ.1) GO TO 460
      GO TO 630
  468 ISPOT=0
  470 ISPOT=ISPOT+1
      IF (ISPOT.GT.25) GO TO 630
      IF (NAM.NE.NAMPAR(ISPOT,ITYPE)) GO TO 470
      IPOINT=IPOINT+1
      IF (IPOINT.GT.NUMFLD) GO TO 25
      SYMVAL(NUMMOD,ISPOT)=FIELD(IPOINT)
      IPOINT=IPOINT+1
      IF (IPOINT.GT.NUMFLD) GO TO 25
      IF (ICODE(IPOINT).EQ.1) GO TO 460
      GO TO 630
  600 NOGO=1
      WRITE (6,601)
  601 FORMAT (//5X,'----------  ILLEGAL OR PREVIOUSLY DEFINED MODEL'//)
      GO TO 25
  610 NOGO=1
      WRITE (6,611)
  611 FORMAT (//5X,'----------  MODEL LIMIT EXCEEDED'//)
      GO TO 25
  620 NOGO=1
      WRITE (6,621)
  621 FORMAT (//5X,'----------  INCORRECT MODEL TYPE'//)
      GO TO 25
  630 NOGO=1
      WRITE (6,631)
  631 FORMAT (//5X,'----------  UNDEFINED PARAMETER NAME OR INCORRECT '
     1   'PARAMETER LIST'//)
      GO TO 25
C
C  EXTERNAL MODELS
C
  700 IF (KEXMOD.NE.0) GO TO 720
      KEXMOD=NUMMOD
      KIND(KEXMOD)=20
      SYMVAL(KEXMOD,1)=NUMEL+1
      SYMVAL(KEXMOD,3)=NUMFLD-2
      IF (NUMFLD.LT.3) GO TO 730
      IF (NUMFLD.GT.22) GO TO 730
      DO 710 I=3,NUMFLD
      IF (FIELD(I).EQ.0.0) GO TO 730
  710 SYMVAL(KEXMOD,I+3)=FIELD(I)
      GO TO 25
  720 NOGO=1
      WRITE (6,721)
  721 FORMAT (//5X,'----------  .FINIS CARD MISSING'//)
      GO TO 25
  730 NOGO=1
      WRITE (6,731)
  731 FORMAT (//5X,'----------  EXTERNAL MODEL NODE REFERANCES ARE '
     1   'INCORRECT'//)
      GO TO 25
C
C  OUTPUT CARD
C
  800 IF (IONUM.GT.9) GO TO 1020
      IF (NUMFLD.LT.1) GO TO 4100
      NAM=FIELD(1)
      IKNT=0
  810 IKNT=IKNT+1
      IF (IKNT.GT.IONUM) GO TO 820
      IF (NAM.NE.IONAM(IKNT)) GO TO 810
      GO TO 1030
  820 ITEMP=NAM/ISHIFT
      IPOINT=0
      IF (ITEMP.EQ.ILETN) IPOINT=1
      IF (ITEMP.EQ.ILETI) IPOINT=2
      IF (ITEMP.EQ.ILETV) IPOINT=3
      IF (IPOINT.EQ.0) GO TO 1030
      IF (IPOINT.GT.NUMFLD) GO TO 4100
      IONUM=IONUM+1
      IONAM(IONUM)=NAM
      IOFLG(IONUM)=3
      IF (IPOINT.EQ.1) GO TO 830
      IOPND(IONUM)=FIELD(2)
      IOFLG(IONUM)=2
      IF (IPOINT.EQ.2) GO TO 830
      IONND(IONUM)=FIELD(3)
      IOFLG(IONUM)=1
  830 IGOOF=0
      IFLAG=0
  840 IPOINT=IPOINT+1
      IF (IPOINT.GT.NUMFLD) GO TO 1010
      IF (ICODE(IPOINT).EQ.0) GO TO 1000
  850 ITEMP=FIELD(IPOINT)/JSHIFT
      IKNT=0
      IF (ITEMP.EQ.LSPR) IKNT=1
      IF (ITEMP.EQ.LSPL) IKNT=2
      IF (ITEMP.EQ.LSDC) IKNT=3
      IF (ITEMP.EQ.LSTR) IKNT=4
      IF (ITEMP.EQ.LSRE) IKNT=5
      IF (ITEMP.EQ.LSIM) IKNT=6
      IF (ITEMP.EQ.LSMA) IKNT=7
      IF (ITEMP.EQ.LSPH) IKNT=8
      IF (ITEMP.EQ.LSOU) IKNT=9
      IF (ITEMP.EQ.LSIN) IKNT=10
      IF (IKNT.EQ.0) GO TO 1000
      IF (IKNT.GT.2) GO TO 860
      IFLAG=IKNT
      GO TO 840
  860 IF (IFLAG.EQ.0) GO TO 1000
      IKNT=IKNT-2
      IF (IKNT.GT.2) GO TO 900
      KNTR=NUMOR(IKNT)
      IF (KNTR.EQ.0) GO TO 870
      IF (IOVAR(KNTR,IKNT).EQ.IONUM) GO TO 880
  870 NUMOR(IKNT)=NUMOR(IKNT)+1
      KNTR=NUMOR(IKNT)
      IOVAR(KNTR,IKNT)=IONUM
      IPRCOM(KNTR,IKNT)=0
      IPLCOM(KNTR,IKNT)=0
  880 IF (IFLAG.EQ.2) GO TO 890
      IPRCOM(KNTR,IKNT)=1
      GO TO 840
  890 IPLCOM(KNTR,IKNT)=1
      IPOINT=IPOINT+1
      IF (IPOINT.GT.NUMFLD) GO TO 1010
      IF (ICODE(IPOINT).EQ.1) GO TO 850
      PLTLIM(KNTR,IKNT,1)=FIELD(IPOINT)
      IPOINT=IPOINT+1
      IF (IPOINT.GT.NUMFLD) GO TO 1010
      IF (ICODE(IPOINT).EQ.1) GO TO 850
      PLTLIM(KNTR,IKNT,2)=FIELD(IPOINT)
      IPLCOM(KNTR,IKNT)=2
      GO TO 840
  900 KNTR=NUMOR(3)
      IF (KNTR.EQ.0) GO TO 910
      IF (IACVAR(KNTR).EQ.IONUM) GO TO 930
  910 KNTR=KNTR+1
      IF (KNTR.GT.5) GO TO 1020
      NUMOR(3)=KNTR
      IACVAR(KNTR)=IONUM
      DO 920 I=1,4
      IACPRT(KNTR,I)=0
  920 IACPLT(KNTR,I)=0
  930 IKNT=IKNT-2
      IF (IKNT.LT.5) GO TO 940
      IF (IOFLG(IONUM).NE.3) GO TO 1000
      IKNT=IKNT-4
      INOISE=KNTR
  940 IF (IFLAG.EQ.2) GO TO 950
      IACPRT(KNTR,IKNT)=1
      GO TO 840
  950 IACPLT(KNTR,IKNT)=1
      IPOINT=IPOINT+1
      IF (IPOINT.GT.NUMFLD) GO TO 1010
      IF (ICODE(IPOINT).EQ.1) GO TO 850
      ACPLIM(KNTR,IKNT,1)=FIELD(IPOINT)
      IPOINT=IPOINT+1
      IF (IPOINT.GT.NUMFLD) GO TO 1010
      IF (ICODE(IPOINT).EQ.1) GO TO 850
      ACPLIM(KNTR,IKNT,2)=FIELD(IPOINT)
      IACPLT(KNTR,IKNT)=2
      GO TO 840
 1000 IGOOF=1
      GO TO 840
 1010 IF (IGOOF.EQ.0) GO TO 25
      WRITE (6,1011)
 1011 FORMAT (//5X,'--- WARNING ---  UNDEFINED OUTPUT SPECIFICATION'//)
      GO TO 25
 1020 WRITE (6,1021)
 1021 FORMAT (//5X,'----------  OUTPUT LIMIT EXCEEDED'//)
      GO TO 25
 1030 WRITE (6,1031)
 1031 FORMAT (//5X,'----------  OUTPUT NAME IS ILLEGAL OR HAS BEEN '
     1  'DEFINED PREVIOUSLY'//)
      GO TO 25
C
C  DC ANALYSIS CARD
C
 1200 IF (NUMFLD.GT.0) GO TO 1210
      KSSOP=1
      GO TO 25
 1210 IKNT=1
 1220 IF (IKNT.GT.NUMFLD) GO TO 25
      IF (ICODE(IKNT).EQ.0) GO TO 1240
      ITEMP=IFIX(FIELD(IKNT))/JSHIFT
      IF (ITEMP.EQ.LSTC) GO TO 1230
      IF (ITEMP.EQ.LSOP) GO TO 1225
      IF (IKNT.GT.1) GO TO 1240
      IKNT=0
      GO TO 1230
 1225 KSSOP=1
      IKNT=IKNT+1
      IF (IKNT.GT.NUMFLD) GO TO 25
      IF (ICODE(IKNT).NE.1) GO TO 1240
      ITEMP=IFIX(FIELD(IKNT))/JSHIFT
      IF (ITEMP.EQ.LSTC) GO TO 1230
      IF ((IKNT+1).GT.NUMFLD) GO TO 4100
      KOVAR=FIELD(IKNT)
      KINEL=FIELD(IKNT+1)
      IKNT=IKNT+2
      GO TO 1220
 1230 IF ((IKNT+4).GT.NUMFLD) GO TO 4100
      ICVFLG=1
      ITCELM=FIELD(IKNT+1)
      TCSTAR=FIELD(IKNT+2)
      TCSTOP=FIELD(IKNT+3)
      TCINCR=FIELD(IKNT+4)
      IKNT=IKNT+5
      GO TO 1220
 1240 WRITE (6,1241)
 1241 FORMAT (//5X,'----------  DC ANALYSIS PARAMETERS ARE '
     1  'SPECIFIED INCORRECTLY'//)
      GO TO 25
C
C  AC ANALYSIS CARD
C
 1400 IKNT=1
 1410 IF (IKNT.GT.NUMFLD) GO TO 25
      IF (ICODE(IKNT).EQ.0) GO TO 1440
 1420 ITEMP=IFIX(FIELD(IKNT))/JSHIFT
      JKNT=0
      IF (ITEMP.EQ.LSLI) JKNT=1
      IF (ITEMP.EQ.LSDE) JKNT=2
      IF (ITEMP.EQ.LSOC) JKNT=3
      IF (ITEMP.EQ.LSNO) JKNT=4
      IF (JKNT.EQ.0) GO TO 1440
      IF (JKNT.GT.3) GO TO 1430
      IF ((IKNT+3).GT.NUMFLD) GO TO 4100
      JACFLG=1
      IDFREQ=JKNT
      FINCR=FIELD(IKNT+1)
      FSTART=FIELD(IKNT+2)
      FSTOP=FIELD(IKNT+3)
      IKNT=IKNT+4
      GO TO 1410
 1430 IF ((IKNT+2).GT.NUMFLD) GO TO 4100
      NOSOUT=FIELD(IKNT+1)
      NOSIN=FIELD(IKNT+2)
      IKNT=IKNT+3
      IF (IKNT.GT.NUMFLD) GO TO 25
      IF (ICODE(IKNT).EQ.1) GO TO 1420
      NOSPRT=FIELD(IKNT)
      IF (NOSPRT.LT.10) NOSPRT=10
      IKNT=IKNT+1
      GO TO 1410
 1440 WRITE (6,1441)
 1441 FORMAT (//5X,'----------  AC ANALYSIS PARAMETERS ARE DEFINED '
     1  'INCORRECTLY'//)
      GO TO 25
C
C  TRAN ANALYSIS CARD
C
 1600 IF (NUMFLD.LT.2) GO TO 4100
      TSTEP=FIELD(1)
      TSTOP=FIELD(2)
      TSTART=0.0
      NOTINT=0
      IKNT=3
      IF (NUMFLD.EQ.2) GO TO 1620
      IF (ICODE(3).EQ.1) GO TO 1620
      TSTART=FIELD(3)
      IKNT=4
 1610 IF ((IKNT+1).GT.NUMFLD) GO TO 1620
      IF (ICODE(IKNT).EQ.1) GO TO 1620
      IF (ICODE(IKNT+1).EQ.1) GO TO 1670
      NOTINT=NOTINT+1
      STEPS(NOTINT)=FIELD(IKNT)
      ENDPTS(NOTINT)=FIELD(IKNT+1)
      IKNT=IKNT+2
      GO TO 1610
 1620 IF (TSTOP.LE.0.0) GO TO 1690
      IF (TSTART.GE.TSTOP) GO TO 1690
      IF (TSTEP.LE.0.0) GO TO 1690
      JTRFLG=IFIX((TSTOP-TSTART)/TSTEP+0.5)+1
      IF (JTRFLG.LT.2) JTRFLG=2
      IF (JTRFLG.LE.101) GO TO 1630
      TSTEP=(TSTOP-TSTART)/100.0
      JTRFLG=101
      WRITE (6,1621) TSTEP
 1621 FORMAT (//5X,'--- WARNING ---  PRINT INCREMENT INCREASED TO  ',
     1   1PE10.3//)
 1630 IF (NOTINT.EQ.0) GO TO 1640
      IF (ENDPTS(NOTINT).GE.(0.9999*TSTOP)) GO TO 1650
      IF (NOTINT.GE.5) GO TO 1680
 1640 NOTINT=NOTINT+1
      STEPS(NOTINT)=TSTEP
      ENDPTS(NOTINT)=TSTOP
 1650 IF (STEPS(1).LE.0.0) GO TO 1680
      IF (ENDPTS(1).LT.STEPS(1)) GO TO 1680
      TOTPTS=ENDPTS(1)/STEPS(1)
      IF (NOTINT.EQ.1) GO TO 1670
      DO 1660 I=2,NOTINT
      IF (STEPS(I).LE.0.0) GO TO 1680
      IF ((ENDPTS(I)-ENDPTS(I-1)).LT.STEPS(I)) GO TO 1680
      TOTPTS=TOTPTS+(ENDPTS(I)-ENDPTS(I-1))/STEPS(I)
 1660 CONTINUE
 1670 IF (TOTPTS.LT.1001.0) GO TO 1700
 1680 JTRFLG=0
      WRITE (6,1681)
 1681 FORMAT (//5X,'----------  TRANSIENT INTERVALS ARE SPECIFIED '
     1   'INCORRECTLY OR NUMBER OF TIMEPOINTS EXCEEDS 1000'//)
      GO TO 25
 1690 WRITE (6,1691)
 1691 FORMAT (//5X,'----------  FINAL TIME IS LESS THAN START TIME, '
     1   'OR FINAL TIME IS LESS THAN ZERO'//)
      GO TO 25
 1700 IF (IKNT.GT.NUMFLD) GO TO 25
      ITEMP=IFIX(FIELD(IKNT))/JSHIFT
      IF (ITEMP.NE.LSFO) GO TO 25
      IF ((IKNT+2).GT.NUMFLD) GO TO 25
      KFROUT=FIELD(IKNT+1)
      FORFRE=FIELD(IKNT+2)
      GO TO 25
C
C  TEMPERATURE CARD
C
 1800 IF (NUMFLD.LT.1) GO TO 4100
      IF (NUMFLD.LT.6) GO TO 1810
      NUMFLD=5
      WRITE (6,1801)
 1801 FORMAT (//5X,'----------  ONLY FIRST FIVE TEMPERATURES USED'//)
 1810 KNTR=1
      DO 1820 I=1,NUMFLD
      IF (FIELD(I).LT.-223.0) GO TO 1820
      KNTR=KNTR+1
      TEMPS(KNTR)=FIELD(I)
 1820 CONTINUE
      NUMTEM=KNTR
      GO TO 25
C
C  SENSITIVITY CARD
C
 2800 IF (NUMFLD.LT.1) GO TO 4100
      IKNT=0
 2810 IKNT=IKNT+1
      IF (IKNT.GT.NUMFLD) GO TO 25
      IF (ICODE(IKNT).EQ.0) GO TO 2820
      IF (NSENS.GE.10) GO TO 2820
      NSENS=NSENS+1
      KSNOUT(NSENS)=FIELD(IKNT)
      GO TO 2810
 2820 NSENS=0
      WRITE (6,2821)
 2821 FORMAT (//5X,'----------  SENSITIVITY VARIABLES ARE INCORRECTLY '
     1   'SPECIFIED OR SENSITIVITY OUTPUT LIMIT EXCEEDED'//)
      GO TO 25
C
C  DESIGN CARD
C
 3000 IF (NUMFLD.LT.1) GO TO 4100
      JDSFLG=1
      IKNT=0
 3010 IKNT=IKNT+1
      IF (IKNT.GT.NUMFLD) GO TO 25
      IF (ICODE(IKNT).EQ.0) GO TO 3030
      IF (NDES.GE.30) GO TO 3030
      NDES=NDES+1
      NOELEM(NDES)=FIELD(IKNT)
      GO TO 3010
 3030 JDSFLG=0
      NDES=0
      WRITE (6,3031)
 3031 FORMAT (//5X,'----------  DESIGN PARAMETERS ARE INCORRECTLY '
     1   'SPECIFIED OR NUMBER OF PARAMETERS EXCEEDS 30'//)
      GO TO 25
C
C  SPEC CARD
C
 3200 IF (NUMFLD.LT.2) GO TO 4100
      IKNT=0
 3210 IKNT=IKNT+1
      IF (IKNT.GT.NUMFLD) GO TO 25
      IF (ICODE(IKNT).EQ.0) GO TO 3220
      IF (NSPEC.GE.10) GO TO 3220
      NSPEC=NSPEC+1
      NOUNUM(NSPEC)=FIELD(IKNT)
      IKNT=IKNT+1
      IF (IKNT.GT.NUMFLD) GO TO 3220
      IF (ICODE(IKNT).EQ.1) GO TO 3220
      DESVAL(NSPEC)=FIELD(IKNT)
      WEIGHT(NSPEC)=1.0
      IF (IKNT.EQ.NUMFLD) GO TO 25
      IF (ICODE(IKNT+1).EQ.1) GO TO 3210
      IKNT=IKNT+1
      WEIGHT(NSPEC)=FIELD(IKNT)
      GO TO 3210
 3220 NSPEC=0
      WRITE (6,3221)
 3221 FORMAT (//5X,'----------  DESIGN OUTPUTS ARE INCORRECTLY '
     1   'SPECIFIED OR OUTPUT LIMIT EXCEEDED'//)
      GO TO 25
C
C  PRINT INHIBIT CARD
C
 3400 NOPRNT=1
      GO TO 25
C
C  FINIS CARD
C
 3600 IF (KEXMOD.EQ.0) GO TO 25
      SYMVAL(KEXMOD,2)=NUMEL
      IF (SYMVAL(KEXMOD,1).GT.SYMVAL(KEXMOD,2)) GO TO 3610
      KEXMOD=0
      GO TO 25
 3610 KEXMOD=0
      NOGO=1
      WRITE (6,3611)
 3611 FORMAT (//5X,'----------  EXTERNAL MODEL CONTAINS NO ELEMENTS'//)
      GO TO 25
C
C  CARD ERROR
C
 4000 NOGO=1
 4100 WRITE (6,4101)
 4101 FORMAT (//5X,'----------  INSUFFICIENT NUMBER OF PARAMETERS ON '
     1  'ABOVE CARD'//)
      GO TO 25
C
C  END
C
 5000 IF (KEXMOD.EQ.0) GO TO 5020
      NOGO=1
      WRITE (6,5011)
 5011 FORMAT (//5X,'----------  NO .FINIS CARD'//)
 5020 CALL SECOND(T2)
      RTIMES(1)=T2-T1
      RETURN
      END
      SUBROUTINE CARD

      COMMON NODPLC(800),YNL(2001),TSTORE(2001),TRACUR(1700),VN(401),
     1   VNIM1(401),IORDER(401),IUR(402),IUC(800),MATLOC(1800)
      COMMON/MISCEL/NOGO,IGOOF,NOPRNT,IACCT,JOBNAM(16),RTIMES(15)
      COMMON/CARDS/ID,NUMFLD,ICARD1,KEOF
      COMMON/KNSTNT/TWOPI,XLOG2,XLOG10,RAD,BOLTZ,CHARGE,VT
C
C
      DIMENSION ID1(20),ID2(12),FIELD(60),ICODE(60),IFIELD(20)
      EQUIVALENCE (FIELD(1),YNL(1)),(ICODE(1),YNL(101)),
     1   (IFIELD(1),YNL(201))
C
C  ID1    R , C , L , I , * , V , Q , D , J , M , 9* , X
C
C*    DATA ID1 /22B,3B,14B,11B,0,26B,21B,4B,12B,15B,9*0,30B/
      DATA ID1 /"122,"103,"114,"111,0,"126,"121,"104,"112,"115,9*0,
     1   "130/
C
C  ID2  END , MODEL , OUTPUT , DC , AC , TRAN , TEMP , SENSE ,
C       DESIGN , SPEC , NP , FINIS
C
C*    DATA ID2 /516B,1517B,1725B,403B,103B,2422B,2405B,2305B,405B,
C*   1   2320B,1620B,611B/
      DATA ID2 /"21316,"23317,"23725,"21103,"20303,"25122,"25105,
     1   "24705,"21105,"24720,"23520,"21511/
C
C
C*    DATA IBLNK /5555555555555555B/
      DATA IBLNK /"402010040/
C*    DATA ISPACE,IASTK,IPER,ICOMMA,IZERO,IPLUS,IMINUS,ILETE,ILETM,
C*   1   ILETG,ILETK,ILETU,ILETN,ILETP/55B,47B,57B,56B,33B,45B,46B,
C*   2   5B,15B,7B,13B,25B,16B,20B/
      DATA ISPACE,IASTK,IPER,ICOMMA,IZERO,IPLUS,IMINUS,ILETE,ILETM,
     1   ILETG,ILETK,ILETU,ILETN,ILETP/"040,"052,"056,"054,
     2   "060,"053,"055,"105,"115,"107,"113,"125,"116,"120/
C*    DATA ISHIFT /100B/
      DATA ILETA,ILETZ/"101,"132/
      DATA ISHIFT /"200/
C*    DATA JSHIFT /100000000000000B/
      DATA JSHIFT /"10000000/
C*    DATA IEQUAL /54B/
      DATA IEQUAL /"075/
C
C
      NUMFLD=0
      ID=0
      IF (ICARD1.EQ.1) GO TO 400
C
C  FIRST PASS
C
   20 WRITE (6,21) (IFIELD(I),I=1,ISTOP)
C* 21 FORMAT (5X,10(R8))
   21 FORMAT (5X,20(R4))
      NOFLD=0
      JUMP=1
      GO TO 301
   25 IF (ICHAR.EQ.ISPACE) GO TO 300
      IF (ICHAR.NE.IASTK) GO TO 28
      ICARD1=1
      GO TO 400
C
C  ELEMENT CARD  GET ID
C
   28 IF (ICHAR.EQ.IPER) GO TO 31
      DO 30 I=1,20
      IF (ICHAR.NE.ID1(I)) GO TO 30
      ID=I
      GO TO 95
   30 CONTINUE
      GO TO 50
C
C  CONTROL CARD  PACK LEAD PERIOD AND GET ID
C
   31 JUMP=16
      GO TO 300
   32 JCHAR=ICHAR
      JUMP=2
      GO TO 300
   35 ICHAR=JCHAR*ISHIFT+ICHAR
      DO 38 I=1,12
      IF (ICHAR.NE.ID2(I)) GO TO 38
      ID=I+20
      GO TO 39
   38 CONTINUE
      GO TO 50
   39 JUMP=3
      GO TO 300
   40 IF (ICHAR.EQ.ISPACE) GO TO 55
      IF (ICHAR.EQ.ICOMMA) GO TO 61
      IF (ICHAR.EQ.IEQUAL) GO TO 61
      GO TO 300
C
C  ERROR   UNKNOWN CARD
C
   50 IGOOF=1
      WRITE (6,51)
   51 FORMAT (//5X,'----------  ABOVE CARD IS UNRECOGNIZABLE'//)
      GO TO 400
C
C  THIS LOOP USED FOR ALL SUCEEDING PASSES
C  IF LAST FIELD WAS ENDED BY A SPACE IGNORE SPACES AND FIRST COMMA
C
   55 JUMP=4
      GO TO 300
   60 IF (NOFLD.GT.ISTOP) GO TO 400
      IF (ICHAR.EQ.ISPACE) GO TO 300
      IF (ICHAR.EQ.ICOMMA) GO TO 61
      IF (ICHAR.EQ.IEQUAL) GO TO 61
      GO TO 65
C
C  IF LAST FIELD WAS ENDED BY A COMMA IGNORE ONLY SPACES
C
   61 IF (NUMFLD.GT.59) GO TO 400
      JUMP=5
      GO TO 300
   62 IF (NOFLD.GT.ISTOP) GO TO 400
      IF (ICHAR.EQ.ISPACE) GO TO 300
      IF (ICHAR.EQ.ICOMMA) GO TO 63
      IF (ICHAR.EQ.IEQUAL) GO TO 63
      GO TO 65
C
C  TWO COMMAS SEPARATED ONLY BY SPACE (S) IMPLIES A VACANT (ZERO) FIELD
C
   63 NUMFLD=NUMFLD+1
      ICODE(NUMFLD)=0
      FIELD(NUMFLD)=0.0
      GO TO 61
C
C  NAME FIELD
C  ICODE = 1  SIGNIFIES A NAME
C
   65 IF (ICHAR.LT.ILETA.OR.ICHAR.GT.ILETZ) GO TO 125
   95 IF (NUMFLD.GT.59) GO TO 400
      NUMFLD=NUMFLD+1
      NAM=0
      ICHK=0
      ICODE(NUMFLD)=1
      ICOUNT=1
  100 NAM=NAM*ISHIFT+ICHAR
      ICOUNT=ICOUNT+1
      IF (ICOUNT.GT.3) GO TO 110
      JUMP=6
      GO TO 300
  105 IF (ICHAR.EQ.ISPACE) GO TO 118
      IF (ICHAR.EQ.ICOMMA) GO TO 117
      IF (ICHAR.EQ.IEQUAL) GO TO 117
      GO TO 100
C
C  FINISH THE FIELD
C
  110 FIELD(NUMFLD)=NAM
      JUMP=7
      GO TO 300
  115 IF (ICHAR.EQ.ISPACE) GO TO 55
      IF (ICHAR.EQ.ICOMMA) GO TO 61
      IF (ICHAR.EQ.IEQUAL) GO TO 61
      GO TO 300
C
C  PACK FIELD WITH BLANKS
C
  117 ICHK=1
  118 DO 120 I=ICOUNT,3
  120 NAM=NAM*ISHIFT+ISPACE
      FIELD(NUMFLD)=NAM
      IF (ICHK) 55,55,61
C
C  NUMBER FIELD
C  ICODE = 0   SIGNIFIES A NUMBER FIELD
C
  125 IF (NUMFLD.GT.59) GO TO 400
      ICHK=0
      NUMFLD=NUMFLD+1
      NUM=0
      IEXP=0
      ISET=0
      ICODE(NUMFLD)=0
C
C  CHECK FOR A SIGN
C
      ISIN=0
      IF (ICHAR.EQ.IPLUS) ISIN=1
      IF (ICHAR.EQ.IMINUS) ISIN=-1
      IF (ISIN.NE.0) GO TO 130
      ISIN=1
      JUMP=9
      GO TO 138
  130 JUMP=8
      GO TO 300
  135 IF (ICHAR.EQ.ISPACE) GO TO 300
      JUMP=9
  138 IF (ICHAR.EQ.ICOMMA) GO TO 205
      IF (ICHAR.EQ.IEQUAL) GO TO 205
      IDIGIT=ICHAR-IZERO
      IF (IDIGIT.LT.0) GO TO 140
      IF (IDIGIT.GT.9) GO TO 140
      NUM=NUM*10+IDIGIT
      IF (ISET.EQ.0) GO TO 300
      IEXP=IEXP-1
      GO TO 300
C
C  CHARACTER NOT A DIGIT
C  CHECK FOR SPACE, DEC POINT, E NOTATION, OR SCALE FACTOR
C
  140 IF (ICHAR.EQ.ISPACE) GO TO 206
      IF (ICHAR.EQ.IPER) GO TO 155
      IF (ICHAR.EQ.ILETE) GO TO 160
      GO TO 185
C
C  DECIMAL POINT
C
  155 IF (ISET.EQ.1) GO TO 210
      ISET=1
      GO TO 300
C
C  E FORMAT
C
  160 ITEMP=0
      JUMP=11
      GO TO 300
  165 IF (ICHAR.EQ.ISPACE) GO TO 300
      IEXSIN=0
      IF (ICHAR.EQ.IPLUS) IEXSIN=1
      IF (ICHAR.EQ.IMINUS) IEXSIN=-1
      IF (IEXSIN.NE.0) GO TO 170
      IEXSIN=1
      JUMP=13
      GO TO 178
  170 JUMP=12
      GO TO 300
  175 IF (ICHAR.EQ.ISPACE) GO TO 300
      JUMP=13
  178 IF (ICHAR.EQ.ICOMMA) GO TO 179
      IF (ICHAR.EQ.IEQUAL) GO TO 179
      IF (ICHAR.EQ.ISPACE) GO TO 180
      IDIGIT=ICHAR-IZERO
      IF (IDIGIT.LT.0) GO TO 182
      IF (IDIGIT.GT.9) GO TO 182
      ITEMP=ITEMP*10+IDIGIT
      GO TO 300
  179 ICHK=1
  180 IEXP=IEXP+IEXSIN*ITEMP
      GO TO 206
  182 IEXP=IEXP+IEXSIN*ITEMP
      JUMP=15
      GO TO 202
C
C  SCALE FACTOR
C
  185 IF (ICHAR.NE.ILETM) GO TO 200
      JUMP=14
      GO TO 300
  190 IF (ICHAR.EQ.ILETE) GO TO 195
      ITEMP=-3
      GO TO 201
  195 ITEMP=6
      GO TO 201
  200 ITEMP=0
      IF (ICHAR.EQ.ILETG) ITEMP=9
      IF (ICHAR.EQ.ILETK) ITEMP=3
      IF (ICHAR.EQ.ILETU) ITEMP=-6
      IF (ICHAR.EQ.ILETN) ITEMP=-9
      IF (ICHAR.EQ.ILETP) ITEMP=-12
  201 IEXP=IEXP+ITEMP
      JUMP=15
  202 IF (ICHAR.EQ.ICOMMA) GO TO 205
      IF (ICHAR.EQ.IEQUAL) GO TO 205
      IF (ICHAR.EQ.ISPACE) GO TO 206
      GO TO 300
C
C  PUT THE NUMBER TOGETHER
C
  205 ICHK=1
  206 IF (NUM) 207,209,207
C*207 IF (IEXP.GT.40) GO TO 210
  207 IF (IEXP.GT.35) GO TO 210
C*    IF (IEXP.LT.-40) GO TO 209
      IF (IEXP.LT.-35) GO TO 209
      IF (IEXP.EQ.0) GO TO 208
      VAL=NUM*EXP(IEXP*XLOG10)
      IF (VAL.GT.1.0E20) GO TO 210
      IF (VAL.LT.1.0E-35) GO TO 209
      FIELD(NUMFLD)=ISIN*VAL
      IF (ICHK) 55,55,61
  208 FIELD(NUMFLD)=ISIN*NUM
      IF (ICHK) 55,55,61
  209 FIELD(NUMFLD)=0.0
      IF (ICHK) 55,55,61
C
C  ERROR
C
  210 IGOOF=1
      WRITE (6,211) NUMFLD
  211 FORMAT (//5X,'----------  ABOVE CARD HAS ERROR IN FIELD  ',I5//)
      GO TO 400
C
C  GET NEXT CHARACTER
C  THIS LOOP IS A LOCAL SUBROUTINE
C  RETURN POINT DETERMINED BY JUMP
C
  300 IFDPOS=IFDPOS+1
C*    IF (IFDPOS.LT.9) GO TO 305
      IF (IFDPOS.LT.5) GO TO 305
C*    IF (IFDPOS.GT.11) GO TO 210
      IF (IFDPOS.GT.21) GO TO 210
  301 NOFLD=NOFLD+1
      IF (NOFLD.GT.ISTOP) GO TO 310
      IFLD=IFIELD(NOFLD)
      IFDPOS=1
  305 ICHAR=IFLD/JSHIFT
      IFLD=(IFLD-ICHAR*JSHIFT)*ISHIFT
      GO TO 315
  310 ICHAR=ISPACE
  315 GO TO (25,35,40,60,62,105,115,135,138,210,165,175,178,190,
     1   202,32,435),JUMP
C
C  READ A CARD
C
  400 IF (ID.EQ.21) RETURN
C*    READ (5,401) (IFIELD(I),I=1,10)
      READ (5,401,END=500) (IFIELD(I),I=1,20)
C*401 FORMAT (10R8)
  401 FORMAT (20R4)
C*    IF (EOF,5) 500,410
C
C  ELIMINATE BLANK FIELDS
C
C*410 ISTOP=10
  410 ISTOP=20
  415 IF (IFIELD(ISTOP).NE.IBLNK) GO TO 420
      ISTOP=ISTOP-1
      IF (ISTOP.LT.1) GO TO 400
      GO TO 415
  420 IF (ICARD1.EQ.0) GO TO 430
      ICARD1=0
      GO TO 20
  430 NOFLD=0
      JUMP=17
      GO TO 301
  435 IF (ICHAR.EQ.ISPACE) GO TO 300
      IF (ICHAR.EQ.IPLUS) GO TO 440
      RETURN
  440 WRITE (6,21) (IFIELD(I),I=1,ISTOP)
      IF (IGOOF.EQ.1) GO TO 400
      GO TO 55
  500 KEOF=1
      IGOOF=1
      WRITE (6,501)
  501 FORMAT (//5X,'----------  DATA END OF FILE ENCOUNTERED BEFORE '
     1   'END CARD'//)
      RETURN
      END