      SUBROUTINE EDWRST(ISUBN0)
C
C     PURPOSE--WRITE OUT THE STRING IN ICOUT.
C
C     DATE--JANUARY 24,1985
C     UPDATED--MAY 1993 SO ALL OUTPUT THROUGH SINGLE ROUTINE
C     UPDATED--AUGUST  1993 COMPILE ERROR ON RS-6000
C
C---------------------------------------------------------------------
C
      CHARACTER*6 ISUBN0
CCCCC AUGUST 1993.  ADD FOLLOWING TO AVOID COMPILE ERROR ON RS-6000
      CHARACTER*4 ISUBN1
      CHARACTER*4 ISUBN2
      CHARACTER*4 ISTEPN
C
C-----COMMON VARIABLES (EDITING)-----------------------------------------------
C
      INCLUDE 'DPCOPA.INC'
      INCLUDE 'EDCOMM.INC'
C
C-----COMMON VARIABLES (GENERAL)-----------------------------------------------
C
      COMMON /MACH/IRD,IPR,CPUMIN,CPUMAX,NUMBPC,NUMCPW,NUMBPW
C
C-----START POINT-------------------------------------------
C
      ISUBN1='EDWR'
      ISUBN2='ST  '
C
      IF(IBUGWR.EQ.'OFF'.AND.ISUBRO.NE.'WRST')GOTO90
      WRITE(IPR,999)
  999 FORMAT(1X)
      WRITE(IPR,51)
   51 FORMAT(1H ,'***** AT THE BEGINNING OF EDWRST--')
      WRITE(IPR,52)ISUBN0
   52 FORMAT(1H ,'THE CALLING ROUTINE WAS ',A6)
      WRITE(IPR,53)NCOUT,ILOUT
   53 FORMAT(1H ,'NCOUT,ILOUT = ',2I8)
      WRITE(IPR,55)
   55 FORMAT(1H ,'          123456789.123456789.123456789.123456789.')
      WRITE(IPR,56)ICOUT(1:40)
   56 FORMAT(1H ,'ICOUT = ',40A1)
      WRITE(IPR,63)ICOUT
   63 FORMAT(1H ,'ICOUT = ',A230)
      WRITE(IPR,64)IPRISW,IOUNIT,INUMSW
   64 FORMAT(1H ,'IPRISW,IOUNIT,INUMSW = ',A4,I8,2X,A4)
      WRITE(IPR,999)
      IF(IBUGT1.EQ.'ON')CALL EDTRA1
   90 CONTINUE
C
CCCCC THE FOLLOWING SECTION WAS ADDED    MAY 1993
CCCCC TO ALLOW A SINGLE OUTPUT OF TEXT MATERIAL  MAY 1993
C               **************************************************
C               **  STEP 10--                                   **
C               **  DETERMINE THE LENGTH OF THE STRING          **
C               **  (BY IGNORING BLANK CHARACTERS AT THE END)   **
C               **************************************************
C
      IF(NCOUT.LE.-1)THEN
         DO1000I=1,240
            J=240-I+1
            IF(ICOUT(J:J).NE.' ')GOTO1050
 1000    CONTINUE
         NCOUT=1
         GOTO1090
 1050    CONTINUE
         NCOUT=J
 1090    CONTINUE
      ENDIF
C
C               ****************************
C               **  STEP 11--             **
C               **  WRITE OUT THE STRING  **
C               ****************************
C
      ISTEPN='11'
CCCCC IF(IBUGWR.EQ.'ON'.OR.ISUBRO.EQ.'WRST')
CCCCC1CALL EDTRA3(ISTEPN,ISUBN1,ISUBN2)
C
      IF(IPRISW.EQ.'ON')IOUNIT=IPRINU
C
      IF(IPRISW.EQ.'OFF'.AND.INUMSW.EQ.'OFF')GOTO1110
      GOTO1119
C
 1110 CONTINUE
      NCOUT2=NCOUT
      IF(NCOUT.GT.238)NCOUT2=238
      WRITE(IPR,1111)(ICOUT(I:I),I=1,NCOUT2)
 1111 FORMAT(1H ,238A1)
C
      IF(ICOUT(1:5).EQ.'[TOP]')GOTO1114
      IF(ICOUT(1:8).EQ.'[BOTTOM]')GOTO1114
      IF(ICOUT(1:4).EQ.'**ST')GOTO1114
      IF(ICOUT(1:4).EQ.'**st')GOTO1114
      IF(IPRISW.EQ.'ON')
     1WRITE(IOUNIT,1112)(ICOUT(I:I),I=1,NCOUT2)
 1112 FORMAT(1H ,238A1)
 1114 CONTINUE
C
      GOTO1190
 1119 CONTINUE
C
      IF(IPRISW.EQ.'ON'.OR.INUMSW.EQ.'ON')GOTO1120
      GOTO1190
C
 1120 CONTINUE
      NCOUT2=NCOUT
      IF(NCOUT.GT.120)NCOUT2=120
C
      IF(ILOUT.EQ.-999)THEN
         WRITE(IPR,1121)(ICOUT(I:I),I=1,NCOUT2)
 1121    FORMAT(1H ,230A1)
      ELSE IF(ILOUT.LE.0.AND.ILOUT.NE.-999)THEN
         WRITE(IPR,1122)(ICOUT(I:I),I=1,NCOUT2)
 1122    FORMAT(1H ,10X,230A1)
      ELSE IF(ILOUT.GE.1)THEN
         WRITE(IPR,1123)ILOUT,(ICOUT(I:I),I=1,NCOUT2)
 1123    FORMAT(1H ,I6,':',3X,230A1)
      ENDIF
C
      IF(IPRISW.EQ.'ON')THEN
         IF(ILOUT.EQ.-999)THEN
            WRITE(IOUNIT,1131)(ICOUT(I:I),I=1,NCOUT2)
 1131       FORMAT(1H ,230A1)
         ELSE IF(ILOUT.LE.0.AND.ILOUT.NE.-999)THEN
            WRITE(IOUNIT,1132)(ICOUT(I:I),I=1,NCOUT2)
 1132       FORMAT(1H ,10X,230A1)
         ELSE IF(ILOUT.GE.1)THEN
            WRITE(IOUNIT,1133)ILOUT,(ICOUT(I:I),I=1,NCOUT2)
 1133       FORMAT(1H ,I6,':',3X,230A1)
         ENDIF
      ENDIF
C
 1190 CONTINUE
C
CCCCC THE FOLLOWING SECTION WAS ADDED    MAY 1993
CCCCC TO ALLOW A SINGLE OUTPUT OF TEXT MATERIAL  MAY 1993
      ICOUT=' '
      NCOUT=(-999)
      ILOUT=(-999)
C
C               *****************
C               **  STEP 90--  **
C               **  EXIT       **
C               *****************
C
 9000 CONTINUE
      IF(IBUGWR.EQ.'OFF'.AND.ISUBRO.NE.'WRST')GOTO9090
      WRITE(IPR,999)
      WRITE(IPR,9011)
 9011 FORMAT(1H ,'***** AT THE END       OF EDWRST--')
      WRITE(IPR,9012)NCOUT,ILOUT
 9012 FORMAT(1H ,'NCOUT,ILOUT = ',2I8)
      WRITE(IPR,9013)ICOUT
 9013 FORMAT(1H ,'ICOUT = ',A230)
      WRITE(IPR,9014)IPRISW,IPRINU,IOUNIT
 9014 FORMAT(1H ,'IPRISW,IPRINU,IOUNIT = ',A4,2I8)
      WRITE(IPR,999)
      IF(IBUGT2.EQ.'ON')CALL EDTRA2
 9090 CONTINUE
C
      RETURN
      END
