SUBROUTINE WRITE(X,N,NNLINE,IWIDTH,IDEC)
C
C     PURPOSE--THIS SUBROUTINE WRITES OUT THE CONTENTS
C              OF THE SINGLE PRECISION VECTOR X IN AN ORDERLY
C              AND NEAT FASHION.
C              THIS SUBROUTINE GIVES THE DATA ANALYST THE ABILITY
C              TO GET DATA OUT OF THE MACHINE WITHOUT HAVING
C              TO WORRY ABOUT AND SPECIFY FORMATS.
C     INPUT ARGUMENTS--X      = THE SINGLE PRECISION VECTOR OF
C                               OBSERVATIONS TO BE PRINTED OUT.
C                    --N      = THE INTEGER NUMBER OF OBSERVATIONS
C                               IN THE VECTOR X.
C                    --NNLINE = THE INTEGER VALUE 
C                               OF THE DESIRED NUMBER OF
C                               OBSERVATIONS IN X TO APPEAR PER LINE. 
C                    --IWIDTH = THE INTEGER VALUE 
C                               OF THE LARGEST NUMBER OF
C                               CHARACTERS THAT A VALUE IN X MAY TAKE UP
C                               = THE DESIRED NUMBER OF INTEGER DIGITS
C                               + THE DESIRED NUMBER OF DECIMAL DIGITS
C                               + 1 DIGIT FOR THE SIGN
C                               + 1 DIGIT FOR THE DECIMAL POINT.
C                               (NO PROVISION NEED BE MADE FOR LEADING
C                               OR TRAILING SEPARATION BLANKS--THIS IS
C                               DONE AUTOMATICALLY BY THE SUBROUTINE.)
C                    --IDEC   = THE INTEGER VALUE 
C                               OF THE DESIRED NUMBER OF
C                               DECIMAL DIGITS TO BE PRINTED OUT.
C     OUTPUT--A LISTING OF THE N VALUES OF THE DATA VECTOR X
C             WITH NNLINE VALUES PRINTED PER LINE, AND WITH 
C             BLANKS AUTOMATICALLY INSERTED BETWEEN ADJACENT VALUES.
C             A BLANK LINE WILL APPEAR AFTER EVERY TENTH LINE.
C             50 LINES OF DATA WILL APPEAR PER PRINTER PAGE.
C     PRINTING--YES.
C     RESTRICTIONS--NNLINE MUST BE 1 OR LARGER;
C                 --IWIDTH MUST BE 2 OR LARGER;
C                 --IWIDTH MUST BE 12 OR SMALLER; 
C                 --IDEC MUST BE 0 OR LARGER;
C                 --IDEC MUST BE (IWIDTH-2) OR SMALLER;
C                 --THE PRODUCT OF NNLINE AND (IWIDTH+1) MUST
C                   BE 131 OR SMALLER.
C     OTHER DATAPAC   SUBROUTINES NEEDED--NONE.
C     FORTRAN LIBRARY SUBROUTINES NEEDED--NONE.
C     MODE OF INTERNAL OPERATIONS--SINGLE PRECISION.
C     LANGUAGE--ANSI FORTRAN. 
C     COMMENT--THE LISTED VALUES ARE TO BE READ ROW BY ROW--
C              THAT IS, THE FIRST VALUE IN X APPEARS
C              ON ROW 1, COLUMN 1 OF THE OUTPUT,
C              THE SECOND VALUE IN X APPEARS ON ROW 1, COLUMN 2,
C              ETC. 
C     REFERENCES--NONE.
C     WRITTEN BY--JAMES J. FILLIBEN
C                 STATISTICAL ENGINEERING LABORATORY (205.03)
C                 NATIONAL BUREAU OF STANDARDS
C                 WASHINGTON, D. C. 20234
C                 PHONE--301-921-2315
C     ORIGINAL VERSION--JUNE      1972. 
C     UPDATED         --NOVEMBER  1975. 
C
C---------------------------------------------------------------------
C
      DIMENSION X(1)
C
      IPR=6
      MAXWID=12
      MAXCHA=131
C
C     CHECK THE INPUT ARGUMENTS FOR ERRORS
C
      IF(N.LT.1)GOTO50
      IF(NNLINE.LT.1)GOTO55
      IF(IWIDTH.LT.2.OR.MAXWID.LT.IWIDTH)GOTO60
      IWIDM2=IWIDTH-2
      IF(IDEC.LT.0.OR.IWIDM2.LT.IDEC)GOTO65
      IWIDP1=IWIDTH+1
      NUMCHA=NNLINE*IWIDP1
      IF(NUMCHA.GT.MAXCHA)GOTO70
      GOTO90
   50 WRITE(IPR,15) 
      WRITE(IPR,47)N
      RETURN
   55 WRITE(IPR,25) 
      WRITE(IPR,47)NNLINE
      RETURN
   60 WRITE(IPR,38)MAXWID
      WRITE(IPR,47)IWIDTH
      RETURN
   65 WRITE(IPR,48)IWIDTH,IWIDM2
      WRITE(IPR,47)IDEC
      RETURN
   70 WRITE(IPR,71)MAXCHA
      WRITE(IPR,72)NNLINE,IWIDTH,NNLINE,IWIDP1,NUMCHA
      RETURN
   90 CONTINUE
   15 FORMAT(1H , 91H***** FATAL ERROR--THE SECOND INPUT ARGUMENT TO THE
     1 WRITE  SUBROUTINE IS NON-POSITIVE *****)
   25 FORMAT(1H , 91H***** FATAL ERROR--THE THIRD  INPUT ARGUMENT TO THE
     1 WRITE  SUBROUTINE IS NON-POSITIVE *****)
   38 FORMAT(1H , 98H***** FATAL ERROR--THE FOURTH INPUT ARGUMENT TO THE
     1 WRITE  SUBROUTINE IS OUTSIDE THE ALLOWABLE (2,,I4,16H) INTERVAL *
     1****)
   47 FORMAT(1H , 35H***** THE VALUE OF THE ARGUMENT IS ,I8   ,6H *****)
   48 FORMAT(1H ,105H***** FATAL ERROR--THE FIFTH  INPUT ARGUMENT TO THE
     1 WRITE  SUBROUTINE IS NEGATIVE OR EXCEEDS IWIDTH-2 (= ,I6,5H-2 = ,
     1I6,7H) *****) 
   71 FORMAT(1H ,122H***** FATAL ERROR--THE PRODUCT OF THE 3RD INPUT ARG
     1UMENT TO THE WRITE SUBROUTINE AND THE (4TH INPUT ARGUMENT + 1) EXC
     1EEDS ,I3,5H ****)
   72 FORMAT(1H , 33H***** THE VALUE OF THE PRODUCT = ,I8,4H X (,I8,8H +
     1 1) = ,I8,3H X ,I8,3H = ,I8,6H *****)
C
C-----START POINT-----------------------------------------------------
C
      NLINES=((N-1)/NNLINE)+1 
      WRITE(IPR,998)
      WRITE(IPR,905)N
      WRITE(IPR,910)NLINES,NNLINE
      WRITE(IPR,999)
      DO300I=1,NLINES
      JMAX=NNLINE*I 
      JMIN=JMAX-NNLINE+1
      IF(JMAX.GT.N)JMAX=N
      IDECP1=IDEC+1 
      GOTO(101,102,103,104,105,106,107,108,109,110,111,112),IWIDTH
  101 RETURN
  102 GOTO120
  103 GOTO(130,131),IDECP1
  104 GOTO(140,141,142),IDECP1
  105 GOTO(150,151,152,153),IDECP1
  106 GOTO(160,161,162,163,164),IDECP1
  107 GOTO(170,171,172,173,174,175),IDECP1
  108 GOTO(180,181,182,183,184,185,186),IDECP1
  109 GOTO(190,191,192,193,194,195,196,197),IDECP1
  110 GOTO(200,201,202,203,204,205,206,207,208),IDECP1
  111 GOTO(210,211,212,213,214,215,216,217,218,219),IDECP1
  112 GOTO(220,221,222,223,224,225,226,227,228,229,230),IDECP1
C
  120 WRITE(IPR,620)(X(J),J=JMIN,JMAX)
      GOTO100
  130 WRITE(IPR,630)(X(J),J=JMIN,JMAX)
      GOTO100
  131 WRITE(IPR,631)(X(J),J=JMIN,JMAX)
      GOTO100
  140 WRITE(IPR,640)(X(J),J=JMIN,JMAX)
      GOTO100
  141 WRITE(IPR,641)(X(J),J=JMIN,JMAX)
      GOTO100
  142 WRITE(IPR,642)(X(J),J=JMIN,JMAX)
      GOTO100
  150 WRITE(IPR,650)(X(J),J=JMIN,JMAX)
      GOTO100
  151 WRITE(IPR,651)(X(J),J=JMIN,JMAX)
      GOTO100
  152 WRITE(IPR,652)(X(J),J=JMIN,JMAX)
      GOTO100
  153 WRITE(IPR,653)(X(J),J=JMIN,JMAX)
      GOTO100
  160 WRITE(IPR,660)(X(J),J=JMIN,JMAX)
      GOTO100
  161 WRITE(IPR,661)(X(J),J=JMIN,JMAX)
      GOTO100
  162 WRITE(IPR,662)(X(J),J=JMIN,JMAX)
      GOTO100
  163 WRITE(IPR,663)(X(J),J=JMIN,JMAX)
      GOTO100
  164 WRITE(IPR,664)(X(J),J=JMIN,JMAX)
      GOTO100
  170 WRITE(IPR,670)(X(J),J=JMIN,JMAX)
      GOTO100
  171 WRITE(IPR,671)(X(J),J=JMIN,JMAX)
      GOTO100
  172 WRITE(IPR,672)(X(J),J=JMIN,JMAX)
      GOTO100
  173 WRITE(IPR,673)(X(J),J=JMIN,JMAX)
      GOTO100
  174 WRITE(IPR,674)(X(J),J=JMIN,JMAX)
      GOTO100
  175 WRITE(IPR,675)(X(J),J=JMIN,JMAX)
      GOTO100
  180 WRITE(IPR,680)(X(J),J=JMIN,JMAX)
      GOTO100
  181 WRITE(IPR,681)(X(J),J=JMIN,JMAX)
      GOTO100
  182 WRITE(IPR,682)(X(J),J=JMIN,JMAX)
      GOTO100
  183 WRITE(IPR,683)(X(J),J=JMIN,JMAX)
      GOTO100
  184 WRITE(IPR,684)(X(J),J=JMIN,JMAX)
      GOTO100
  185 WRITE(IPR,685)(X(J),J=JMIN,JMAX)
      GOTO100
  186 WRITE(IPR,686)(X(J),J=JMIN,JMAX)
      GOTO100
  190 WRITE(IPR,690)(X(J),J=JMIN,JMAX)
      GOTO100
  191 WRITE(IPR,691)(X(J),J=JMIN,JMAX)
      GOTO100
  192 WRITE(IPR,692)(X(J),J=JMIN,JMAX)
      GOTO100
  193 WRITE(IPR,693)(X(J),J=JMIN,JMAX)
      GOTO100
  194 WRITE(IPR,694)(X(J),J=JMIN,JMAX)
      GOTO100
  195 WRITE(IPR,695)(X(J),J=JMIN,JMAX)
      GOTO100
  196 WRITE(IPR,696)(X(J),J=JMIN,JMAX)
      GOTO100
  197 WRITE(IPR,697)(X(J),J=JMIN,JMAX)
      GOTO100
  200 WRITE(IPR,700)(X(J),J=JMIN,JMAX)
      GOTO100
  201 WRITE(IPR,701)(X(J),J=JMIN,JMAX)
      GOTO100
  202 WRITE(IPR,702)(X(J),J=JMIN,JMAX)
      GOTO100
  203 WRITE(IPR,703)(X(J),J=JMIN,JMAX)
      GOTO100
  204 WRITE(IPR,704)(X(J),J=JMIN,JMAX)
      GOTO100
  205 WRITE(IPR,705)(X(J),J=JMIN,JMAX)
      GOTO100
  206 WRITE(IPR,706)(X(J),J=JMIN,JMAX)
      GOTO100
  207 WRITE(IPR,707)(X(J),J=JMIN,JMAX)
      GOTO100
  208 WRITE(IPR,708)(X(J),J=JMIN,JMAX)
      GOTO100
  210 WRITE(IPR,710)(X(J),J=JMIN,JMAX)
      GOTO100
  211 WRITE(IPR,711)(X(J),J=JMIN,JMAX)
      GOTO100
  212 WRITE(IPR,712)(X(J),J=JMIN,JMAX)
      GOTO100
  213 WRITE(IPR,713)(X(J),J=JMIN,JMAX)
      GOTO100
  214 WRITE(IPR,714)(X(J),J=JMIN,JMAX)
      GOTO100
  215 WRITE(IPR,715)(X(J),J=JMIN,JMAX)
      GOTO100
  216 WRITE(IPR,716)(X(J),J=JMIN,JMAX)
      GOTO100
  217 WRITE(IPR,717)(X(J),J=JMIN,JMAX)
      GOTO100
  218 WRITE(IPR,718)(X(J),J=JMIN,JMAX)
      GOTO100
  219 WRITE(IPR,719)(X(J),J=JMIN,JMAX)
      GOTO100
  220 WRITE(IPR,720)(X(J),J=JMIN,JMAX)
      GOTO100
  221 WRITE(IPR,721)(X(J),J=JMIN,JMAX)
      GOTO100
  222 WRITE(IPR,722)(X(J),J=JMIN,JMAX)
      GOTO100
  223 WRITE(IPR,723)(X(J),J=JMIN,JMAX)
      GOTO100
  224 WRITE(IPR,724)(X(J),J=JMIN,JMAX)
      GOTO100
  225 WRITE(IPR,725)(X(J),J=JMIN,JMAX)
      GOTO100
  226 WRITE(IPR,726)(X(J),J=JMIN,JMAX)
      GOTO100
  227 WRITE(IPR,727)(X(J),J=JMIN,JMAX)
      GOTO100
  228 WRITE(IPR,728)(X(J),J=JMIN,JMAX)
      GOTO100
  229 WRITE(IPR,729)(X(J),J=JMIN,JMAX)
      GOTO100
  230 WRITE(IPR,730)(X(J),J=JMIN,JMAX)
C
  100 I50=I-50*(I/50)
      IF(I50.EQ.0)WRITE(IPR,998)
      IF(I50.EQ.0)GOTO300
      I10=I-10*(I/10)
      IF(I10.EQ.0)WRITE(IPR,999)
  300 CONTINUE
C
C
  620 FORMAT(1H ,43(F2.0,1X)) 
  630 FORMAT(1H ,32(F3.0,1X)) 
  631 FORMAT(1H ,32(F3.1,1X)) 
  640 FORMAT(1H ,26(F4.0,1X)) 
  641 FORMAT(1H ,26(F4.1,1X)) 
  642 FORMAT(1H ,26(F4.2,1X)) 
  650 FORMAT(1H ,21(F5.0,1X)) 
  651 FORMAT(1H ,21(F5.1,1X)) 
  652 FORMAT(1H ,21(F5.2,1X)) 
  653 FORMAT(1H ,21(F5.3,1X)) 
  660 FORMAT(1H ,18(F6.0,1X)) 
  661 FORMAT(1H ,18(F6.1,1X)) 
  662 FORMAT(1H ,18(F6.2,1X)) 
  663 FORMAT(1H ,18(F6.3,1X)) 
  664 FORMAT(1H ,18(F6.4,1X)) 
  670 FORMAT(1H ,16(F7.0,1X)) 
  671 FORMAT(1H ,16(F7.1,1X)) 
  672 FORMAT(1H ,16(F7.2,1X)) 
  673 FORMAT(1H ,16(F7.3,1X)) 
  674 FORMAT(1H ,16(F7.4,1X)) 
  675 FORMAT(1H ,16(F7.5,1X)) 
  680 FORMAT(1H ,14(F8.0,1X)) 
  681 FORMAT(1H ,14(F8.1,1X)) 
  682 FORMAT(1H ,14(F8.2,1X)) 
  683 FORMAT(1H ,14(F8.3,1X)) 
  684 FORMAT(1H ,14(F8.4,1X)) 
  685 FORMAT(1H ,14(F8.5,1X)) 
  686 FORMAT(1H ,14(F8.6,1X)) 
  690 FORMAT(1H ,13(F9.0,1X)) 
  691 FORMAT(1H ,13(F9.1,1X)) 
  692 FORMAT(1H ,13(F9.2,1X)) 
  693 FORMAT(1H ,13(F9.3,1X)) 
  694 FORMAT(1H ,13(F9.4,1X)) 
  695 FORMAT(1H ,13(F9.5,1X)) 
  696 FORMAT(1H ,13(F9.6,1X)) 
  697 FORMAT(1H ,13(F9.7,1X)) 
  700 FORMAT(1H ,11(F10.0,1X))
  701 FORMAT(1H ,11(F10.1,1X))
  702 FORMAT(1H ,11(F10.2,1X))
  703 FORMAT(1H ,11(F10.3,1X))
  704 FORMAT(1H ,11(F10.4,1X))
  705 FORMAT(1H ,11(F10.5,1X))
  706 FORMAT(1H ,11(F10.6,1X))
  707 FORMAT(1H ,11(F10.7,1X))
  708 FORMAT(1H ,11(F10.8,1X))
  710 FORMAT(1H ,10(F11.0,1X))
  711 FORMAT(1H ,10(F11.1,1X))
  712 FORMAT(1H ,10(F11.2,1X))
  713 FORMAT(1H ,10(F11.3,1X))
  714 FORMAT(1H ,10(F11.4,1X))
  715 FORMAT(1H ,10(F11.5,1X))
  716 FORMAT(1H ,10(F11.6,1X))
  717 FORMAT(1H ,10(F11.7,1X))
  718 FORMAT(1H ,10(F11.8,1X))
  719 FORMAT(1H ,10(F11.9,1X))
  720 FORMAT(1H ,10(F12.0,1X))
  721 FORMAT(1H ,10(F12.1,1X))
  722 FORMAT(1H ,10(F12.2,1X))
  723 FORMAT(1H ,10(F12.3,1X))
  724 FORMAT(1H ,10(F12.4,1X))
  725 FORMAT(1H ,10(F12.5,1X))
  726 FORMAT(1H ,10(F12.6,1X))
  727 FORMAT(1H ,10(F12.7,1X))
  728 FORMAT(1H ,10(F12.8,1X))
  729 FORMAT(1H ,10(F12.9,1X))
  730 FORMAT(1H ,10(F12.10,1X))
  905 FORMAT(1H ,50HTHE TOTAL NUMBER OF OBSERVATIONS PRINTED BELOW IS ,I
     17)
  910 FORMAT(1H ,10HTHERE ARE ,I7,10H ROWS AND ,I7,8H COLUMNS)
  998 FORMAT(1H1)
  999 FORMAT(1H )
      RETURN
      END