      SUBROUTINE MAIN
      INTEGER STMODE, STATUS, MSGCMD
      LOGICAL*1 C, CLOWER, GETCH
      COMMON / CHDRS / HSIZE(50), HADDR(50), RDATE(50), HDATE(12, 50), H
     *FROM(20, 50), HSUBJ(30, 50), HDELE(50)
      INTEGER HSIZE
      INTEGER*4 HADDR
      REAL RDATE
      LOGICAL*1 HDATE
      LOGICAL*1 HFROM
      LOGICAL*1 HSUBJ
      LOGICAL*1 HDELE
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      LOGICAL*1 PSTR(4)
      DATA PSTR(1)/60/,PSTR(2)/45/,PSTR(3)/32/,PSTR(4)/0/
      CALL QUERY(33Husage:  msg [-fn] [-p[n]] [file].)
      RAWIN = STMODE(1, 1)
      RAWOUT = STMODE(2, 1)
      CALL MSGINT
23000 CONTINUE
      CALL MPUTCH(10, 2)
      CALL PTMLIN(PSTR, 2)
23003 CONTINUE
      C = GETCH(C, 1)
      IF (.NOT.(C .EQ. 26 .OR. C .EQ. -1))GOTO 23006
      GOTO 23005
23006 CONTINUE
      IF (.NOT.(C .EQ. 13))GOTO 23008
      C = 110
23008 CONTINUE
23004 IF (.NOT.(C .NE. 10))GOTO 23003
23005 CONTINUE
      IF (.NOT.(C .EQ. 26 .OR. C .EQ. -1))GOTO 23010
      GOTO 23002
23010 CONTINUE
      C = CLOWER(C)
      STATUS = MSGCMD(C)
23001 IF (.NOT.(STATUS .EQ. -1))GOTO 23000
23002 CONTINUE
      CALL MSGEND
      RETURN
      END
      SUBROUTINE BANNER
      INTEGER MRKHLP
      EXTERNAL PTMLIN
      COMMON / CMHELP / HLPINT, HLPPTR(30), HLPSCR(30)
      INTEGER HLPINT
      INTEGER*4 HLPPTR
      INTEGER*4 HLPSCR
      LOGICAL*1 BANNST(7)
      DATA BANNST(1)/98/,BANNST(2)/97/,BANNST(3)/110/,BANNST(4)/110/,BAN
     *NST(5)/101/,BANNST(6)/114/,BANNST(7)/0/
      IF (.NOT.(MRKHLP(HLPINT, HLPPTR, BANNST, HLPSCR) .EQ. 0))GOTO 2301
     *2
      CALL PUTHLP(HLPINT, HLPSCR, BANNST, 2, PTMLIN)
23012 CONTINUE
      RETURN
      END
      SUBROUTINE CURFIL(INT)
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      LOGICAL*1 FILSTR(8)
      DATA FILSTR(1)/32/,FILSTR(2)/102/,FILSTR(3)/105/,FILSTR(4)/108/,FI
     *LSTR(5)/101/,FILSTR(6)/32/,FILSTR(7)/39/,FILSTR(8)/0/
      CALL PTMLIN(FILSTR, INT)
      CALL PTMLIN(FILE, INT)
      CALL MPUTCH(39, INT)
      RETURN
      END
      SUBROUTINE DELEMF(LINARA)
      INTEGER LINARA(50), I, N
      COMMON / CHDRS / HSIZE(50), HADDR(50), RDATE(50), HDATE(12, 50), H
     *FROM(20, 50), HSUBJ(30, 50), HDELE(50)
      INTEGER HSIZE
      INTEGER*4 HADDR
      REAL RDATE
      LOGICAL*1 HDATE
      LOGICAL*1 HFROM
      LOGICAL*1 HSUBJ
      LOGICAL*1 HDELE
      I=1
23014 IF (.NOT.(I .LT. 50 .AND. LINARA(I) .NE. 0))GOTO 23016
      N = LINARA(I)
      HDELE(N) = 1
23015 I=I+1
      GOTO 23014
23016 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DOANSW(X)
      LOGICAL*1 X, TFILE(40)
      INTEGER N, OUT, I
      INTEGER GMSGNO, CREATE, GETLIN, MATCH, INDEX
      COMMON / CHDRS / HSIZE(50), HADDR(50), RDATE(50), HDATE(12, 50), H
     *FROM(20, 50), HSUBJ(30, 50), HDELE(50)
      INTEGER HSIZE
      INTEGER*4 HADDR
      REAL RDATE
      LOGICAL*1 HDATE
      LOGICAL*1 HFROM
      LOGICAL*1 HSUBJ
      LOGICAL*1 HDELE
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      COMMON / MSGSCR / BUF(512), SCRFIL(40)
      LOGICAL*1 BUF
      LOGICAL*1 SCRFIL
      LOGICAL*1 STR(7)
      LOGICAL*1 ANS(4)
      LOGICAL*1 SNDMSG(7)
      LOGICAL*1 MINUST(4)
      LOGICAL*1 MINUSS(9)
      LOGICAL*1 MINUSR(21)
      LOGICAL*1 SPNERR(26)
      DATA STR(1)/97/,STR(2)/110/,STR(3)/115/,STR(4)/119/,STR(5)/101/,ST
     *R(6)/114/,STR(7)/0/
      DATA ANS(1)/97/,ANS(2)/110/,ANS(3)/115/,ANS(4)/0/
      DATA SNDMSG(1)/115/,SNDMSG(2)/110/,SNDMSG(3)/100/,SNDMSG(4)/109/,S
     *NDMSG(5)/115/,SNDMSG(6)/103/,SNDMSG(7)/0/
      DATA MINUST(1)/32/,MINUST(2)/45/,MINUST(3)/116/,MINUST(4)/0/
      DATA MINUSS(1)/32/,MINUSS(2)/34/,MINUSS(3)/45/,MINUSS(4)/115/,MINU
     *SS(5)/82/,MINUSS(6)/101/,MINUSS(7)/58/,MINUSS(8)/32/,MINUSS(9)/0/
      DATA MINUSR(1)/32/,MINUSR(2)/34/,MINUSR(3)/45/,MINUSR(4)/114/,MINU
     *SR(5)/89/,MINUSR(6)/111/,MINUSR(7)/117/,MINUSR(8)/114/,MINUSR(9)/3
     *2/,MINUSR(10)/109/,MINUSR(11)/101/,MINUSR(12)/115/,MINUSR(13)/115/
     *,MINUSR(14)/97/,MINUSR(15)/103/,MINUSR(16)/101/,MINUSR(17)/32/,MIN
     *USR(18)/111/,MINUSR(19)/102/,MINUSR(20)/32/,MINUSR(21)/0/
      DATA SPNERR(1)/32/,SPNERR(2)/32/,SPNERR(3)/69/,SPNERR(4)/114/,SPNE
     *RR(5)/114/,SPNERR(6)/111/,SPNERR(7)/114/,SPNERR(8)/32/,SPNERR(9)/1
     *15/,SPNERR(10)/112/,SPNERR(11)/97/,SPNERR(12)/119/,SPNERR(13)/110/
     *,SPNERR(14)/105/,SPNERR(15)/110/,SPNERR(16)/103/,SPNERR(17)/32/,SP
     *NERR(18)/115/,SPNERR(19)/110/,SPNERR(20)/100/,SPNERR(21)/109/,SPNE
     *RR(22)/115/,SPNERR(23)/103/,SPNERR(24)/32/,SPNERR(25)/32/,SPNERR(2
     *6)/0/
      CALL PTMLIN(STR, 2)
      IF (.NOT.(GMSGNO(N) .EQ. -3))GOTO 23017
      DOANSW = -3
      GOTO 23018
23017 CONTINUE
      CALL SCRATF(ANS, TFILE)
      OUT = CREATE(TFILE, 2)
      IF (.NOT.(OUT .NE. -3))GOTO 23019
      CALL SEEK(HADDR(N), UNIT)
      I=GETLIN(BUF,UNIT)
23021 IF (.NOT.(I .GT. 1 .AND. I .NE. -1))GOTO 23023
      CALL FOLD(BUF)
      IF (.NOT.(MATCH(BUF, FROMPT) .EQ. 1))GOTO 23024
      GOTO 23023
23024 CONTINUE
23022 I=GETLIN(BUF,UNIT)
      GOTO 23021
23023 CONTINUE
      I = INDEX(BUF, 32) + 1
      CALL SKIPBL(BUF, I)
      CALL SCOPY(BUF, I, BUF, 1)
      CALL PUTLIN(BUF, OUT)
      CALL CLOSE(OUT)
      I = 1
      CALL STCOPY(SNDMSG, 1, BUF, I)
      CALL STCOPY(MINUST, 1, BUF, I)
      CALL STCOPY(TFILE, 1, BUF, I)
      CALL STCOPY(MINUSS, 1, BUF, I)
      CALL STCOPY(HSUBJ(1,N), 1, BUF, I)
      CALL CHCOPY(34, BUF, I)
      CALL STCOPY(MINUSR, 1, BUF, I)
      CALL STCOPY(HDATE(1,N), 1, BUF, I)
      CALL CHCOPY(34, BUF, I)
      IF (.NOT.(SPWNIT(BUF) .EQ. -3))GOTO 23026
      CALL PTMLIN(SPNERR)
23026 CONTINUE
      CALL REMOVE(TFILE)
      DOANSW = 0
      GOTO 23020
23019 CONTINUE
      DOANSW = -3
23020 CONTINUE
23018 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DOBACK(LINARA)
      INTEGER LINARA(50)
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      LOGICAL*1 STR(34)
      LOGICAL*1 ERRMSG(29)
      DATA STR(1)/98/,STR(2)/97/,STR(3)/99/,STR(4)/107/,STR(5)/105/,STR(
     *6)/110/,STR(7)/103/,STR(8)/32/,STR(9)/117/,STR(10)/112/,STR(11)/32
     */,STR(12)/45/,STR(13)/32/,STR(14)/112/,STR(15)/114/,STR(16)/101/,S
     *TR(17)/118/,STR(18)/105/,STR(19)/111/,STR(20)/117/,STR(21)/115/,ST
     *R(22)/32/,STR(23)/109/,STR(24)/101/,STR(25)/115/,STR(26)/115/,STR(
     *27)/97/,STR(28)/103/,STR(29)/101/,STR(30)/32/,STR(31)/105/,STR(32)
     */115/,STR(33)/58/,STR(34)/0/
      DATA ERRMSG(1)/99/,ERRMSG(2)/97/,ERRMSG(3)/110/,ERRMSG(4)/110/,ERR
     *MSG(5)/111/,ERRMSG(6)/116/,ERRMSG(7)/32/,ERRMSG(8)/98/,ERRMSG(9)/9
     *7/,ERRMSG(10)/99/,ERRMSG(11)/107/,ERRMSG(12)/117/,ERRMSG(13)/112/,
     *ERRMSG(14)/32/,ERRMSG(15)/112/,ERRMSG(16)/97/,ERRMSG(17)/115/,ERRM
     *SG(18)/116/,ERRMSG(19)/32/,ERRMSG(20)/109/,ERRMSG(21)/101/,ERRMSG(
     *22)/115/,ERRMSG(23)/115/,ERRMSG(24)/97/,ERRMSG(25)/103/,ERRMSG(26)
     */101/,ERRMSG(27)/32/,ERRMSG(28)/49/,ERRMSG(29)/0/
      CALL PTMLIN(STR, 2)
      IF (.NOT.(CURMSG .GT. 1))GOTO 23028
      CURMSG = CURMSG - 1
      CALL ONEMSG(CURMSG)
      DOBACK = 0
      GOTO 23029
23028 CONTINUE
      CALL PTMLIN(ERRMSG, 2)
      DOBACK = -3
23029 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DOCURR(X)
      LOGICAL*1 X, TEMP(5)
      INTEGER ITOC
      INTEGER JUNK
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      LOGICAL*1 OFS(4)
      LOGICAL*1 MSGS(13)
      LOGICAL*1 STR(19)
      DATA OFS(1)/32/,OFS(2)/111/,OFS(3)/102/,OFS(4)/0/
      DATA MSGS(1)/32/,MSGS(2)/109/,MSGS(3)/101/,MSGS(4)/115/,MSGS(5)/11
     *5/,MSGS(6)/97/,MSGS(7)/103/,MSGS(8)/101/,MSGS(9)/115/,MSGS(10)/32/
     *,MSGS(11)/105/,MSGS(12)/110/,MSGS(13)/0/
      DATA STR(1)/99/,STR(2)/117/,STR(3)/114/,STR(4)/114/,STR(5)/101/,ST
     *R(6)/110/,STR(7)/116/,STR(8)/32/,STR(9)/109/,STR(10)/101/,STR(11)/
     *115/,STR(12)/115/,STR(13)/97/,STR(14)/103/,STR(15)/101/,STR(16)/32
     */,STR(17)/105/,STR(18)/115/,STR(19)/0/
      DATA TEMP(1) /32/
      CALL PTMLIN(STR, 2)
      JUNK = ITOC(CURMSG, TEMP(2), 4)
      CALL PTMLIN(TEMP, 2)
      CALL PTMLIN(OFS, 2)
      JUNK = ITOC(NMSGS, TEMP(2), 4)
      CALL PTMLIN(TEMP, 2)
      CALL PTMLIN(MSGS, 2)
      CALL CURFIL(2)
      DOCURR = 0
      RETURN
      END
      INTEGER FUNCTION DODELE(LINARA)
      INTEGER LINARA(50)
      INTEGER MSGSEQ
      LOGICAL*1 STR(7)
      DATA STR(1)/100/,STR(2)/101/,STR(3)/108/,STR(4)/101/,STR(5)/116/,S
     *TR(6)/101/,STR(7)/0/
      CALL PTMLIN(STR, 2)
      IF (.NOT.(MSGSEQ(LINARA) .EQ. -3))GOTO 23030
      DODELE = -3
      GOTO 23031
23030 CONTINUE
      CALL DELEMF(LINARA)
      DODELE = 0
23031 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DOEXIT(LINARA)
      INTEGER LINARA(50), STATUS
      INTEGER SAVEMF, GTCONF
      LOGICAL*1 STR(20)
      LOGICAL*1 ERRMSG(27)
      DATA STR(1)/101/,STR(2)/120/,STR(3)/105/,STR(4)/116/,STR(5)/32/,ST
     *R(6)/97/,STR(7)/110/,STR(8)/100/,STR(9)/32/,STR(10)/117/,STR(11)/1
     *12/,STR(12)/100/,STR(13)/97/,STR(14)/116/,STR(15)/101/,STR(16)/32/
     *,STR(17)/111/,STR(18)/108/,STR(19)/100/,STR(20)/0/
      DATA ERRMSG(1)/10/,ERRMSG(2)/63/,ERRMSG(3)/32/,ERRMSG(4)/67/,ERRMS
     *G(5)/97/,ERRMSG(6)/110/,ERRMSG(7)/39/,ERRMSG(8)/116/,ERRMSG(9)/32/
     *,ERRMSG(10)/117/,ERRMSG(11)/112/,ERRMSG(12)/100/,ERRMSG(13)/97/,ER
     *RMSG(14)/116/,ERRMSG(15)/101/,ERRMSG(16)/32/,ERRMSG(17)/109/,ERRMS
     *G(18)/97/,ERRMSG(19)/105/,ERRMSG(20)/108/,ERRMSG(21)/32/,ERRMSG(22
     *)/102/,ERRMSG(23)/105/,ERRMSG(24)/108/,ERRMSG(25)/101/,ERRMSG(26)/
     *46/,ERRMSG(27)/0/
      CALL PTMLIN(STR, 2)
      CALL CURFIL(2)
      IF (.NOT.(GTCONF(STATUS) .EQ. 0))GOTO 23032
      DOEXIT = -3
      GOTO 23033
23032 CONTINUE
      IF (.NOT.(SAVEMF(LINARA) .EQ. -3))GOTO 23034
      CALL PTMLIN(ERRMSG, 2)
      DOEXIT = -3
      GOTO 23035
23034 CONTINUE
      DOEXIT = -1
23035 CONTINUE
23033 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DOFORW(X)
      LOGICAL*1 X, FILE(40)
      INTEGER LINARA(2), I, INT
      INTEGER GMSGNO, CREATE, SPWNIT
      COMMON / MSGSCR / BUF(512), SCRFIL(40)
      LOGICAL*1 BUF
      LOGICAL*1 SCRFIL
      LOGICAL*1 STR(8)
      LOGICAL*1 FWD(4)
      LOGICAL*1 START(39)
      LOGICAL*1 NULL(1)
      LOGICAL*1 STOP(39)
      LOGICAL*1 SNDMSG(7)
      LOGICAL*1 MINUSM(4)
      LOGICAL*1 SPNERR(25)
      DATA STR(1)/102/,STR(2)/111/,STR(3)/114/,STR(4)/119/,STR(5)/97/,ST
     *R(6)/114/,STR(7)/100/,STR(8)/0/
      DATA FWD(1)/102/,FWD(2)/119/,FWD(3)/100/,FWD(4)/0/
      DATA START(1)/45/,START(2)/45/,START(3)/45/,START(4)/45/,START(5)/
     *45/,START(6)/32/,START(7)/83/,START(8)/116/,START(9)/97/,START(10)
     */114/,START(11)/116/,START(12)/32/,START(13)/111/,START(14)/102/,S
     *TART(15)/32/,START(16)/102/,START(17)/111/,START(18)/114/,START(19
     *)/119/,START(20)/97/,START(21)/114/,START(22)/100/,START(23)/101/,
     *START(24)/100/,START(25)/32/,START(26)/109/,START(27)/101/,START(2
     *8)/115/,START(29)/115/,START(30)/97/,START(31)/103/,START(32)/101/
     *,START(33)/32/,START(34)/45/,START(35)/45/,START(36)/45/,START(37)
     */45/,START(38)/45/,START(39)/0/
      DATA NULL(1)/0/
      DATA STOP(1)/45/,STOP(2)/45/,STOP(3)/45/,STOP(4)/45/,STOP(5)/45/,S
     *TOP(6)/45/,STOP(7)/32/,STOP(8)/69/,STOP(9)/110/,STOP(10)/100/,STOP
     *(11)/32/,STOP(12)/111/,STOP(13)/102/,STOP(14)/32/,STOP(15)/102/,ST
     *OP(16)/111/,STOP(17)/114/,STOP(18)/119/,STOP(19)/97/,STOP(20)/114/
     *,STOP(21)/100/,STOP(22)/101/,STOP(23)/100/,STOP(24)/32/,STOP(25)/1
     *09/,STOP(26)/101/,STOP(27)/115/,STOP(28)/115/,STOP(29)/97/,STOP(30
     *)/103/,STOP(31)/101/,STOP(32)/32/,STOP(33)/45/,STOP(34)/45/,STOP(3
     *5)/45/,STOP(36)/45/,STOP(37)/45/,STOP(38)/45/,STOP(39)/0/
      DATA SNDMSG(1)/115/,SNDMSG(2)/110/,SNDMSG(3)/100/,SNDMSG(4)/109/,S
     *NDMSG(5)/115/,SNDMSG(6)/103/,SNDMSG(7)/0/
      DATA MINUSM(1)/32/,MINUSM(2)/45/,MINUSM(3)/109/,MINUSM(4)/0/
      DATA SPNERR(1)/32/,SPNERR(2)/32/,SPNERR(3)/69/,SPNERR(4)/114/,SPNE
     *RR(5)/114/,SPNERR(6)/111/,SPNERR(7)/114/,SPNERR(8)/32/,SPNERR(9)/1
     *15/,SPNERR(10)/112/,SPNERR(11)/97/,SPNERR(12)/119/,SPNERR(13)/110/
     *,SPNERR(14)/105/,SPNERR(15)/110/,SPNERR(16)/103/,SPNERR(17)/32/,SP
     *NERR(18)/115/,SPNERR(19)/110/,SPNERR(20)/100/,SPNERR(21)/109/,SPNE
     *RR(22)/115/,SPNERR(23)/103/,SPNERR(24)/33/,SPNERR(25)/0/
      DATA LINARA(2) /0/
      CALL PTMLIN(STR, 2)
      IF (.NOT.(GMSGNO(I) .EQ. -3))GOTO 23036
      DOFORW = -3
      GOTO 23037
23036 CONTINUE
      LINARA(1) = I
      CALL SCRATF(FWD, FILE)
      INT = CREATE(FILE, 2)
      IF (.NOT.(INT .NE. -3))GOTO 23038
      CALL PTMLIN(START, INT)
      CALL PUTMF(NULL, LINARA, INT, -1)
      CALL PTMLIN(STOP, INT)
      CALL CLOSE(INT)
      I = 1
      CALL STCOPY(SNDMSG, 1, BUF, I)
      CALL STCOPY(MINUSM, 1, BUF, I)
      CALL SCOPY(FILE, 1, BUF, I)
      IF (.NOT.(SPWNIT(BUF) .EQ. -3))GOTO 23040
      CALL PTMLIN(SPNERR, 2)
23040 CONTINUE
      CALL REMOVE(FILE)
      DOFORW = 0
      GOTO 23039
23038 CONTINUE
      DOFORW = -3
23039 CONTINUE
23037 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DOGOTO(X)
      LOGICAL*1 X
      INTEGER GMSGNO
      INTEGER N
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      LOGICAL*1 STR(6)
      DATA STR(1)/103/,STR(2)/111/,STR(3)/32/,STR(4)/116/,STR(5)/111/,ST
     *R(6)/0/
      CALL PTMLIN(STR, 2)
      IF (.NOT.(GMSGNO(N) .EQ. -3))GOTO 23042
      DOGOTO = -3
      GOTO 23043
23042 CONTINUE
      CURMSG = N
      CALL ONEMSG(CURMSG)
      DOGOTO = 0
23043 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DOHEAD(LINARA)
      INTEGER LINARA(50)
      INTEGER MSGSEQ
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      LOGICAL*1 STR(8)
      DATA STR(1)/104/,STR(2)/101/,STR(3)/97/,STR(4)/100/,STR(5)/101/,ST
     *R(6)/114/,STR(7)/115/,STR(8)/0/
      CALL PTMLIN(STR, 2)
      IF (.NOT.(MSGSEQ(LINARA) .EQ. -3))GOTO 23044
      DOHEAD = -3
      GOTO 23045
23044 CONTINUE
      CALL HEADMF(10, LINARA, 2, PAGESZ)
      DOHEAD = 0
23045 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DOHELP(X)
      INTEGER*4 HLPTMP(2)
      LOGICAL*1 X
      INTEGER MRKHLP, GTCONT, PTREQ
      INTEGER J, I
      COMMON / CMHELP / HLPINT, HLPPTR(30), HLPSCR(30)
      INTEGER HLPINT
      INTEGER*4 HLPPTR
      INTEGER*4 HLPSCR
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      EXTERNAL PTMLIN
      LOGICAL*1 HLPSTR(11)
      LOGICAL*1 SUMMAR(2)
      LOGICAL*1 ERRMSG(21)
      DATA HLPSTR(1)/63/,HLPSTR(2)/32/,HLPSTR(3)/77/,HLPSTR(4)/83/,HLPST
     *R(5)/71/,HLPSTR(6)/32/,HLPSTR(7)/72/,HLPSTR(8)/101/,HLPSTR(9)/108/
     *,HLPSTR(10)/112/,HLPSTR(11)/0/
      DATA SUMMAR(1)/37/,SUMMAR(2)/0/
      DATA ERRMSG(1)/32/,ERRMSG(2)/32/,ERRMSG(3)/78/,ERRMSG(4)/111/,ERRM
     *SG(5)/32/,ERRMSG(6)/104/,ERRMSG(7)/101/,ERRMSG(8)/108/,ERRMSG(9)/1
     *12/,ERRMSG(10)/32/,ERRMSG(11)/97/,ERRMSG(12)/118/,ERRMSG(13)/97/,E
     *RRMSG(14)/105/,ERRMSG(15)/108/,ERRMSG(16)/97/,ERRMSG(17)/98/,ERRMS
     *G(18)/108/,ERRMSG(19)/101/,ERRMSG(20)/46/,ERRMSG(21)/0/
      CALL PTMLIN(HLPSTR, 2)
      IF (.NOT.(MRKHLP(HLPINT, HLPPTR, SUMMAR, HLPSCR) .EQ. -3))GOTO 230
     *46
      CALL PTMLIN(ERRMSG, 2)
      DOHELP = -3
      GOTO 23047
23046 CONTINUE
      CALL PTRCPY(0, HLPTMP(2))
      CALL MPUTCH(10, 2)
      J = 0
      I=1
23048 IF (.NOT.(PTREQ (HLPSCR(I), 0) .EQ. 0))GOTO 23050
      IF (.NOT.(PAGESZ .GT. 0 .AND. J .GE. PAGESZ))GOTO 23051
      IF (.NOT.(GTCONT(0) .EQ. 0))GOTO 23053
      GOTO 23050
23053 CONTINUE
      J = 0
23054 CONTINUE
23051 CONTINUE
      CALL PTRCPY(HLPSCR(I), HLPTMP(1))
      CALL PUTHLP(HLPINT, HLPTMP, SUMMAR, 2, PTMLIN)
      J = J + 1
23049 I=I+1
      GOTO 23048
23050 CONTINUE
      DOHELP = 0
23047 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DOINFO(X)
      LOGICAL*1 X, C
      LOGICAL*1 CLOWER, GETCH
      INTEGER MRKHLP
      EXTERNAL PTMLIN
      COMMON / CMHELP / HLPINT, HLPPTR(30), HLPSCR(30)
      INTEGER HLPINT
      INTEGER*4 HLPPTR
      INTEGER*4 HLPSCR
      COMMON / MSGSCR / BUF(512), SCRFIL(40)
      LOGICAL*1 BUF
      LOGICAL*1 SCRFIL
      LOGICAL*1 STR(39)
      LOGICAL*1 NEWS(5)
      LOGICAL*1 INTR(5)
      LOGICAL*1 HELP(5)
      LOGICAL*1 ERRMSG(28)
      DATA STR(1)/105/,STR(2)/110/,STR(3)/102/,STR(4)/111/,STR(5)/114/,S
     *TR(6)/109/,STR(7)/97/,STR(8)/116/,STR(9)/105/,STR(10)/111/,STR(11)
     */110/,STR(12)/32/,STR(13)/45/,STR(14)/32/,STR(15)/116/,STR(16)/121
     */,STR(17)/112/,STR(18)/101/,STR(19)/32/,STR(20)/99/,STR(21)/111/,S
     *TR(22)/109/,STR(23)/109/,STR(24)/97/,STR(25)/110/,STR(26)/100/,STR
     *(27)/32/,STR(28)/99/,STR(29)/104/,STR(30)/97/,STR(31)/114/,STR(32)
     */97/,STR(33)/99/,STR(34)/116/,STR(35)/101/,STR(36)/114/,STR(37)/58
     */,STR(38)/32/,STR(39)/0/
      DATA NEWS(1)/110/,NEWS(2)/101/,NEWS(3)/119/,NEWS(4)/115/,NEWS(5)/0
     */
      DATA INTR(1)/105/,INTR(2)/110/,INTR(3)/116/,INTR(4)/114/,INTR(5)/0
     */
      DATA HELP(1)/104/,HELP(2)/101/,HELP(3)/108/,HELP(4)/112/,HELP(5)/0
     */
      DATA ERRMSG(1)/32/,ERRMSG(2)/32/,ERRMSG(3)/78/,ERRMSG(4)/111/,ERRM
     *SG(5)/32/,ERRMSG(6)/105/,ERRMSG(7)/110/,ERRMSG(8)/102/,ERRMSG(9)/1
     *11/,ERRMSG(10)/114/,ERRMSG(11)/109/,ERRMSG(12)/97/,ERRMSG(13)/116/
     *,ERRMSG(14)/105/,ERRMSG(15)/111/,ERRMSG(16)/110/,ERRMSG(17)/32/,ER
     *RMSG(18)/97/,ERRMSG(19)/118/,ERRMSG(20)/97/,ERRMSG(21)/105/,ERRMSG
     *(22)/108/,ERRMSG(23)/97/,ERRMSG(24)/98/,ERRMSG(25)/108/,ERRMSG(26)
     */101/,ERRMSG(27)/33/,ERRMSG(28)/0/
      CALL PTMLIN(STR, 2)
      C = CLOWER(GETCH(C,1))
      CALL MPUTCH(C, 2)
      CALL MPUTCH(10, 2)
      IF (.NOT.(C .EQ. 63))GOTO 23055
      CALL SCOPY(HELP, 1, SCRFIL, 1)
      GOTO 23056
23055 CONTINUE
      IF (.NOT.(C .EQ. 35))GOTO 23057
      CALL SCOPY(NEWS, 1, SCRFIL, 1)
      GOTO 23058
23057 CONTINUE
      IF (.NOT.(C .EQ. 37))GOTO 23059
      CALL SCOPY(INTR, 1, SCRFIL, 1)
      GOTO 23060
23059 CONTINUE
      SCRFIL(1) = C
      SCRFIL(2) = 0
23060 CONTINUE
23058 CONTINUE
23056 CONTINUE
      IF (.NOT.(MRKHLP(HLPINT, HLPPTR, SCRFIL, HLPSCR) .EQ. -3))GOTO 230
     *61
      CALL PTMLIN(ERRMSG, 2)
      DOINFO = -3
      GOTO 23062
23061 CONTINUE
      CALL PUTHLP(HLPINT, HLPSCR, SCRFIL, 2, PTMLIN)
      DOINFO = 0
23062 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DOINTR(X)
      LOGICAL*1 X
      INTEGER MRKHLP
      COMMON / CMHELP / HLPINT, HLPPTR(30), HLPSCR(30)
      INTEGER HLPINT
      INTEGER*4 HLPPTR
      INTEGER*4 HLPSCR
      EXTERNAL PTMLIN
      LOGICAL*1 INTSTR(22)
      LOGICAL*1 INTR(5)
      LOGICAL*1 ERRMSG(60)
      DATA INTSTR(1)/37/,INTSTR(2)/32/,INTSTR(3)/73/,INTSTR(4)/110/,INTS
     *TR(5)/116/,INTSTR(6)/114/,INTSTR(7)/111/,INTSTR(8)/100/,INTSTR(9)/
     *117/,INTSTR(10)/99/,INTSTR(11)/116/,INTSTR(12)/105/,INTSTR(13)/111
     */,INTSTR(14)/110/,INTSTR(15)/32/,INTSTR(16)/116/,INTSTR(17)/111/,I
     *NTSTR(18)/32/,INTSTR(19)/77/,INTSTR(20)/83/,INTSTR(21)/71/,INTSTR(
     *22)/0/
      DATA INTR(1)/105/,INTR(2)/110/,INTR(3)/116/,INTR(4)/114/,INTR(5)/0
     */
      DATA ERRMSG(1)/63/,ERRMSG(2)/32/,ERRMSG(3)/83/,ERRMSG(4)/111/,ERRM
     *SG(5)/114/,ERRMSG(6)/114/,ERRMSG(7)/121/,ERRMSG(8)/44/,ERRMSG(9)/3
     *2/,ERRMSG(10)/110/,ERRMSG(11)/111/,ERRMSG(12)/32/,ERRMSG(13)/105/,
     *ERRMSG(14)/110/,ERRMSG(15)/116/,ERRMSG(16)/114/,ERRMSG(17)/111/,ER
     *RMSG(18)/100/,ERRMSG(19)/117/,ERRMSG(20)/99/,ERRMSG(21)/116/,ERRMS
     *G(22)/105/,ERRMSG(23)/111/,ERRMSG(24)/110/,ERRMSG(25)/32/,ERRMSG(2
     *6)/97/,ERRMSG(27)/118/,ERRMSG(28)/97/,ERRMSG(29)/105/,ERRMSG(30)/1
     *08/,ERRMSG(31)/97/,ERRMSG(32)/98/,ERRMSG(33)/108/,ERRMSG(34)/101/,
     *ERRMSG(35)/59/,ERRMSG(36)/32/,ERRMSG(37)/99/,ERRMSG(38)/111/,ERRMS
     *G(39)/110/,ERRMSG(40)/115/,ERRMSG(41)/117/,ERRMSG(42)/108/,ERRMSG(
     *43)/116/,ERRMSG(44)/32/,ERRMSG(45)/116/,ERRMSG(46)/104/,ERRMSG(47)
     */101/,ERRMSG(48)/32/,ERRMSG(49)/77/,ERRMSG(50)/83/,ERRMSG(51)/71/,
     *ERRMSG(52)/32/,ERRMSG(53)/112/,ERRMSG(54)/114/,ERRMSG(55)/105/,ERR
     *MSG(56)/109/,ERRMSG(57)/101/,ERRMSG(58)/114/,ERRMSG(59)/46/,ERRMSG
     *(60)/0/
      CALL PTMLIN(INTSTR, 2)
      IF (.NOT.(MRKHLP(HLPINT, HLPPTR, INTR, HLPSCR) .EQ. -3))GOTO 23063
      CALL PTMLIN(ERRMSG, 2)
      DOINTR = -3
      GOTO 23064
23063 CONTINUE
      CALL MPUTCH(10, 2)
      CALL PUTHLP(HLPINT, HLPSCR, INTR, 2, PTMLIN)
      DOINTR = 0
23064 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DOJUMP(X)
      LOGICAL*1 X
      INTEGER GTCONF, SPWNIT
      INTEGER I
      COMMON / MSGSCR / BUF(512), SCRFIL(40)
      LOGICAL*1 BUF
      LOGICAL*1 SCRFIL
      LOGICAL*1 STR(16)
      LOGICAL*1 SH(3)
      LOGICAL*1 SPNERR(23)
      DATA STR(1)/106/,STR(2)/117/,STR(3)/109/,STR(4)/112/,STR(5)/32/,ST
     *R(6)/105/,STR(7)/110/,STR(8)/116/,STR(9)/111/,STR(10)/32/,STR(11)/
     *115/,STR(12)/104/,STR(13)/101/,STR(14)/108/,STR(15)/108/,STR(16)/0
     */
      DATA SH(1)/115/,SH(2)/104/,SH(3)/0/
      DATA SPNERR(1)/32/,SPNERR(2)/69/,SPNERR(3)/114/,SPNERR(4)/114/,SPN
     *ERR(5)/111/,SPNERR(6)/114/,SPNERR(7)/32/,SPNERR(8)/115/,SPNERR(9)/
     *112/,SPNERR(10)/97/,SPNERR(11)/119/,SPNERR(12)/110/,SPNERR(13)/105
     */,SPNERR(14)/110/,SPNERR(15)/103/,SPNERR(16)/32/,SPNERR(17)/115/,S
     *PNERR(18)/104/,SPNERR(19)/101/,SPNERR(20)/108/,SPNERR(21)/108/,SPN
     *ERR(22)/33/,SPNERR(23)/0/
      CALL PTMLIN(STR, 2)
      IF (.NOT.(GTCONF(I) .EQ. 1))GOTO 23065
      CALL SCOPY(SH, 1, BUF, 1)
      IF (.NOT.(SPWNIT(BUF) .EQ. -3))GOTO 23067
      CALL PTMLIN(SPNERR, 2)
23067 CONTINUE
      DOJUMP = 0
      GOTO 23066
23065 CONTINUE
      DOJUMP = -3
23066 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DOLIST(LINARA)
      INTEGER LINARA(50), INT
      INTEGER MSGSEQ, GETMF, CREATE
      COMMON / MSGSCR / BUF(512), SCRFIL(40)
      LOGICAL*1 BUF
      LOGICAL*1 SCRFIL
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      COMMON / CHDRS / HSIZE(50), HADDR(50), RDATE(50), HDATE(12, 50), H
     *FROM(20, 50), HSUBJ(30, 50), HDELE(50)
      INTEGER HSIZE
      INTEGER*4 HADDR
      REAL RDATE
      LOGICAL*1 HDATE
      LOGICAL*1 HFROM
      LOGICAL*1 HSUBJ
      LOGICAL*1 HDELE
      LOGICAL*1 STR(5)
      LOGICAL*1 ONS(3)
      LOGICAL*1 LISPAT(33)
      LOGICAL*1 ERRMSG(25)
      DATA STR(1)/108/,STR(2)/105/,STR(3)/115/,STR(4)/116/,STR(5)/0/
      DATA ONS(1)/111/,ONS(2)/110/,ONS(3)/0/
      DATA LISPAT(1)/32/,LISPAT(2)/45/,LISPAT(3)/45/,LISPAT(4)/45/,LISPA
     *T(5)/32/,LISPAT(6)/109/,LISPAT(7)/101/,LISPAT(8)/115/,LISPAT(9)/11
     *5/,LISPAT(10)/97/,LISPAT(11)/103/,LISPAT(12)/101/,LISPAT(13)/32/,L
     *ISPAT(14)/35/,LISPAT(15)/44/,LISPAT(16)/32/,LISPAT(17)/42/,LISPAT(
     *18)/32/,LISPAT(19)/99/,LISPAT(20)/104/,LISPAT(21)/97/,LISPAT(22)/1
     *14/,LISPAT(23)/97/,LISPAT(24)/99/,LISPAT(25)/116/,LISPAT(26)/101/,
     *LISPAT(27)/114/,LISPAT(28)/115/,LISPAT(29)/32/,LISPAT(30)/45/,LISP
     *AT(31)/45/,LISPAT(32)/45/,LISPAT(33)/0/
      DATA ERRMSG(1)/32/,ERRMSG(2)/32/,ERRMSG(3)/69/,ERRMSG(4)/114/,ERRM
     *SG(5)/114/,ERRMSG(6)/111/,ERRMSG(7)/114/,ERRMSG(8)/32/,ERRMSG(9)/1
     *08/,ERRMSG(10)/105/,ERRMSG(11)/115/,ERRMSG(12)/116/,ERRMSG(13)/105
     */,ERRMSG(14)/110/,ERRMSG(15)/103/,ERRMSG(16)/32/,ERRMSG(17)/109/,E
     *RRMSG(18)/97/,ERRMSG(19)/105/,ERRMSG(20)/108/,ERRMSG(21)/32/,ERRMS
     *G(22)/111/,ERRMSG(23)/110/,ERRMSG(24)/32/,ERRMSG(25)/0/
      CALL PTMLIN(STR, 2)
      IF (.NOT.(MSGSEQ(LINARA) .EQ. -3))GOTO 23069
      DOLIST = -3
      GOTO 23070
23069 CONTINUE
      CALL MPUTCH(10, 2)
      CALL PTMLIN(ONS, 2)
      IF (.NOT.(GETMF(SCRFIL) .LE. 0))GOTO 23071
      DOLIST = -3
      GOTO 23072
23071 CONTINUE
      INT = CREATE(SCRFIL, 2)
      IF (.NOT.(INT .NE. -3))GOTO 23073
      CALL HEADMF(12, LINARA, INT, -1)
      LISPAT(1) = 12
      CALL PUTMF(LISPAT, LINARA, INT, -1)
      CALL CLOSE(INT)
      DOLIST = 0
      GOTO 23074
23073 CONTINUE
      DOLIST = -3
23074 CONTINUE
23072 CONTINUE
      IF (.NOT.(DOLIST .EQ. -3))GOTO 23075
      CALL PTMLIN(ERRMSG, 2)
      CALL PTMLIN(SCRFIL, 2)
23075 CONTINUE
23070 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DOMOVE(LINARA)
      INTEGER LINARA(50), INT
      INTEGER MSGSEQ, CREATE, GETMF
      COMMON / CHDRS / HSIZE(50), HADDR(50), RDATE(50), HDATE(12, 50), H
     *FROM(20, 50), HSUBJ(30, 50), HDELE(50)
      INTEGER HSIZE
      INTEGER*4 HADDR
      REAL RDATE
      LOGICAL*1 HDATE
      LOGICAL*1 HFROM
      LOGICAL*1 HSUBJ
      LOGICAL*1 HDELE
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      COMMON / MSGSCR / BUF(512), SCRFIL(40)
      LOGICAL*1 BUF
      LOGICAL*1 SCRFIL
      LOGICAL*1 STR(5)
      LOGICAL*1 INTOS(5)
      LOGICAL*1 ERRMSG(26)
      DATA STR(1)/109/,STR(2)/111/,STR(3)/118/,STR(4)/101/,STR(5)/0/
      DATA INTOS(1)/105/,INTOS(2)/110/,INTOS(3)/116/,INTOS(4)/111/,INTOS
     *(5)/0/
      DATA ERRMSG(1)/32/,ERRMSG(2)/32/,ERRMSG(3)/69/,ERRMSG(4)/114/,ERRM
     *SG(5)/114/,ERRMSG(6)/111/,ERRMSG(7)/114/,ERRMSG(8)/32/,ERRMSG(9)/1
     *09/,ERRMSG(10)/111/,ERRMSG(11)/118/,ERRMSG(12)/105/,ERRMSG(13)/110
     */,ERRMSG(14)/103/,ERRMSG(15)/32/,ERRMSG(16)/109/,ERRMSG(17)/97/,ER
     *RMSG(18)/105/,ERRMSG(19)/108/,ERRMSG(20)/32/,ERRMSG(21)/105/,ERRMS
     *G(22)/110/,ERRMSG(23)/116/,ERRMSG(24)/111/,ERRMSG(25)/32/,ERRMSG(2
     *6)/0/
      CALL PTMLIN(STR, 2)
      IF (.NOT.(MSGSEQ(LINARA) .EQ. -3))GOTO 23077
      DOMOVE = -3
      GOTO 23078
23077 CONTINUE
      CALL MPUTCH(10, 2)
      CALL PTMLIN(INTOS, 2)
      IF (.NOT.(GETMF(SCRFIL) .LE. 0))GOTO 23079
      DOMOVE = -3
      GOTO 23080
23079 CONTINUE
      INT = CREATE(SCRFIL, 4)
      IF (.NOT.(INT .NE. -3))GOTO 23081
      CALL PUTMF(HDRPAT, LINARA, INT, -1)
      CALL CLOSE(INT)
      CALL DELEMF(LINARA)
      DOMOVE = 0
      GOTO 23082
23081 CONTINUE
      DOMOVE = -3
23082 CONTINUE
23080 CONTINUE
      IF (.NOT.(DOMOVE .EQ. -3))GOTO 23083
      CALL PTMLIN(ERRMSG, 2)
      CALL PTMLIN(SCRFIL, 2)
23083 CONTINUE
23078 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DONEWS(X)
      LOGICAL*1 X
      INTEGER MRKHLP
      COMMON / CMHELP / HLPINT, HLPPTR(30), HLPSCR(30)
      INTEGER HLPINT
      INTEGER*4 HLPPTR
      INTEGER*4 HLPSCR
      EXTERNAL PTMLIN
      LOGICAL*1 NWSSTR(11)
      LOGICAL*1 NEWS(5)
      LOGICAL*1 ERRMSG(21)
      DATA NWSSTR(1)/35/,NWSSTR(2)/32/,NWSSTR(3)/77/,NWSSTR(4)/83/,NWSST
     *R(5)/71/,NWSSTR(6)/32/,NWSSTR(7)/78/,NWSSTR(8)/101/,NWSSTR(9)/119/
     *,NWSSTR(10)/115/,NWSSTR(11)/0/
      DATA NEWS(1)/110/,NEWS(2)/101/,NEWS(3)/119/,NEWS(4)/115/,NEWS(5)/0
     */
      DATA ERRMSG(1)/32/,ERRMSG(2)/32/,ERRMSG(3)/78/,ERRMSG(4)/111/,ERRM
     *SG(5)/32/,ERRMSG(6)/110/,ERRMSG(7)/101/,ERRMSG(8)/119/,ERRMSG(9)/1
     *15/,ERRMSG(10)/32/,ERRMSG(11)/97/,ERRMSG(12)/118/,ERRMSG(13)/97/,E
     *RRMSG(14)/105/,ERRMSG(15)/108/,ERRMSG(16)/97/,ERRMSG(17)/98/,ERRMS
     *G(18)/108/,ERRMSG(19)/101/,ERRMSG(20)/46/,ERRMSG(21)/0/
      CALL PTMLIN(NWSSTR, 2)
      IF (.NOT.(MRKHLP(HLPINT, HLPPTR, NEWS, HLPSCR) .EQ. -3))GOTO 23085
      CALL PTMLIN(ERRMSG, 2)
      DONEWS = -3
      GOTO 23086
23085 CONTINUE
      CALL MPUTCH(10, 2)
      CALL PUTHLP(HLPINT, HLPSCR, NEWS, 2, PTMLIN)
      DONEWS = 0
23086 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DONEXT(LINARA)
      INTEGER LINARA(50)
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      LOGICAL*1 STR(17)
      LOGICAL*1 ERRMSG(19)
      DATA STR(1)/110/,STR(2)/101/,STR(3)/120/,STR(4)/116/,STR(5)/32/,ST
     *R(6)/109/,STR(7)/101/,STR(8)/115/,STR(9)/115/,STR(10)/97/,STR(11)/
     *103/,STR(12)/101/,STR(13)/32/,STR(14)/105/,STR(15)/115/,STR(16)/58
     */,STR(17)/0/
      DATA ERRMSG(1)/32/,ERRMSG(2)/110/,ERRMSG(3)/111/,ERRMSG(4)/32/,ERR
     *MSG(5)/109/,ERRMSG(6)/111/,ERRMSG(7)/114/,ERRMSG(8)/101/,ERRMSG(9)
     */32/,ERRMSG(10)/109/,ERRMSG(11)/101/,ERRMSG(12)/115/,ERRMSG(13)/11
     *5/,ERRMSG(14)/97/,ERRMSG(15)/103/,ERRMSG(16)/101/,ERRMSG(17)/115/,
     *ERRMSG(18)/33/,ERRMSG(19)/0/
      CALL PTMLIN(STR, 2)
      IF (.NOT.(CURMSG .LT. NMSGS))GOTO 23087
      CURMSG = CURMSG + 1
      CALL ONEMSG(CURMSG)
      DONEXT = 0
      GOTO 23088
23087 CONTINUE
      CALL PTMLIN(ERRMSG, 2)
      DONEXT = -3
23088 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DOOVER(LINARA)
      INTEGER LINARA(100), STATUS
      INTEGER SAVEMF, READMF, GTCONF
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      LOGICAL*1 STR(14)
      LOGICAL*1 ERRMSG(26)
      DATA STR(1)/111/,STR(2)/118/,STR(3)/101/,STR(4)/114/,STR(5)/119/,S
     *TR(6)/114/,STR(7)/105/,STR(8)/116/,STR(9)/101/,STR(10)/32/,STR(11)
     */111/,STR(12)/108/,STR(13)/100/,STR(14)/0/
      DATA ERRMSG(1)/32/,ERRMSG(2)/32/,ERRMSG(3)/69/,ERRMSG(4)/114/,ERRM
     *SG(5)/114/,ERRMSG(6)/111/,ERRMSG(7)/114/,ERRMSG(8)/32/,ERRMSG(9)/1
     *11/,ERRMSG(10)/118/,ERRMSG(11)/101/,ERRMSG(12)/114/,ERRMSG(13)/119
     */,ERRMSG(14)/114/,ERRMSG(15)/105/,ERRMSG(16)/116/,ERRMSG(17)/105/,
     *ERRMSG(18)/110/,ERRMSG(19)/103/,ERRMSG(20)/32/,ERRMSG(21)/102/,ERR
     *MSG(22)/105/,ERRMSG(23)/108/,ERRMSG(24)/101/,ERRMSG(25)/33/,ERRMSG
     *(26)/0/
      CALL PTMLIN(STR, 2)
      CALL CURFIL(2)
      IF (.NOT.(GTCONF(STATUS) .EQ. 0))GOTO 23089
      DOOVER = -3
      GOTO 23090
23089 CONTINUE
      IF (.NOT.(SAVEMF(LINARA) .EQ. -3))GOTO 23091
      DOOVER = -3
      GOTO 23092
23091 CONTINUE
      IF (.NOT.(READMF(FILE, 0, 1, LINARA) .EQ. -3))GOTO 23093
      DOOVER = -3
      GOTO 23094
23093 CONTINUE
      DOOVER = 0
23094 CONTINUE
23092 CONTINUE
23090 CONTINUE
      IF (.NOT.(DOOVER .EQ. -3))GOTO 23095
      CALL PTMLIN(ERRMSG, 2)
23095 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DOPUT(LINARA)
      INTEGER LINARA(50), INT
      INTEGER MSGSEQ, CREATE, GETMF
      COMMON / CHDRS / HSIZE(50), HADDR(50), RDATE(50), HDATE(12, 50), H
     *FROM(20, 50), HSUBJ(30, 50), HDELE(50)
      INTEGER HSIZE
      INTEGER*4 HADDR
      REAL RDATE
      LOGICAL*1 HDATE
      LOGICAL*1 HFROM
      LOGICAL*1 HSUBJ
      LOGICAL*1 HDELE
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      COMMON / MSGSCR / BUF(512), SCRFIL(40)
      LOGICAL*1 BUF
      LOGICAL*1 SCRFIL
      LOGICAL*1 STR(4)
      LOGICAL*1 INTOS(5)
      LOGICAL*1 ERRMSG(27)
      DATA STR(1)/112/,STR(2)/117/,STR(3)/116/,STR(4)/0/
      DATA INTOS(1)/105/,INTOS(2)/110/,INTOS(3)/116/,INTOS(4)/111/,INTOS
     *(5)/0/
      DATA ERRMSG(1)/32/,ERRMSG(2)/32/,ERRMSG(3)/69/,ERRMSG(4)/114/,ERRM
     *SG(5)/114/,ERRMSG(6)/111/,ERRMSG(7)/114/,ERRMSG(8)/32/,ERRMSG(9)/1
     *12/,ERRMSG(10)/117/,ERRMSG(11)/116/,ERRMSG(12)/116/,ERRMSG(13)/105
     */,ERRMSG(14)/110/,ERRMSG(15)/103/,ERRMSG(16)/32/,ERRMSG(17)/109/,E
     *RRMSG(18)/97/,ERRMSG(19)/105/,ERRMSG(20)/108/,ERRMSG(21)/32/,ERRMS
     *G(22)/105/,ERRMSG(23)/110/,ERRMSG(24)/116/,ERRMSG(25)/111/,ERRMSG(
     *26)/32/,ERRMSG(27)/0/
      CALL PTMLIN(STR, 2)
      IF (.NOT.(MSGSEQ(LINARA) .EQ. -3))GOTO 23097
      DOPUT = -3
      GOTO 23098
23097 CONTINUE
      CALL MPUTCH(10, 2)
      CALL PTMLIN(INTOS, 2)
      IF (.NOT.(GETMF(SCRFIL) .LE. 0))GOTO 23099
      DOPUT = -3
      GOTO 23100
23099 CONTINUE
      INT = CREATE(SCRFIL, 4)
      IF (.NOT.(INT .NE. -3))GOTO 23101
      CALL PUTMF(HDRPAT, LINARA, INT, -1)
      CALL CLOSE(INT)
      DOPUT = 0
      GOTO 23102
23101 CONTINUE
      DOPUT = -3
23102 CONTINUE
23100 CONTINUE
      IF (.NOT.(DOPUT .EQ. -3))GOTO 23103
      CALL PTMLIN(ERRMSG, 2)
      CALL PTMLIN(SCRFIL, 2)
23103 CONTINUE
23098 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DOQUIT(X)
      LOGICAL*1 X
      INTEGER GTCONF
      INTEGER STATUS
      LOGICAL*1 STR(5)
      DATA STR(1)/113/,STR(2)/117/,STR(3)/105/,STR(4)/116/,STR(5)/0/
      CALL PTMLIN(STR, 2)
      IF (.NOT.(GTCONF(STATUS) .EQ. 1))GOTO 23105
      DOQUIT = -1
      GOTO 23106
23105 CONTINUE
      DOQUIT = -3
23106 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DOREAD(LINARA)
      INTEGER LINARA(50)
      INTEGER READMF, GETMF
      COMMON / MSGSCR / BUF(512), SCRFIL(40)
      LOGICAL*1 BUF
      LOGICAL*1 SCRFIL
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      LOGICAL*1 STR(5)
      DATA STR(1)/114/,STR(2)/101/,STR(3)/97/,STR(4)/100/,STR(5)/0/
      CALL PTMLIN(STR, 2)
      IF (.NOT.(GETMF(SCRFIL) .LE. 0))GOTO 23107
      DOREAD = -3
      GOTO 23108
23107 CONTINUE
      IF (.NOT.(READMF(SCRFIL, 1, 1, LINARA) .EQ. -3))GOTO 23109
      DOREAD = -3
      GOTO 23110
23109 CONTINUE
      DEFALT = 0
      DOREAD = 0
23110 CONTINUE
23108 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DOSEQU(X)
      LOGICAL*1 X
      INTEGER MRKHLP
      COMMON / CMHELP / HLPINT, HLPPTR(30), HLPSCR(30)
      INTEGER HLPINT
      INTEGER*4 HLPPTR
      INTEGER*4 HLPSCR
      EXTERNAL PTMLIN
      LOGICAL*1 INTSTR(31)
      LOGICAL*1 SEQU(5)
      LOGICAL*1 ERRMSG(52)
      DATA INTSTR(1)/63/,INTSTR(2)/32/,INTSTR(3)/109/,INTSTR(4)/97/,INTS
     *TR(5)/121/,INTSTR(6)/32/,INTSTR(7)/98/,INTSTR(8)/101/,INTSTR(9)/32
     */,INTSTR(10)/97/,INTSTR(11)/110/,INTSTR(12)/121/,INTSTR(13)/32/,IN
     *TSTR(14)/111/,INTSTR(15)/102/,INTSTR(16)/32/,INTSTR(17)/116/,INTST
     *R(18)/104/,INTSTR(19)/101/,INTSTR(20)/32/,INTSTR(21)/102/,INTSTR(2
     *2)/111/,INTSTR(23)/108/,INTSTR(24)/108/,INTSTR(25)/111/,INTSTR(26)
     */119/,INTSTR(27)/105/,INTSTR(28)/110/,INTSTR(29)/103/,INTSTR(30)/5
     *8/,INTSTR(31)/0/
      DATA SEQU(1)/115/,SEQU(2)/101/,SEQU(3)/113/,SEQU(4)/117/,SEQU(5)/0
     */
      DATA ERRMSG(1)/63/,ERRMSG(2)/32/,ERRMSG(3)/83/,ERRMSG(4)/111/,ERRM
     *SG(5)/114/,ERRMSG(6)/114/,ERRMSG(7)/121/,ERRMSG(8)/44/,ERRMSG(9)/3
     *2/,ERRMSG(10)/110/,ERRMSG(11)/111/,ERRMSG(12)/32/,ERRMSG(13)/104/,
     *ERRMSG(14)/101/,ERRMSG(15)/108/,ERRMSG(16)/112/,ERRMSG(17)/32/,ERR
     *MSG(18)/97/,ERRMSG(19)/118/,ERRMSG(20)/97/,ERRMSG(21)/105/,ERRMSG(
     *22)/108/,ERRMSG(23)/97/,ERRMSG(24)/98/,ERRMSG(25)/108/,ERRMSG(26)/
     *101/,ERRMSG(27)/59/,ERRMSG(28)/32/,ERRMSG(29)/99/,ERRMSG(30)/111/,
     *ERRMSG(31)/110/,ERRMSG(32)/115/,ERRMSG(33)/117/,ERRMSG(34)/108/,ER
     *RMSG(35)/116/,ERRMSG(36)/32/,ERRMSG(37)/116/,ERRMSG(38)/104/,ERRMS
     *G(39)/101/,ERRMSG(40)/32/,ERRMSG(41)/77/,ERRMSG(42)/83/,ERRMSG(43)
     */71/,ERRMSG(44)/32/,ERRMSG(45)/112/,ERRMSG(46)/114/,ERRMSG(47)/105
     */,ERRMSG(48)/109/,ERRMSG(49)/101/,ERRMSG(50)/114/,ERRMSG(51)/46/,E
     *RRMSG(52)/0/
      CALL PTMLIN(INTSTR, 2)
      IF (.NOT.(MRKHLP(HLPINT, HLPPTR, SEQU, HLPSCR) .EQ. -3))GOTO 23111
      CALL PTMLIN(ERRMSG, 2)
      DOSEQU = -3
      GOTO 23112
23111 CONTINUE
      CALL MPUTCH(10, 2)
      CALL PUTHLP(HLPINT, HLPSCR, SEQU, 2, PTMLIN)
      DOSEQU = 0
23112 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DOSNDM(X)
      LOGICAL*1 X
      INTEGER GTCONF, SPWNIT
      INTEGER I
      COMMON / MSGSCR / BUF(512), SCRFIL(40)
      LOGICAL*1 BUF
      LOGICAL*1 SCRFIL
      LOGICAL*1 STR(7)
      LOGICAL*1 SPNERR(24)
      DATA STR(1)/115/,STR(2)/110/,STR(3)/100/,STR(4)/109/,STR(5)/115/,S
     *TR(6)/103/,STR(7)/0/
      DATA SPNERR(1)/32/,SPNERR(2)/69/,SPNERR(3)/114/,SPNERR(4)/114/,SPN
     *ERR(5)/111/,SPNERR(6)/114/,SPNERR(7)/32/,SPNERR(8)/115/,SPNERR(9)/
     *112/,SPNERR(10)/97/,SPNERR(11)/119/,SPNERR(12)/110/,SPNERR(13)/105
     */,SPNERR(14)/110/,SPNERR(15)/103/,SPNERR(16)/32/,SPNERR(17)/115/,S
     *PNERR(18)/110/,SPNERR(19)/100/,SPNERR(20)/109/,SPNERR(21)/115/,SPN
     *ERR(22)/103/,SPNERR(23)/33/,SPNERR(24)/0/
      CALL PTMLIN(STR, 2)
      IF (.NOT.(GTCONF(I) .EQ. 1))GOTO 23113
      CALL SCOPY(STR, 1, BUF, 1)
      IF (.NOT.(SPWNIT(BUF) .EQ. -3))GOTO 23115
      CALL PTMLIN(SPNERR, 2)
23115 CONTINUE
      DOSNDM = 0
      GOTO 23114
23113 CONTINUE
      DOSNDM = -3
23114 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DOTYPE(LINARA)
      INTEGER LINARA(50), I
      INTEGER MSGSEQ
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      LOGICAL*1 STR(5)
      LOGICAL*1 TYPHDR(27)
      DATA STR(1)/116/,STR(2)/121/,STR(3)/112/,STR(4)/101/,STR(5)/0/
      DATA TYPHDR(1)/32/,TYPHDR(2)/40/,TYPHDR(3)/109/,TYPHDR(4)/101/,TYP
     *HDR(5)/115/,TYPHDR(6)/115/,TYPHDR(7)/97/,TYPHDR(8)/103/,TYPHDR(9)/
     *101/,TYPHDR(10)/32/,TYPHDR(11)/35/,TYPHDR(12)/44/,TYPHDR(13)/32/,T
     *YPHDR(14)/42/,TYPHDR(15)/32/,TYPHDR(16)/99/,TYPHDR(17)/104/,TYPHDR
     *(18)/97/,TYPHDR(19)/114/,TYPHDR(20)/97/,TYPHDR(21)/99/,TYPHDR(22)/
     *116/,TYPHDR(23)/101/,TYPHDR(24)/114/,TYPHDR(25)/115/,TYPHDR(26)/41
     */,TYPHDR(27)/0/
      CALL PTMLIN(STR, 2)
      IF (.NOT.(MSGSEQ(LINARA) .EQ. -3))GOTO 23117
      DOTYPE = -3
      GOTO 23118
23117 CONTINUE
      CALL MPUTCH(10, 2)
      TYPHDR(1) = 10
      CALL PUTMF(TYPHDR, LINARA, 2, PAGESZ)
      DOTYPE = 0
      I=1
23119 IF (.NOT.(LINARA(I) .NE. 0))GOTO 23121
23120 I=I+1
      GOTO 23119
23121 CONTINUE
      CURMSG = LINARA(I-1)
23118 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DOUNDE(LINARA)
      INTEGER LINARA(50), I
      INTEGER MSGSEQ
      COMMON / CHDRS / HSIZE(50), HADDR(50), RDATE(50), HDATE(12, 50), H
     *FROM(20, 50), HSUBJ(30, 50), HDELE(50)
      INTEGER HSIZE
      INTEGER*4 HADDR
      REAL RDATE
      LOGICAL*1 HDATE
      LOGICAL*1 HFROM
      LOGICAL*1 HSUBJ
      LOGICAL*1 HDELE
      LOGICAL*1 STR(9)
      DATA STR(1)/117/,STR(2)/110/,STR(3)/100/,STR(4)/101/,STR(5)/108/,S
     *TR(6)/101/,STR(7)/116/,STR(8)/101/,STR(9)/0/
      CALL PTMLIN(STR, 2)
      IF (.NOT.(MSGSEQ(LINARA) .EQ. -3))GOTO 23122
      DOUNDE = -3
      GOTO 23123
23122 CONTINUE
      I=1
23124 IF (.NOT.(I .LT. 50 .AND. LINARA(I) .NE. 0))GOTO 23126
      J = LINARA(I)
      HDELE(J) = 0
23125 I=I+1
      GOTO 23124
23126 CONTINUE
      DOUNDE = 0
23123 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DOWRIT(X)
      LOGICAL*1 X
      LOGICAL*1 STR(6)
      DATA STR(1)/119/,STR(2)/114/,STR(3)/105/,STR(4)/116/,STR(5)/101/,S
     *TR(6)/0/
      CALL PTMLIN(STR, 2)
      CALL NOTIMP
      DOWRIT = -3
      RETURN
      END
      SUBROUTINE GETFLD(BUF, I, LIMIT, ARRAY)
      LOGICAL*1 BUF(100), ARRAY(100)
      INTEGER I, LIMIT, J, K
      J = I
      CALL SKIPBL(BUF, J)
      K=1
23127 IF (.NOT.(BUF(J) .NE. 10 .AND. BUF(J) .NE. 0 .AND. K .LT. LIMIT))G
     *OTO 23129
      ARRAY(K) = BUF(J)
      J = J + 1
23128 K=K+1
      GOTO 23127
23129 CONTINUE
      ARRAY(K) = 0
      RETURN
      END
      INTEGER FUNCTION GETMF(FILE)
      LOGICAL*1 FILE(100), TRMARA(4)
      LOGICAL*1 GETRLN
      INTEGER LENGTH
      INTEGER I
      LOGICAL*1 STR(13)
      DATA STR(1)/32/,STR(2)/102/,STR(3)/105/,STR(4)/108/,STR(5)/101/,ST
     *R(6)/32/,STR(7)/110/,STR(8)/97/,STR(9)/109/,STR(10)/101/,STR(11)/5
     *8/,STR(12)/32/,STR(13)/0/
      DATA TRMARA/13, 10, 27, 0/
      CALL PTMLIN(STR, 2)
      IF (.NOT.(GETRLN(FILE, 1, 1, 2, TRMARA) .EQ. 27))GOTO 23130
      FILE(1) = 0
23130 CONTINUE
      CALL MPUTCH(32, 2)
      I = 1
      CALL SKIPBL(FILE, I)
      CALL SCOPY(FILE, I, FILE, 1)
      GETMF = LENGTH(FILE)
      RETURN
      END
      LOGICAL*1 FUNCTION GETRLN(BUF, START, IN, OUT, TRMARA)
      INTEGER IN, OUT, I, START
      INTEGER INDEX
      LOGICAL*1 BUF(100), TRMARA(100), C, BSBLBS(4), NOTSTR(5)
      LOGICAL*1 GETCH
      DATA BSBLBS/8, 32, 8, 0/
      DATA NOTSTR/94, 82, 13, 10, 0/
      I = START
23132 CONTINUE
      C = GETCH(C, IN)
      IF (.NOT.(INDEX(TRMARA, C) .GT. 0))GOTO 23135
      GOTO 23134
23135 CONTINUE
      IF (.NOT.(C .EQ. 8 .OR. C .EQ. 127))GOTO 23137
      IF (.NOT.(I .GT. START))GOTO 23139
      CALL PUTLIN(BSBLBS, OUT)
      I = I - 1
      GOTO 23140
23139 CONTINUE
      C = 127
      GOTO 23134
23140 CONTINUE
      GOTO 23138
23137 CONTINUE
      IF (.NOT.(C .EQ. 21))GOTO 23141
23143 IF (.NOT.(I .GT. START))GOTO 23145
      CALL PUTLIN(BSBLBS, OUT)
23144 I = I - 1
      GOTO 23143
23145 CONTINUE
      GOTO 23142
23141 CONTINUE
      IF (.NOT.(C .EQ. 18 .AND. I .GT. START))GOTO 23146
      CALL PUTLIN(NOTSTR, OUT)
      BUF(I) = 0
      CALL PUTLIN(BUF, OUT)
      GOTO 23147
23146 CONTINUE
      BUF(I) = C
      I = I + 1
      CALL PUTCH(C, OUT)
23147 CONTINUE
23142 CONTINUE
23138 CONTINUE
23133 GOTO 23132
23134 CONTINUE
      BUF(I) = 0
      GETRLN = C
      RETURN
      END
      INTEGER FUNCTION GMSGNO(N)
      INTEGER N, I
      INTEGER CTOI
      LOGICAL*1 C, TRMARA(3)
      LOGICAL*1 CLOWER, GETCH, TYPE, GETRLN
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      COMMON / MSGSCR / BUF(512), SCRFIL(40)
      LOGICAL*1 BUF
      LOGICAL*1 SCRFIL
      LOGICAL*1 STR(18)
      LOGICAL*1 FIRST(6)
      LOGICAL*1 LAST(5)
      LOGICAL*1 CURRNT(8)
      LOGICAL*1 ERRMSG(26)
      DATA STR(1)/32/,STR(2)/109/,STR(3)/101/,STR(4)/115/,STR(5)/115/,ST
     *R(6)/97/,STR(7)/103/,STR(8)/101/,STR(9)/32/,STR(10)/110/,STR(11)/1
     *17/,STR(12)/109/,STR(13)/98/,STR(14)/101/,STR(15)/114/,STR(16)/58/
     *,STR(17)/32/,STR(18)/0/
      DATA FIRST(1)/102/,FIRST(2)/105/,FIRST(3)/114/,FIRST(4)/115/,FIRST
     *(5)/116/,FIRST(6)/0/
      DATA LAST(1)/108/,LAST(2)/97/,LAST(3)/115/,LAST(4)/116/,LAST(5)/0/
      DATA CURRNT(1)/99/,CURRNT(2)/117/,CURRNT(3)/114/,CURRNT(4)/114/,CU
     *RRNT(5)/101/,CURRNT(6)/110/,CURRNT(7)/116/,CURRNT(8)/0/
      DATA ERRMSG(1)/32/,ERRMSG(2)/32/,ERRMSG(3)/105/,ERRMSG(4)/110/,ERR
     *MSG(5)/118/,ERRMSG(6)/97/,ERRMSG(7)/108/,ERRMSG(8)/105/,ERRMSG(9)/
     *100/,ERRMSG(10)/32/,ERRMSG(11)/109/,ERRMSG(12)/101/,ERRMSG(13)/115
     */,ERRMSG(14)/115/,ERRMSG(15)/97/,ERRMSG(16)/103/,ERRMSG(17)/101/,E
     *RRMSG(18)/32/,ERRMSG(19)/110/,ERRMSG(20)/117/,ERRMSG(21)/109/,ERRM
     *SG(22)/98/,ERRMSG(23)/101/,ERRMSG(24)/114/,ERRMSG(25)/33/,ERRMSG(2
     *6)/0/
      DATA TRMARA /13, 10, 0/
      CALL PTMLIN(STR, 2)
      C = CLOWER(GETCH(C, 1))
      IF (.NOT.(C .EQ. 102))GOTO 23148
      CALL PTMLIN(FIRST, 2)
      N = 1
      GOTO 23149
23148 CONTINUE
      IF (.NOT.(C .EQ. 108))GOTO 23150
      CALL PTMLIN(LAST, 2)
      N = NMSGS
      GOTO 23151
23150 CONTINUE
      IF (.NOT.(C .EQ. 13 .OR. C .EQ. 10))GOTO 23152
      CALL PTMLIN(CURRNT, 2)
      N = CURMSG
      GOTO 23153
23152 CONTINUE
      IF (.NOT.(TYPE(C) .EQ. 2))GOTO 23154
      SCRFIL(1) = C
      CALL MPUTCH(C, 2)
      C = GETRLN(SCRFIL, 2, 1, 2, TRMARA)
      I = 1
      N = CTOI(SCRFIL, I)
      IF (.NOT.(N .LE. 0 .OR. N .GT. NMSGS))GOTO 23156
      CALL PTMLIN(ERRMSG, 2)
      N = -3
23156 CONTINUE
      GOTO 23155
23154 CONTINUE
      IF (.NOT.(C .EQ. 27))GOTO 23158
      N = -3
      GOTO 23159
23158 CONTINUE
      CALL MPUTCH(C, 2)
      CALL PTMLIN(ERRMSG, 2)
      N = -3
23159 CONTINUE
23155 CONTINUE
23153 CONTINUE
23151 CONTINUE
23149 CONTINUE
      GMSGNO = N
      RETURN
      END
      INTEGER FUNCTION GSEQNO(C, LINARA)
      LOGICAL*1 C, TEXT(75), TRMN8R, TRMARA(5), SEPR8R(3), SKPSTR(8), BS
     *BLBS(4)
      LOGICAL*1 GETRLN, GETCH
      INTEGER I, J, LINARA(50), START, STOP, DIF, K, STATUS, CTR
      INTEGER CTOI, INDEX, TYPE
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      LOGICAL*1 CTRXST(3)
      DATA CTRXST(1)/94/,CTRXST(2)/88/,CTRXST(3)/0/
      DATA TRMARA/13, 10, 24, 44, 0/
      DATA SEPR8R/58, 45, 0/
      DATA SKPSTR/13, 10, 32, 9, 44, 8, 127, 0/
      DATA BSBLBS/8, 32, 8, 0/
      J = 1
      STATUS = 0
23160 CONTINUE
      TEXT(1) = C
      CALL MPUTCH(C, 2)
      TRMN8R = GETRLN(TEXT, 2, 1, 2, TRMARA)
      IF (.NOT.(TRMN8R .EQ. 127))GOTO 23163
      CALL PTMLIN(BSBLBS, 2)
23163 CONTINUE
23165 IF (.NOT.(TRMN8R .EQ. 127))GOTO 23166
      TRMN8R = GETRLN(TEXT, 1, 1, 2, TRMARA)
      GOTO 23165
23166 CONTINUE
      IF (.NOT.(TRMN8R .EQ. 44))GOTO 23167
      CALL MPUTCH(44, 2)
      GOTO 23168
23167 CONTINUE
      IF (.NOT.(TRMN8R .EQ. 24))GOTO 23169
      CALL PTMLIN(CTRXST, 2)
      STATUS = -3
      GOTO 23162
23169 CONTINUE
23168 CONTINUE
      I = 1
      START = CTOI(TEXT, I)
      IF (.NOT.(START .LE. 0 .OR. START .GT. NMSGS))GOTO 23171
      STATUS = -3
      GOTO 23162
23171 CONTINUE
      CALL SKIPBL(TEXT, I)
      IF (.NOT.(TEXT(I) .EQ. 0))GOTO 23173
      LINARA(J) = START
      J = J + 1
      GOTO 23174
23173 CONTINUE
      IF (.NOT.(INDEX(SEPR8R, TEXT(I)) .GT. 0))GOTO 23175
      I = I + 1
      STOP = CTOI(TEXT, I)
      IF (.NOT.(STOP .LE. 0 .OR. STOP .GT. NMSGS))GOTO 23177
      STATUS = -3
      GOTO 23162
23177 CONTINUE
      IF (.NOT.(STOP .GE. START))GOTO 23179
      DIF = 1
      GOTO 23180
23179 CONTINUE
      DIF = -1
23180 CONTINUE
      STOP = STOP + DIF
      K=START
23181 IF (.NOT.(K .NE. STOP))GOTO 23183
      LINARA(J) = K
      J = J + 1
23182 K=K+DIF
      GOTO 23181
23183 CONTINUE
      GOTO 23176
23175 CONTINUE
      STATUS = -3
      GOTO 23162
23176 CONTINUE
23174 CONTINUE
      IF (.NOT.(TRMN8R .EQ. 44))GOTO 23184
      CTR = 1
      C=GETCH(C,1)
23186 IF (.NOT.(INDEX(SKPSTR,C) .GT. 0))GOTO 23188
      IF (.NOT.(C .EQ. 8 .OR. C .EQ. 127))GOTO 23189
      IF (.NOT.(CTR .GT. 1))GOTO 23191
      CALL PTMLIN(BSBLBS, 2)
      CTR = CTR - 1
23191 CONTINUE
      GOTO 23190
23189 CONTINUE
      CALL MPUTCH(C, 2)
      IF (.NOT.(C .EQ. 13 .OR. C .EQ. 10))GOTO 23193
      CTR = 1
      GOTO 23194
23193 CONTINUE
      CTR = CTR + 1
23194 CONTINUE
23190 CONTINUE
23187 C=GETCH(C,1)
      GOTO 23186
23188 CONTINUE
23184 CONTINUE
      IF (.NOT.(TYPE(C) .NE. 2))GOTO 23195
      STATUS = -3
      GOTO 23162
23195 CONTINUE
23161 IF (.NOT.(TRMN8R .NE. 44))GOTO 23160
23162 CONTINUE
      IF (.NOT.(STATUS .EQ. -3))GOTO 23197
      J = 1
23197 CONTINUE
      LINARA(J) = 0
      GSEQNO = STATUS
      RETURN
      END
      INTEGER FUNCTION GTCONF(STATUS)
      INTEGER STATUS
      LOGICAL*1 C
      LOGICAL*1 CLOWER, GETCH
      LOGICAL*1 CONFST(26)
      DATA CONFST(1)/32/,CONFST(2)/91/,CONFST(3)/116/,CONFST(4)/121/,CON
     *FST(5)/112/,CONFST(6)/101/,CONFST(7)/32/,CONFST(8)/83/,CONFST(9)/8
     *0/,CONFST(10)/65/,CONFST(11)/67/,CONFST(12)/69/,CONFST(13)/32/,CON
     *FST(14)/116/,CONFST(15)/111/,CONFST(16)/32/,CONFST(17)/99/,CONFST(
     *18)/111/,CONFST(19)/110/,CONFST(20)/102/,CONFST(21)/105/,CONFST(22
     *)/114/,CONFST(23)/109/,CONFST(24)/93/,CONFST(25)/32/,CONFST(26)/0/
      CALL PTMLIN(CONFST, 2)
      C = CLOWER(GETCH(C, 1))
      IF (.NOT.(C .NE. 13 .AND. C .NE. 10))GOTO 23199
      CALL MPUTCH(C, 2)
23199 CONTINUE
      IF (.NOT.(C .EQ. 32))GOTO 23201
      STATUS = 1
      GOTO 23202
23201 CONTINUE
      STATUS = 0
23202 CONTINUE
      GTCONF = STATUS
      RETURN
      END
      INTEGER FUNCTION GTCONT(STRNG)
      INTEGER INDEX
      LOGICAL*1 C, STRNG(100)
      LOGICAL*1 GETCH
      LOGICAL*1 STR(25)
      LOGICAL*1 CONSTR(2)
      DATA STR(1)/91/,STR(2)/116/,STR(3)/121/,STR(4)/112/,STR(5)/101/,ST
     *R(6)/32/,STR(7)/83/,STR(8)/80/,STR(9)/65/,STR(10)/67/,STR(11)/69/,
     *STR(12)/32/,STR(13)/116/,STR(14)/111/,STR(15)/32/,STR(16)/99/,STR(
     *17)/111/,STR(18)/110/,STR(19)/116/,STR(20)/105/,STR(21)/110/,STR(2
     *2)/117/,STR(23)/101/,STR(24)/93/,STR(25)/0/
      DATA CONSTR(1)/32/,CONSTR(2)/0/
      IF (.NOT.(STRNG(1) .EQ. 0))GOTO 23203
      CALL PTMLIN(STR, 2)
      GOTO 23204
23203 CONTINUE
      CALL PTMLIN(STRNG, 2)
23204 CONTINUE
      C = GETCH(C, 1)
      IF (.NOT.(INDEX(CONSTR, C) .GT. 0))GOTO 23205
      CALL MPUTCH(10, 2)
      GTCONT = 1
      GOTO 23206
23205 CONTINUE
      GTCONT = 0
23206 CONTINUE
      RETURN
      END
      SUBROUTINE GTHPTR(IN)
      REAL JDATE
      INTEGER I, GETLIN, MATCH, EQUAL, N, J, INDEX, IN
      INTEGER*4 TEMP
      COMMON / CHDRS / HSIZE(50), HADDR(50), RDATE(50), HDATE(12, 50), H
     *FROM(20, 50), HSUBJ(30, 50), HDELE(50)
      INTEGER HSIZE
      INTEGER*4 HADDR
      REAL RDATE
      LOGICAL*1 HDATE
      LOGICAL*1 HFROM
      LOGICAL*1 HSUBJ
      LOGICAL*1 HDELE
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      COMMON / MSGSCR / BUF(512), SCRFIL(40)
      LOGICAL*1 BUF
      LOGICAL*1 SCRFIL
      LOGICAL*1 ERRSTR(19)
      DATA ERRSTR(1)/84/,ERRSTR(2)/111/,ERRSTR(3)/111/,ERRSTR(4)/32/,ERR
     *STR(5)/109/,ERRSTR(6)/97/,ERRSTR(7)/110/,ERRSTR(8)/121/,ERRSTR(9)/
     *32/,ERRSTR(10)/109/,ERRSTR(11)/101/,ERRSTR(12)/115/,ERRSTR(13)/115
     */,ERRSTR(14)/97/,ERRSTR(15)/103/,ERRSTR(16)/101/,ERRSTR(17)/115/,E
     *RRSTR(18)/33/,ERRSTR(19)/0/
      I = 1
23207 CONTINUE
      CALL MARKL(IN, TEMP)
      CALL MARKL(UNIT, HADDR(I))
      IF (.NOT.(GETLIN(BUF, IN) .EQ. -1))GOTO 23210
      GOTO 23209
23210 CONTINUE
      CALL PUTLIN(BUF, UNIT)
      IF (.NOT.(EQUAL(BUF, HDRPAT) .EQ. 1))GOTO 23212
      IF (.NOT.(I .GE. 50))GOTO 23214
      CALL MPUTCH(10, 2)
      CALL PTMLIN(ERRSTR, 2)
      CALL MSGEND
23214 CONTINUE
      HFROM(1,I) = 0
      HSUBJ(1,I) = 0
      HDATE(1,I) = 0
      RDATE(I) = 0.
      N=GETLIN(BUF,IN)
23216 IF (.NOT.(N .GT. 1 .AND. N .NE. -1))GOTO 23218
      CALL FOLD(BUF)
      IF (.NOT.(MATCH(BUF, FROMPT) .EQ. 1))GOTO 23219
      CALL GETFLD(BUF, 6, 20, HFROM(1,I))
      GOTO 23220
23219 CONTINUE
      IF (.NOT.(MATCH(BUF, SUBJPT) .EQ. 1))GOTO 23221
      CALL GETFLD(BUF, 9, 30, HSUBJ(1,I))
      GOTO 23222
23221 CONTINUE
      IF (.NOT.(MATCH(BUF, DATEPT) .EQ. 1))GOTO 23223
      CALL GETFLD(BUF, 6, 12, HDATE(1,I))
      IF (.NOT.(INDEX(HDATE(1,I), 45) .GT. 0))GOTO 23225
      J = INDEX(HDATE(1,I), 32)
      IF (.NOT.(J .GT. 0))GOTO 23227
      HDATE(J,I) = 0
23227 CONTINUE
23225 CONTINUE
      RDATE(I) = JDATE(BUF(6))
23223 CONTINUE
23222 CONTINUE
23220 CONTINUE
23217 N=GETLIN(BUF,IN)
      GOTO 23216
23218 CONTINUE
      CALL SEEK(TEMP, IN)
      N = GETLIN(BUF, IN)
      CALL MARKL(IN, TEMP)
      M=GETLIN(BUF,IN)
23229 IF (.NOT.(M .NE. -1))GOTO 23231
      IF (.NOT.(EQUAL(BUF, HDRPAT) .EQ. 1))GOTO 23232
      GOTO 23231
23232 CONTINUE
      N = N + M
      CALL PUTLIN(BUF, UNIT)
23233 CONTINUE
      CALL MARKL(IN, TEMP)
23230 M=GETLIN(BUF,IN)
      GOTO 23229
23231 CONTINUE
      HSIZE(I) = N
      CALL SEEK(TEMP, IN)
      HDELE(I) = 0
      I = I + 1
23212 CONTINUE
23208 GOTO 23207
23209 CONTINUE
      NMSGS = I - 1
      RETURN
      END
      SUBROUTINE HEADMF(CH, LINARA, INT, PAGE)
      LOGICAL*1 CH
      INTEGER LINARA(50), INT, I, PAGE, J
      INTEGER GTCONT
      IF (.NOT.(CH .NE. 0))GOTO 23234
      CALL MPUTCH(CH, INT)
23234 CONTINUE
      J = 0
      I=1
23236 IF (.NOT.(I .LT. 50 .AND. LINARA(I) .NE. 0))GOTO 23238
      IF (.NOT.(PAGE .GT. 0 .AND. J .GE. PAGE))GOTO 23239
      IF (.NOT.(GTCONT(0) .EQ. 0))GOTO 23241
      GOTO 23238
23241 CONTINUE
      J = 0
23242 CONTINUE
23239 CONTINUE
      CALL PUTHDR(LINARA(I), INT)
      J = J + 1
23237 I=I+1
      GOTO 23236
23238 CONTINUE
      RETURN
      END
      SUBROUTINE INIMSH
      INTEGER I
      INTEGER INIHLP
      COMMON / CMHELP / HLPINT, HLPPTR(30), HLPSCR(30)
      INTEGER HLPINT
      INTEGER*4 HLPPTR
      INTEGER*4 HLPSCR
      COMMON / MSGSCR / BUF(512), SCRFIL(40)
      LOGICAL*1 BUF
      LOGICAL*1 SCRFIL
      LOGICAL*1 MSGHLP(7)
      DATA MSGHLP(1)/109/,MSGHLP(2)/115/,MSGHLP(3)/103/,MSGHLP(4)/104/,M
     *SGHLP(5)/108/,MSGHLP(6)/112/,MSGHLP(7)/0/
      CALL GETDIR(5, 6, SCRFIL)
      CALL CONCAT(SCRFIL, MSGHLP, SCRFIL)
      I = INIHLP(SCRFIL, HLPPTR, 30, HLPINT)
      RETURN
      END
      REAL FUNCTION JDATE(BUF)
      LOGICAL*1 BUF(100)
      JDATE = 0.
      RETURN
      END
      INTEGER FUNCTION MFSAVE(OUTFIL, ACCESS, LINARA, IFNOT)
      LOGICAL*1 OUTFIL(40)
      INTEGER ACCESS, LINARA(50), IFNOT, INT, J, I
      INTEGER CREATE
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      COMMON / CHDRS / HSIZE(50), HADDR(50), RDATE(50), HDATE(12, 50), H
     *FROM(20, 50), HSUBJ(30, 50), HDELE(50)
      INTEGER HSIZE
      INTEGER*4 HADDR
      REAL RDATE
      LOGICAL*1 HDATE
      LOGICAL*1 HFROM
      LOGICAL*1 HSUBJ
      LOGICAL*1 HDELE
      LOGICAL*1 SAVSTR(12)
      DATA SAVSTR(1)/117/,SAVSTR(2)/112/,SAVSTR(3)/100/,SAVSTR(4)/97/,SA
     *VSTR(5)/116/,SAVSTR(6)/105/,SAVSTR(7)/110/,SAVSTR(8)/103/,SAVSTR(9
     *)/46/,SAVSTR(10)/46/,SAVSTR(11)/46/,SAVSTR(12)/0/
      INT = CREATE(OUTFIL, ACCESS)
      IF (.NOT.(INT .NE. -3))GOTO 23243
      IF (.NOT.(IFNOT .EQ. 1))GOTO 23245
      CALL MPUTCH(10, 2)
      CALL PTMLIN(SAVSTR, 2)
23245 CONTINUE
      J = 1
      I=1
23247 IF (.NOT.(I .LE. NMSGS))GOTO 23249
      IF (.NOT.(HDELE(I) .EQ. 0))GOTO 23250
      LINARA(J) = I
      J = J + 1
23250 CONTINUE
23248 I=I+1
      GOTO 23247
23249 CONTINUE
      LINARA(J) = 0
      CALL PUTCH(10, INT)
      CALL PUTMF(HDRPAT, LINARA, INT, -1)
      CALL CLOSE(INT)
      MFSAVE = 0
      GOTO 23244
23243 CONTINUE
      MFSAVE = -3
23244 CONTINUE
      RETURN
      END
      SUBROUTINE MPUTCH(C, INT)
      INTEGER INT, RAW
      LOGICAL*1 C
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      COMMON / CRLF / CRLF(10)
      LOGICAL*1 CRLF
      IF (.NOT.(INT .EQ. 2 .AND. RAWOUT .EQ. 1 .AND. (C .EQ. 13 .OR. C .
     *EQ. 10)))GOTO 23252
      CALL PUTLIN(CRLF, INT)
      GOTO 23253
23252 CONTINUE
      CALL PUTCH(C, INT)
23253 CONTINUE
      RETURN
      END
      INTEGER FUNCTION MSGCMD(C)
      LOGICAL*1 C
      INTEGER DOANSW, DOBACK, DOCURR, DODELE, DOEXIT, DOFORW, DOINFO, DO
     *GOTO, DOHEAD, DOJUMP, DOLIST, DOMOVE, DONEXT, DOOVER, DOPUT, DOQUI
     *T, DOREAD, DOSNDM, DOTYPE, DOUNDE, DOWRIT, DONEWS, DOHELP, DOINTR
      COMMON / CMLINE / LINARA(50)
      INTEGER LINARA
      LOGICAL*1 ESTR(40)
      DATA ESTR(1)/32/,ESTR(2)/63/,ESTR(3)/32/,ESTR(4)/78/,ESTR(5)/111/,
     *ESTR(6)/32/,ESTR(7)/115/,ESTR(8)/117/,ESTR(9)/99/,ESTR(10)/104/,ES
     *TR(11)/32/,ESTR(12)/99/,ESTR(13)/111/,ESTR(14)/109/,ESTR(15)/109/,
     *ESTR(16)/97/,ESTR(17)/110/,ESTR(18)/100/,ESTR(19)/46/,ESTR(20)/32/
     *,ESTR(21)/91/,ESTR(22)/84/,ESTR(23)/121/,ESTR(24)/112/,ESTR(25)/10
     *1/,ESTR(26)/32/,ESTR(27)/39/,ESTR(28)/63/,ESTR(29)/39/,ESTR(30)/32
     */,ESTR(31)/102/,ESTR(32)/111/,ESTR(33)/114/,ESTR(34)/32/,ESTR(35)/
     *104/,ESTR(36)/101/,ESTR(37)/108/,ESTR(38)/112/,ESTR(39)/93/,ESTR(4
     *0)/0/
      IF (.NOT.(C .EQ. 97))GOTO 23254
      MSGCMD = DOANSW(C)
      GOTO 23255
23254 CONTINUE
      IF (.NOT.(C .EQ. 98))GOTO 23256
      MSGCMD = DOBACK(LINARA)
      GOTO 23257
23256 CONTINUE
      IF (.NOT.(C .EQ. 99))GOTO 23258
      MSGCMD = DOCURR(C)
      GOTO 23259
23258 CONTINUE
      IF (.NOT.(C .EQ. 100))GOTO 23260
      MSGCMD = DODELE(LINARA)
      GOTO 23261
23260 CONTINUE
      IF (.NOT.(C .EQ. 101))GOTO 23262
      MSGCMD = DOEXIT(LINARA)
      GOTO 23263
23262 CONTINUE
      IF (.NOT.(C .EQ. 102))GOTO 23264
      MSGCMD = DOFORW(C)
      GOTO 23265
23264 CONTINUE
      IF (.NOT.(C .EQ. 103))GOTO 23266
      MSGCMD = DOGOTO(C)
      GOTO 23267
23266 CONTINUE
      IF (.NOT.(C .EQ. 104))GOTO 23268
      MSGCMD = DOHEAD(LINARA)
      GOTO 23269
23268 CONTINUE
      IF (.NOT.(C .EQ. 105))GOTO 23270
      MSGCMD = DOINFO(X)
      GOTO 23271
23270 CONTINUE
      IF (.NOT.(C .EQ. 106))GOTO 23272
      MSGCMD = DOJUMP(C)
      GOTO 23273
23272 CONTINUE
      IF (.NOT.(C .EQ. 108))GOTO 23274
      MSGCMD = DOLIST(LINARA)
      GOTO 23275
23274 CONTINUE
      IF (.NOT.(C .EQ. 109))GOTO 23276
      MSGCMD = DOMOVE(LINARA)
      GOTO 23277
23276 CONTINUE
      IF (.NOT.(C .EQ. 110))GOTO 23278
      MSGCMD = DONEXT(LINARA)
      GOTO 23279
23278 CONTINUE
      IF (.NOT.(C .EQ. 111))GOTO 23280
      MSGCMD = DOOVER(LINARA)
      GOTO 23281
23280 CONTINUE
      IF (.NOT.(C .EQ. 112))GOTO 23282
      MSGCMD = DOPUT(LINARA)
      GOTO 23283
23282 CONTINUE
      IF (.NOT.(C .EQ. 113))GOTO 23284
      MSGCMD = DOQUIT(C)
      GOTO 23285
23284 CONTINUE
      IF (.NOT.(C .EQ. 114))GOTO 23286
      MSGCMD = DOREAD(LINARA)
      GOTO 23287
23286 CONTINUE
      IF (.NOT.(C .EQ. 115))GOTO 23288
      MSGCMD = DOSNDM(C)
      GOTO 23289
23288 CONTINUE
      IF (.NOT.(C .EQ. 116))GOTO 23290
      MSGCMD = DOTYPE(LINARA)
      GOTO 23291
23290 CONTINUE
      IF (.NOT.(C .EQ. 117))GOTO 23292
      MSGCMD = DOUNDE(LINARA)
      GOTO 23293
23292 CONTINUE
      IF (.NOT.(C .EQ. 119))GOTO 23294
      MSGCMD = DOWRIT(LINARA)
      GOTO 23295
23294 CONTINUE
      IF (.NOT.(C .EQ. 35))GOTO 23296
      MSGCMD = DONEWS(C)
      GOTO 23297
23296 CONTINUE
      IF (.NOT.(C .EQ. 63))GOTO 23298
      MSGCMD = DOHELP(C)
      GOTO 23299
23298 CONTINUE
      IF (.NOT.(C .EQ. 37))GOTO 23300
      MSGCMD = DOINTR(C)
      GOTO 23301
23300 CONTINUE
      CALL MPUTCH(C, 2)
      CALL PTMLIN(ESTR, 2)
      MSGCMD = -3
23301 CONTINUE
23299 CONTINUE
23297 CONTINUE
23295 CONTINUE
23293 CONTINUE
23291 CONTINUE
23289 CONTINUE
23287 CONTINUE
23285 CONTINUE
23283 CONTINUE
23281 CONTINUE
23279 CONTINUE
23277 CONTINUE
23275 CONTINUE
23273 CONTINUE
23271 CONTINUE
23269 CONTINUE
23267 CONTINUE
23265 CONTINUE
23263 CONTINUE
23261 CONTINUE
23259 CONTINUE
23257 CONTINUE
23255 CONTINUE
      RETURN
      END
      SUBROUTINE MSGEND
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      CALL MPUTCH(10, 2)
      CALL CLOSE(UNIT)
      CALL REMOVE(SCRAT)
      CALL ENDST(0)
      RETURN
      END
      SUBROUTINE MSGINT
      LOGICAL*1 CLOWER
      LOGICAL*1 C
      INTEGER GETPAT, I, OPEN, GETARG, READMF, J, CTOI, PAD, NOW(7)
      REAL JDATE
      COMMON / CHDRS / HSIZE(50), HADDR(50), RDATE(50), HDATE(12, 50), H
     *FROM(20, 50), HSUBJ(30, 50), HDELE(50)
      INTEGER HSIZE
      INTEGER*4 HADDR
      REAL RDATE
      LOGICAL*1 HDATE
      LOGICAL*1 HFROM
      LOGICAL*1 HSUBJ
      LOGICAL*1 HDELE
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      COMMON / CRLF / CRLF(10)
      LOGICAL*1 CRLF
      COMMON / CMHELP / HLPINT, HLPPTR(30), HLPSCR(30)
      INTEGER HLPINT
      INTEGER*4 HLPPTR
      INTEGER*4 HLPSCR
      COMMON / MSGSCR / BUF(512), SCRFIL(40)
      LOGICAL*1 BUF
      LOGICAL*1 SCRFIL
      COMMON / CMLINE / LINARA(50)
      INTEGER LINARA
      LOGICAL*1 MYMAIL(7)
      LOGICAL*1 MSG(4)
      LOGICAL*1 FROMS(7)
      LOGICAL*1 SUBJS(10)
      LOGICAL*1 DATES(7)
      LOGICAL*1 PATRNS(29)
      LOGICAL*1 BLNK(2)
      DATA MYMAIL(1)/109/,MYMAIL(2)/121/,MYMAIL(3)/109/,MYMAIL(4)/97/,MY
     *MAIL(5)/105/,MYMAIL(6)/108/,MYMAIL(7)/0/
      DATA MSG(1)/109/,MSG(2)/115/,MSG(3)/103/,MSG(4)/0/
      DATA FROMS(1)/37/,FROMS(2)/102/,FROMS(3)/114/,FROMS(4)/111/,FROMS(
     *5)/109/,FROMS(6)/58/,FROMS(7)/0/
      DATA SUBJS(1)/37/,SUBJS(2)/115/,SUBJS(3)/117/,SUBJS(4)/98/,SUBJS(5
     *)/106/,SUBJS(6)/101/,SUBJS(7)/99/,SUBJS(8)/116/,SUBJS(9)/58/,SUBJS
     *(10)/0/
      DATA DATES(1)/37/,DATES(2)/100/,DATES(3)/97/,DATES(4)/116/,DATES(5
     *)/101/,DATES(6)/58/,DATES(7)/0/
      DATA PATRNS(1)/69/,PATRNS(2)/114/,PATRNS(3)/114/,PATRNS(4)/111/,PA
     *TRNS(5)/114/,PATRNS(6)/32/,PATRNS(7)/105/,PATRNS(8)/110/,PATRNS(9)
     */32/,PATRNS(10)/103/,PATRNS(11)/101/,PATRNS(12)/110/,PATRNS(13)/10
     *1/,PATRNS(14)/114/,PATRNS(15)/97/,PATRNS(16)/116/,PATRNS(17)/105/,
     *PATRNS(18)/110/,PATRNS(19)/103/,PATRNS(20)/32/,PATRNS(21)/112/,PAT
     *RNS(22)/97/,PATRNS(23)/116/,PATRNS(24)/116/,PATRNS(25)/101/,PATRNS
     *(26)/114/,PATRNS(27)/110/,PATRNS(28)/46/,PATRNS(29)/0/
      DATA BLNK(1)/32/,BLNK(2)/0/
      IF (.NOT.(RAWIN .EQ. 1 .AND. RAWOUT .EQ. 1))GOTO 23302
      PAGESZ = 22
      GOTO 23303
23302 CONTINUE
      PAGESZ = -1
23303 CONTINUE
      HDRPAT(1) = 1
      HDRPAT(2) = 1
      HDRPAT(3) = 10
      HDRPAT(4) = 0
      CALL INIMSH
      CALL GETNOW(NOW)
      CALL FMTDAT(SCRFIL, BUF, NOW, 1)
      CALL CONCAT(SCRFIL, BLNK, SCRFIL)
      CALL CONCAT(SCRFIL, BUF, SCRFIL)
      TDATE = JDATE(SCRFIL)
      IF (.NOT.(GETPAT(FROMS, FROMPT) .EQ. -3))GOTO 23304
      CALL ERROR(PATRNS)
23304 CONTINUE
      IF (.NOT.(GETPAT(SUBJS, SUBJPT) .EQ. -3))GOTO 23306
      CALL ERROR(PATRNS)
23306 CONTINUE
      IF (.NOT.(GETPAT(DATES, DATEPT) .EQ. -3))GOTO 23308
      CALL ERROR(PATRNS)
23308 CONTINUE
      CALL HOMDIR(HOME)
      CALL SCRATF(MSG, SCRAT)
      UNIT = -3
      CALL CONCAT(HOME, MYMAIL, SCRFIL)
      DEFALT = 1
      PAD = 5
      I=1
23310 IF (.NOT.(GETARG(I, BUF, 40) .NE. -1))GOTO 23312
      IF (.NOT.(BUF(1) .EQ. 45))GOTO 23313
      C = CLOWER(BUF(2))
      IF (.NOT.(C .EQ. 102))GOTO 23315
      J = 3
      PAD = CTOI(BUF, J)
      PAD = MIN0(PAD, 7)
      PAD = MAX0(PAD, 0)
      GOTO 23316
23315 CONTINUE
      IF (.NOT.(C .EQ. 112))GOTO 23317
      IF (.NOT.(RAWIN .EQ. 1 .AND. RAWOUT .EQ. 1))GOTO 23319
      J = 3
      PAGESZ = CTOI(BUF, J)
      IF (.NOT.(PAGESZ .LE. 0))GOTO 23321
      PAGESZ = -1
23321 CONTINUE
23319 CONTINUE
      GOTO 23318
23317 CONTINUE
      CALL BADARG(BUF)
23318 CONTINUE
23316 CONTINUE
      GOTO 23314
23313 CONTINUE
      CALL STRCPY(BUF, SCRFIL)
      DEFALT = 0
23314 CONTINUE
23311 I=I+1
      GOTO 23310
23312 CONTINUE
      CRLF(1) = 13
      CRLF(2) = 10
      J = 3
      CALL PCHAR(128, PAD, CRLF, J)
      CRLF(J) = 0
      CALL BANNER
      IF (.NOT.(READMF(SCRFIL, 0, 1, LINARA) .EQ. -3))GOTO 23323
      CALL PUTLIN(SCRFIL, 3)
      CALL REMARK(33H : cannot open. Use Read command.)
23323 CONTINUE
      RETURN
      END
      INTEGER FUNCTION MSGSEQ(LINARA)
      INTEGER LINARA(50), I, J, VALUE
      INTEGER GETPAT, MATCH, LENGTH, DOSEQU
      LOGICAL*1 GETCH, CLOWER, GETRLN, TYPE, GSEQNO
      LOGICAL*1 C, TEXT(40), PAT(40), TRMARA(4)
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      COMMON / CHDRS / HSIZE(50), HADDR(50), RDATE(50), HDATE(12, 50), H
     *FROM(20, 50), HSUBJ(30, 50), HDELE(50)
      INTEGER HSIZE
      INTEGER*4 HADDR
      REAL RDATE
      LOGICAL*1 HDATE
      LOGICAL*1 HFROM
      LOGICAL*1 HSUBJ
      LOGICAL*1 HDELE
      LOGICAL*1 MSGSTR(21)
      LOGICAL*1 ALLSTR(13)
      LOGICAL*1 FRMSTR(14)
      LOGICAL*1 SUBST(17)
      LOGICAL*1 DELSTR(17)
      LOGICAL*1 UNDSTR(3)
      LOGICAL*1 SEQERR(29)
      DATA MSGSTR(1)/32/,MSGSTR(2)/40/,MSGSTR(3)/109/,MSGSTR(4)/101/,MSG
     *STR(5)/115/,MSGSTR(6)/115/,MSGSTR(7)/97/,MSGSTR(8)/103/,MSGSTR(9)/
     *101/,MSGSTR(10)/32/,MSGSTR(11)/115/,MSGSTR(12)/101/,MSGSTR(13)/113
     */,MSGSTR(14)/117/,MSGSTR(15)/101/,MSGSTR(16)/110/,MSGSTR(17)/99/,M
     *SGSTR(18)/101/,MSGSTR(19)/41/,MSGSTR(20)/32/,MSGSTR(21)/0/
      DATA ALLSTR(1)/97/,ALLSTR(2)/108/,ALLSTR(3)/108/,ALLSTR(4)/32/,ALL
     *STR(5)/109/,ALLSTR(6)/101/,ALLSTR(7)/115/,ALLSTR(8)/115/,ALLSTR(9)
     */97/,ALLSTR(10)/103/,ALLSTR(11)/101/,ALLSTR(12)/115/,ALLSTR(13)/0/
      DATA FRMSTR(1)/102/,FRMSTR(2)/114/,FRMSTR(3)/111/,FRMSTR(4)/109/,F
     *RMSTR(5)/32/,FRMSTR(6)/115/,FRMSTR(7)/116/,FRMSTR(8)/114/,FRMSTR(9
     *)/105/,FRMSTR(10)/110/,FRMSTR(11)/103/,FRMSTR(12)/58/,FRMSTR(13)/3
     *2/,FRMSTR(14)/0/
      DATA SUBST(1)/115/,SUBST(2)/117/,SUBST(3)/98/,SUBST(4)/106/,SUBST(
     *5)/101/,SUBST(6)/99/,SUBST(7)/116/,SUBST(8)/32/,SUBST(9)/115/,SUBS
     *T(10)/116/,SUBST(11)/114/,SUBST(12)/105/,SUBST(13)/110/,SUBST(14)/
     *103/,SUBST(15)/58/,SUBST(16)/32/,SUBST(17)/0/
      DATA DELSTR(1)/100/,DELSTR(2)/101/,DELSTR(3)/108/,DELSTR(4)/101/,D
     *ELSTR(5)/116/,DELSTR(6)/101/,DELSTR(7)/100/,DELSTR(8)/32/,DELSTR(9
     *)/109/,DELSTR(10)/101/,DELSTR(11)/115/,DELSTR(12)/115/,DELSTR(13)/
     *97/,DELSTR(14)/103/,DELSTR(15)/101/,DELSTR(16)/115/,DELSTR(17)/0/
      DATA UNDSTR(1)/117/,UNDSTR(2)/110/,UNDSTR(3)/0/
      DATA SEQERR(1)/32/,SEQERR(2)/63/,SEQERR(3)/32/,SEQERR(4)/73/,SEQER
     *R(5)/110/,SEQERR(6)/118/,SEQERR(7)/97/,SEQERR(8)/108/,SEQERR(9)/10
     *5/,SEQERR(10)/100/,SEQERR(11)/32/,SEQERR(12)/109/,SEQERR(13)/101/,
     *SEQERR(14)/115/,SEQERR(15)/115/,SEQERR(16)/97/,SEQERR(17)/103/,SEQ
     *ERR(18)/101/,SEQERR(19)/32/,SEQERR(20)/115/,SEQERR(21)/101/,SEQERR
     *(22)/113/,SEQERR(23)/117/,SEQERR(24)/101/,SEQERR(25)/110/,SEQERR(2
     *6)/99/,SEQERR(27)/101/,SEQERR(28)/33/,SEQERR(29)/0/
      DATA TRMARA/13, 10, 27, 0/
23325 CONTINUE
      CALL PTMLIN(MSGSTR, 2)
      C = CLOWER(GETCH(C, 1))
      IF (.NOT.(C .EQ. 63))GOTO 23328
      J = DOSEQU(C)
23328 CONTINUE
23326 IF (.NOT.(C .NE. 63))GOTO 23325
23327 CONTINUE
      IF (.NOT.(C .EQ. 102))GOTO 23330
      CALL PTMLIN(FRMSTR, 2)
      C = GETRLN(TEXT, 1, 1, 2, TRMARA)
      CALL FOLD(TEXT)
      J = 1
      IF (.NOT.(GETPAT(TEXT, PAT) .NE. -3 .AND. LENGTH(TEXT) .GT. 0))GOT
     *O 23332
      I=1
23334 IF (.NOT.(I .LE. NMSGS))GOTO 23336
      IF (.NOT.(MATCH(HFROM(1,I), PAT) .EQ. 1))GOTO 23337
      LINARA(J) = I
      J = J + 1
23337 CONTINUE
23335 I=I+1
      GOTO 23334
23336 CONTINUE
      LINARA(J) = 0
      MSGSEQ = 0
      GOTO 23333
23332 CONTINUE
      MSGSEQ = -3
23333 CONTINUE
      GOTO 23331
23330 CONTINUE
      IF (.NOT.(C .EQ. 115))GOTO 23339
      CALL PTMLIN(SUBST, 2)
      C = GETRLN(TEXT, 1, 1, 2, TRMARA)
      CALL FOLD(TEXT)
      J = 1
      IF (.NOT.(GETPAT(TEXT, PAT) .NE. -3 .AND. LENGTH(TEXT) .GT. 0))GOT
     *O 23341
      I=1
23343 IF (.NOT.(I .LE. NMSGS))GOTO 23345
      IF (.NOT.(MATCH(HSUBJ(1,I), PAT) .EQ. 1))GOTO 23346
      LINARA(J) = I
      J = J + 1
23346 CONTINUE
23344 I=I+1
      GOTO 23343
23345 CONTINUE
      LINARA(J) = 0
      MSGSEQ = 0
      GOTO 23342
23341 CONTINUE
      MSGSEQ = -3
23342 CONTINUE
      GOTO 23340
23339 CONTINUE
      IF (.NOT.(C .EQ. 97))GOTO 23348
      CALL PTMLIN(ALLSTR, 2)
      I=1
23350 IF (.NOT.(I .LE. NMSGS))GOTO 23352
      LINARA(I) = I
23351 I=I+1
      GOTO 23350
23352 CONTINUE
      LINARA(I) = 0
      MSGSEQ = 0
      GOTO 23349
23348 CONTINUE
      IF (.NOT.(C .EQ. 100 .OR. C .EQ. 117))GOTO 23353
      IF (.NOT.(C .EQ. 100))GOTO 23355
      VALUE = 1
      GOTO 23356
23355 CONTINUE
      VALUE = 0
      CALL PTMLIN(UNDSTR, 2)
23356 CONTINUE
      CALL PTMLIN(DELSTR, 2)
      J = 1
      I=1
23357 IF (.NOT.(I .LE. NMSGS))GOTO 23359
      IF (.NOT.(HDELE(I) .EQ. VALUE))GOTO 23360
      LINARA(J) = I
      J = J + 1
23360 CONTINUE
23358 I=I+1
      GOTO 23357
23359 CONTINUE
      LINARA(J) = 0
      GOTO 23354
23353 CONTINUE
      IF (.NOT.(C .EQ. 13 .OR. C .EQ. 10))GOTO 23362
      LINARA(1) = CURMSG
      LINARA(2) = 0
      MSGSEQ = 0
      GOTO 23363
23362 CONTINUE
      IF (.NOT.(TYPE(C) .EQ. 2))GOTO 23364
      IF (.NOT.(GSEQNO(C, LINARA) .EQ. -3))GOTO 23366
      MSGSEQ = -3
      GOTO 23367
23366 CONTINUE
      MSGSEQ = 0
23367 CONTINUE
      GOTO 23365
23364 CONTINUE
      MSGSEQ = -3
23365 CONTINUE
23363 CONTINUE
23354 CONTINUE
23349 CONTINUE
23340 CONTINUE
23331 CONTINUE
      IF (.NOT.(MSGSEQ .EQ. -3))GOTO 23368
      CALL PTMLIN(SEQERR, 2)
23368 CONTINUE
      RETURN
      END
      SUBROUTINE NOTIMP
      LOGICAL*1 IMPSTR(16)
      DATA IMPSTR(1)/32/,IMPSTR(2)/32/,IMPSTR(3)/85/,IMPSTR(4)/78/,IMPST
     *R(5)/73/,IMPSTR(6)/77/,IMPSTR(7)/80/,IMPSTR(8)/76/,IMPSTR(9)/69/,I
     *MPSTR(10)/77/,IMPSTR(11)/69/,IMPSTR(12)/78/,IMPSTR(13)/84/,IMPSTR(
     *14)/69/,IMPSTR(15)/68/,IMPSTR(16)/0/
      CALL PTMLIN(IMPSTR, 2)
      RETURN
      END
      SUBROUTINE ONEMSG(N)
      INTEGER N, LINARA(2)
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      LOGICAL*1 MSGHDR(27)
      DATA MSGHDR(1)/32/,MSGHDR(2)/40/,MSGHDR(3)/109/,MSGHDR(4)/101/,MSG
     *HDR(5)/115/,MSGHDR(6)/115/,MSGHDR(7)/97/,MSGHDR(8)/103/,MSGHDR(9)/
     *101/,MSGHDR(10)/32/,MSGHDR(11)/35/,MSGHDR(12)/44/,MSGHDR(13)/32/,M
     *SGHDR(14)/42/,MSGHDR(15)/32/,MSGHDR(16)/99/,MSGHDR(17)/104/,MSGHDR
     *(18)/97/,MSGHDR(19)/114/,MSGHDR(20)/97/,MSGHDR(21)/99/,MSGHDR(22)/
     *116/,MSGHDR(23)/101/,MSGHDR(24)/114/,MSGHDR(25)/115/,MSGHDR(26)/41
     */,MSGHDR(27)/0/
      DATA LINARA(2) /0/
      LINARA(1) = N
      MSGHDR(1) = 10
      CALL PUTMF(MSGHDR, LINARA, 2, PAGESZ)
      RETURN
      END
      SUBROUTINE PCHAR(C, N, LIN, J)
      LOGICAL*1 C, LIN(100)
      INTEGER N, I, J
      I=1
23370 IF (.NOT.(I .LE. N))GOTO 23372
      LIN(J) = C
      J = J + 1
23371 I=I+1
      GOTO 23370
23372 CONTINUE
      RETURN
      END
      SUBROUTINE PTMLIN(LIN, INT)
      LOGICAL*1 LIN(100), BUF(200)
      INTEGER INT
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      COMMON / CRLF / CRLF(10)
      LOGICAL*1 CRLF
      IF (.NOT.(INT .EQ. 2 .AND. RAWOUT .EQ. 1))GOTO 23373
      CALL SBST(LIN, 10, BUF, CRLF)
      CALL PUTLIN(BUF, INT)
      GOTO 23374
23373 CONTINUE
      CALL PUTLIN(LIN, INT)
23374 CONTINUE
      RETURN
      END
      SUBROUTINE PUTHDR(N, INT)
      INTEGER N, INT, M, ITOC, LENGTH, I
      LOGICAL*1 TEMP(10), BUF(100)
      COMMON / CHDRS / HSIZE(50), HADDR(50), RDATE(50), HDATE(12, 50), H
     *FROM(20, 50), HSUBJ(30, 50), HDELE(50)
      INTEGER HSIZE
      INTEGER*4 HADDR
      REAL RDATE
      LOGICAL*1 HDATE
      LOGICAL*1 HFROM
      LOGICAL*1 HSUBJ
      LOGICAL*1 HDELE
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      IF (.NOT.(N .GE. 1 .AND. N .LE. NMSGS))GOTO 23375
      I = 1
      M = 4 - ITOC(N, TEMP, 10)
      CALL PCHAR(32, M, BUF, I)
      CALL STCOPY(TEMP, 1, BUF, I)
      IF (.NOT.(HDELE(N) .EQ. 1))GOTO 23377
      CALL CHCOPY(42, BUF, I)
      GOTO 23378
23377 CONTINUE
      CALL CHCOPY(32, BUF, I)
23378 CONTINUE
      M = 6 - ITOC(HSIZE(N), TEMP, 10)
      CALL PCHAR(32, M, BUF, I)
      CALL STCOPY(TEMP, 1, BUF, I)
      CALL CHCOPY(32, BUF, I)
      M = 14 - LENGTH(HDATE(1,N))
      CALL STCOPY(HDATE(1,N), 1, BUF, I)
      CALL PCHAR(32, M, BUF, I)
      M = 20 - LENGTH(HFROM(1,N))
      CALL STCOPY(HFROM(1,N), 1, BUF, I)
      CALL PCHAR(32, M, BUF, I)
      CALL STCOPY(HSUBJ(1,N), 1, BUF, I)
      CALL CHCOPY(10, BUF, I)
      BUF(I) = 0
      CALL PTMLIN(BUF, INT)
23375 CONTINUE
      RETURN
      END
      SUBROUTINE PUTMF(HDRSTR, LINARA, INT, PAGE)
      LOGICAL*1 HDRSTR(100), TEMP(75)
      INTEGER LINARA(50), INT, I, N, JUNK, PAGE
      INTEGER ITOC, LENGTH, GTCONT
      COMMON / MSGSCR / BUF(512), SCRFIL(40)
      LOGICAL*1 BUF
      LOGICAL*1 SCRFIL
      COMMON / CHDRS / HSIZE(50), HADDR(50), RDATE(50), HDATE(12, 50), H
     *FROM(20, 50), HSUBJ(30, 50), HDELE(50)
      INTEGER HSIZE
      INTEGER*4 HADDR
      REAL RDATE
      LOGICAL*1 HDATE
      LOGICAL*1 HFROM
      LOGICAL*1 HSUBJ
      LOGICAL*1 HDELE
      LOGICAL*1 CONSTR(30)
      DATA CONSTR(1)/91/,CONSTR(2)/116/,CONSTR(3)/121/,CONSTR(4)/112/,CO
     *NSTR(5)/101/,CONSTR(6)/32/,CONSTR(7)/83/,CONSTR(8)/80/,CONSTR(9)/6
     *5/,CONSTR(10)/67/,CONSTR(11)/69/,CONSTR(12)/32/,CONSTR(13)/102/,CO
     *NSTR(14)/111/,CONSTR(15)/114/,CONSTR(16)/32/,CONSTR(17)/110/,CONST
     *R(18)/101/,CONSTR(19)/120/,CONSTR(20)/116/,CONSTR(21)/32/,CONSTR(2
     *2)/109/,CONSTR(23)/101/,CONSTR(24)/115/,CONSTR(25)/115/,CONSTR(26)
     */97/,CONSTR(27)/103/,CONSTR(28)/101/,CONSTR(29)/93/,CONSTR(30)/0/
      I=1
23379 IF (.NOT.(I .LT. 50 .AND. LINARA(I) .NE. 0))GOTO 23381
      IF (.NOT.(I .GT. 1 .AND. PAGE .GT. 0))GOTO 23382
      IF (.NOT.(GTCONT(CONSTR) .EQ. 0))GOTO 23384
      GOTO 23381
23384 CONTINUE
23382 CONTINUE
      N = LINARA(I)
      JUNK = ITOC(N, SCRFIL, 10)
      CALL SBST(HDRSTR, 35, TEMP, SCRFIL)
      JUNK = ITOC(HSIZE(N), SCRFIL, 10)
      CALL SBST(TEMP, 42, BUF, SCRFIL)
      CALL PTMLIN(BUF, INT)
      JUNK = LENGTH(BUF)
      IF (.NOT.(BUF(JUNK) .NE. 10))GOTO 23386
      CALL MPUTCH(10, INT)
23386 CONTINUE
      CALL PUTMSG(N, INT, PAGE)
23380 I=I+1
      GOTO 23379
23381 CONTINUE
      RETURN
      END
      SUBROUTINE PUTMSG(N, INT, PAGE)
      INTEGER N, INT, I, M, J, PAGE
      INTEGER GETLIN, GTCONT
      COMMON / CHDRS / HSIZE(50), HADDR(50), RDATE(50), HDATE(12, 50), H
     *FROM(20, 50), HSUBJ(30, 50), HDELE(50)
      INTEGER HSIZE
      INTEGER*4 HADDR
      REAL RDATE
      LOGICAL*1 HDATE
      LOGICAL*1 HFROM
      LOGICAL*1 HSUBJ
      LOGICAL*1 HDELE
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      COMMON / MSGSCR / BUF(512), SCRFIL(40)
      LOGICAL*1 BUF
      LOGICAL*1 SCRFIL
      IF (.NOT.(N .GE. 1 .AND. N .LE. NMSGS))GOTO 23388
      CALL SEEK(HADDR(N), UNIT)
      I = GETLIN(BUF, UNIT)
      J = 0
      M=GETLIN(BUF,UNIT)
23390 IF (.NOT.(I .LT. HSIZE(N)))GOTO 23392
      IF (.NOT.(PAGE .GT. 0 .AND. J .GE. PAGE))GOTO 23393
      IF (.NOT.(GTCONT(0) .EQ. 0))GOTO 23395
      GOTO 23392
23395 CONTINUE
      J = 0
23396 CONTINUE
23393 CONTINUE
      CALL PTMLIN(BUF, INT)
      J = J + 1
      I = I + M
23391 M=GETLIN(BUF,UNIT)
      GOTO 23390
23392 CONTINUE
23388 CONTINUE
      RETURN
      END
      INTEGER FUNCTION READMF(TFILE, IFNOT, IFLIST, LINARA)
      LOGICAL*1 TFILE(100)
      INTEGER OPEN, CREATE
      INTEGER IFNOT, IN, IFLIST, I, LINARA(50)
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      LOGICAL*1 REDSTR(11)
      DATA REDSTR(1)/114/,REDSTR(2)/101/,REDSTR(3)/97/,REDSTR(4)/100/,RE
     *DSTR(5)/105/,REDSTR(6)/110/,REDSTR(7)/103/,REDSTR(8)/46/,REDSTR(9)
     */46/,REDSTR(10)/46/,REDSTR(11)/0/
      IF (.NOT.(UNIT .NE. -3))GOTO 23397
      CALL CLOSE(UNIT)
23397 CONTINUE
      IN = OPEN(TFILE, 1)
      IF (.NOT.(IN .EQ. -3))GOTO 23399
      READMF = -3
      RETURN
23399 CONTINUE
      UNIT = CREATE(SCRAT, 3)
      IF (.NOT.(UNIT .NE. -3))GOTO 23401
      CALL SCOPY(TFILE, 1, FILE, 1)
      IF (.NOT.(IFNOT .EQ. 1))GOTO 23403
      CALL PTMLIN(REDSTR, 2)
23403 CONTINUE
      CALL GTHPTR(IN)
      CURMSG = MIN0(0, NMSGS)
      IF (.NOT.(IFLIST .EQ. 1))GOTO 23405
      I=1
23407 IF (.NOT.(I .LE. NMSGS))GOTO 23409
      LINARA(I) = I
23408 I=I+1
      GOTO 23407
23409 CONTINUE
      LINARA(I) = 0
      CALL HEADMF(10, LINARA, 2, PAGESZ)
23405 CONTINUE
23401 CONTINUE
      CALL CLOSE(IN)
      READMF = UNIT
      RETURN
      END
      INTEGER FUNCTION SAVEMF(LINARA)
      INTEGER LINARA(50), I, ACCESS, MMSGS
      INTEGER CREATE, MFSAVE, READMF
      COMMON / CMSG / NMSGS, CURMSG, UNIT, DEFALT, RAWIN, RAWOUT, PAGESZ
     *, TDATE, HOME(40), FILE(40), SCRAT(40), HDRPAT(4), FROMPT(20), SUB
     *JPT(20), DATEPT(20)
      INTEGER NMSGS
      INTEGER CURMSG
      INTEGER UNIT
      INTEGER DEFALT
      INTEGER RAWIN
      INTEGER RAWOUT
      INTEGER PAGESZ
      REAL TDATE
      LOGICAL*1 HOME
      LOGICAL*1 FILE
      LOGICAL*1 SCRAT
      LOGICAL*1 HDRPAT
      LOGICAL*1 FROMPT
      LOGICAL*1 SUBJPT
      LOGICAL*1 DATEPT
      COMMON / CHDRS / HSIZE(50), HADDR(50), RDATE(50), HDATE(12, 50), H
     *FROM(20, 50), HSUBJ(30, 50), HDELE(50)
      INTEGER HSIZE
      INTEGER*4 HADDR
      REAL RDATE
      LOGICAL*1 HDATE
      LOGICAL*1 HFROM
      LOGICAL*1 HSUBJ
      LOGICAL*1 HDELE
      COMMON / MSGSCR / BUF(512), SCRFIL(40)
      LOGICAL*1 BUF
      LOGICAL*1 SCRFIL
      LOGICAL*1 MBOX(5)
      LOGICAL*1 MYMAIL(7)
      DATA MBOX(1)/109/,MBOX(2)/98/,MBOX(3)/111/,MBOX(4)/120/,MBOX(5)/0/
      DATA MYMAIL(1)/109/,MYMAIL(2)/121/,MYMAIL(3)/109/,MYMAIL(4)/97/,MY
     *MAIL(5)/105/,MYMAIL(6)/108/,MYMAIL(7)/0/
      IF (.NOT.(DEFALT .EQ. 1))GOTO 23410
      CALL CONCAT(HOME, MBOX, FILE)
      ACCESS = 4
      GOTO 23411
23410 CONTINUE
      ACCESS = 2
23411 CONTINUE
      IF (.NOT.(MFSAVE(FILE, ACCESS, LINARA, 1) .EQ. -3))GOTO 23412
      SAVEMF = -3
      GOTO 23413
23412 CONTINUE
      IF (.NOT.(DEFALT .EQ. 1))GOTO 23414
      MMSGS = NMSGS
      CALL CONCAT(HOME, MYMAIL, SCRFIL)
      IF (.NOT.(READMF(SCRFIL, 0, 0, LINARA) .EQ. -3))GOTO 23416
      SAVEMF = -3
      GOTO 23417
23416 CONTINUE
      I=1
23418 IF (.NOT.(I .LE. MMSGS))GOTO 23420
      HDELE(I) = 1
23419 I=I+1
      GOTO 23418
23420 CONTINUE
      SAVEMF = MFSAVE(SCRFIL, 2, LINARA, 0)
23417 CONTINUE
      CALL CONCAT(HOME, MBOX, FILE)
      DEFALT = 0
      GOTO 23415
23414 CONTINUE
      SAVEMF = 0
23415 CONTINUE
23413 CONTINUE
      RETURN
      END
      SUBROUTINE SBST (IN,CHAR,OUT,SUBARA)
      LOGICAL*1 IN(100), CHAR, OUT(100), SUBARA(100)
      INTEGER I, J
      J = 1
      I=1
23421 IF (.NOT.(IN(I) .NE. 0))GOTO 23423
      IF (.NOT.(IN(I) .EQ. CHAR))GOTO 23424
      CALL STCOPY(SUBARA, 1, OUT, J)
      GOTO 23425
23424 CONTINUE
      CALL CHCOPY(IN(I), OUT, J)
23425 CONTINUE
23422 I=I+1
      GOTO 23421
23423 CONTINUE
      OUT(J) = 0
      RETURN
      END
      INTEGER FUNCTION SPWNIT(BUF)
      LOGICAL*1 BUF(100), IMAGE(40), PATH(120), TEMP(40)
      INTEGER I, JUNK
      INTEGER GETWRD, LOCCOM, SSPAWN
      LOGICAL*1 SUFFIX(7)
      DATA SUFFIX(1)/46/,SUFFIX(2)/116/,SUFFIX(3)/115/,SUFFIX(4)/107/,SU
     *FFIX(5)/0/,SUFFIX(6)/10/,SUFFIX(7)/0/
      I = 1
      JUNK = GETWRD(BUF, I, TEMP)
      CALL IMPATH(PATH)
      JUNK = LOCCOM(TEMP, PATH, SUFFIX, IMAGE)
      CALL MPUTCH(10, 2)
      SPWNIT = SSPAWN(IMAGE, BUF, PATH, 119)
      RETURN
      END
