Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-07 - decus/20-0170/froff.for
There is 1 other file named froff.for in the archive. Click here to see a list.
      BLOCK DATA
C     RENBR(RNOBLK/DECISION TREE FOR COMMAND RECOGNITION)
C
C     DONALD E. BARTH, YALE SCHOOL OF MANAGEMENT
C
C     THE VARIABLE NAMED LTRTAB CONTAINS THE TAB CHARACTER.
C     THIS   VARIABLE   IS   DEFINED  IN  FROFF  USING  THE
C     DECSYSTEM10/20  OCTAL  NOTATION,   A   DOUBLE   QUOTE
C     FOLLOWED  BY  THE  12 CHARACTER NUMBER, SINCE THE TAB
C     CHARACTER IS CONVERTED BY SOME VIDEO EDITORS  TO  THE
C     CORRESPONDING  NUMBER  OF SPACES.  LTRTAB CAN INSTEAD
C     BY DEFINED AS A SINGLE SPACE, EITHER 1H  OR  ' ',  ON
C     SYSTEMS  WHICH  DO  NOT  SUPPORT  THE  TAB CHARACTER.
C     LTRTAB IS DEFINED USING OCTAL NOTATION IN:
C      1.  THIS BLOCK DATA ROUTINE
C      2.  THE ROUTINES NAMED REFLAG AND REPART OF THE
C          DECSYSTEM10 USER INTERFACE
C      3.  THE ROUTINE NAMED RNOASK OF THE GENERAL USER
C          INTERFACE
C     THE ESCAPE CHARACTER  USED  TO  CONTROL  THE  DIABLO,
C     XEROX AND SPINWRITER TERMINALS IS DEFINED USING OCTAL
C     NOTATION IN THE ROUTINE NAMED RNOLIN.
C
C     THE DECISION TREE WHICH IS DEFINED BY THIS BLOCK DATA
C     ROUTINE IS USED BY THE RUNOFF PROGRAM FOR RECOGNIZING
C     COMMANDS.   THIS  DECISION  TREE  WAS PRODUCED BY THE
C     KEYWRD PROGRAM WHICH WAS  WRITTEN BY THE SAME AUTHOR.
C     THE 6 MAIN  ARRAYS IN THE KEYWRD PROGRAM MUST EACH BE
C     DIMENSIONED TO 1800.  ABOUT 40 CPU MINUTES ARE NEEDED
C     TO CONSTRUCT THIS PARSER.
C
      COMMON/RNOONE/I     ,IAPNDX,IBRFTN,IBYTE ,ICENTR,
     1ICHAPT,IDEBUG,IDEFER,IDFILE,IDFRFG,IDFRPG,IDISK ,
     2IFABAR,IFAUTO,IFENCE,IFFILL,IFFLAG,IFHEAD,IFLIST,
     3IFLOOP,IFLSUB,IFNATO,IFNBGN,IFNFIL,IFNGAP,
     4IFNGSP,IFNHAV,IFNIBR,IFNICN,IFNIDF,IFNIFA,IFNIIN,
     5IFNILF,IFNIND,IFNIRT,IFNISP,IFNJCN,IFNJDF,IFNJFL,
     6IFNJST,IFNKCN,IFNKDF,IFNKLM,IFNLBR,IFNLBS,IFNLOF,
     7IFNLSP,IFNMBR,IFNMFR,IFNMLF,IFNMNS,IFNMRT,
     8IFNNBR,IFNNIN,IFNNLF,IFNNOF,IFNNOT,IFNNRT,IFNNSK,
     9IFNNTF,IFNNTL,IFNNTR,IFNNTS,IFNNTT,IFNNT1,IFNNT2
      COMMON/RNOTWO/IFNNT3,IFNOFF,IFNOPN,IFNOTE,IFNPIN,
     1IFNPRD,IFNPSK,IFNPTS,IFNRBS,IFNRDY,IFNRED,IFNRIT,
     2IFNROF,IFNTTL,IFNULS,IFNUMB,IFPAGE,IFRSUB,IFSPLC,
     3IGAPHI,IGAPLO,IGROUP,IMINUS,INDENT,INDFTN,INIALL,
     4INIAPP,INIBAR,INICHA,INIFRM,INILIN,ININDX,ININXT,
     5INISPA,INITAL,INNOTE,INTIND,INTLFT,INTRIT,INTRVL,
     6IOFFST,IPEROD,IPGSHO,IQUOTE,IRANGE,IREVRS,IRTBAS,
     7IRTFTN,IRTOFF,IRUNIN,ISECTN,ISKFTN,ISKIP ,ISPACE,
     8ISTART,ISUBPG,ITLALL,ITLLIN,ITLNXT,ITLSPA,ITRMNL,
     9ITTY  ,IULSPC,IVALUE,IWIZRD,J     ,JCENTR,JDFRFG
      COMMON/RNOTHR/JDFRPG,JDISK ,JFILL ,JFNBGN,JFNGAP,
     1JFNOPN,JFNRED,JFNRIT,JGROUP,JMINUS,JOFFST,JRANGE,
     2JSECTN,JSKIP ,JSTIFY,JTTY  ,JVALUE,K     ,KAPITL,
     3KASALL,KASFLG,KASLCL,KCENTR,KDFRFG,KDISK ,KFNGAP,
     4KLMFIL,KLMMNS,KMINUS,KNDAPP,KNDCHA,KNDFIL,KNDLFT,
     5KNDLIN,KNDPAG,KNDRIT,KNDSPL,KNDSUB,KNDTRN,KNTARG,
     6KNTCOD,KNTFTN,KNTFXD,KNTLIN,KNTLOP,KNTLVL,KNTPAG,
     7KNTPNT,KNTRST,KNTSHO,KNTSPC,KNTSPL,KNTTOP,KNTXTR,
     8KOMAND,KOMENT,KONECT,KPYBGN,KPYKAS,KPYMID,KPYPRT,
     9KRANGE,KSKIP ,KVALUE,LCLBAR,LCLNDX,LCLSUP,KAPNDX
      COMMON/RNOFOU/LDISK ,LENGTH,LEVEL0,LEVEL1,LEVEL3,
     1LEVEL4,LFNGAP,LFTBAS,ILFFTN,LFTOFF,LFTRIT,LINFIG,
     2LINSPL,LITERL,LMTBGN,LMTCHA,LMTCOD,LMTFNR,LMTKAS,
     3LMTLST,LMTLVL,LMTMID,LMTNDX,LMTTAB,LMTTTL,LMTUNT,
     4LMTWRK,LNGBGN,LNGBOT,LNGCHA,LNGFNR,LNGFTN,LNGMID,
     5NXTFTN,LNGPAG,LNGSPL,LNGSRC,LNGTRN,LNGTTL,KNDNDX,
     6LOCABC,LOCATE,LOCPAG,LOCPNT,LOKSUP,LOWBFR,NSKIP ,
     7LRADJS,LRFORC,LSNSPL,LSNSRC,LSTAPP,LSTCHA,LSTELM,
     8LSTFRM,LSTSPL,LSTTRN,MAJOR ,MASTER,MAXBGN,MAXLIN,
     9MAXLOP,MAXSPL,MAXTAB,MAXWRD,MDISK ,MIDAPP,MIDCHA
      COMMON/RNOFIV/MINLVL,MINTOP,MOVBAC,MRGFAR,MRGLFT,
     1MRGRIT,MRGTOP,MRKAMP,MRKBAC,MRKBAR,MRKCAR,MRKDOL,
     2MRKDOT,MRKEFN,MRKEXC,MRKFTN,MRKLES,MRKNDX,MRKNUM,
     3MRKREF,MRKSBX,MRKSEM,MRKSUB,MRKSUP,MRKTTL,MRKTXT,
     4MRKUND,MSTLST,NDISK ,NDXDSK,NDXFOU,NDXHOW,NDXKNT,
     5NDXMAK,NDXONE,NDXOPN,NDXTHR,NDXTWO,NEEDED,NEWCHA,
     6NEWPAG,NOTFIL,NOTIND,NOTKLM,NOTLFT,NOTMNS,NOTONE,
     7NOTRIT,NOTSEM,NOTSKP,NOTSPC,NOTTHR,NOTTST,NOTTWO,
     8NOWBAR,NOWFTN,NOWIND,NOWLFT,NOWLST,NOWOFF,NOWPAG,
     9NOWPHW,NOWRIT,NOWSEC,NOWSHW,NOWSKP,NOWSPH,NOWSUB
      COMMON/RNOSIX/NOWTST,NULTTL,NUMFTN,NXTFIG,NXTHDR,
     1NXTLST,NXTLVL,NXTONE,NXTPAG,NXTSUB,KNDOUT,LNGWRK,
     2KAPFTN,KOFFST,IRECRD,KNTNDX,INIPAG,INIHIA,MAGNFY,
     3INIHIB,IFHALF,KTRMNL,ITTLLO,ISUBLO,LNGTOP,MAGFNT,
     4ITTLHI,ISUBHI,IFINDX,IXTRSS,JXTRSS,KXTRSS,MAGSPC,
     5MXTRSS,NXTRSS,IFORMR,JTRMNL,IFNREF,IFNNUM,KMPPAG,
     6KMPLIN,KMPCLM,KMPVAL,INICLM,MFNGAP,NFNGAP,MAGSAV,
     7MAGSHD,MAGHIH,MRKMAG,LMTSHD,LNGSHD,LFTSHD,IRISHD,
     8IHISHD,ILOSHD,KNTSHD,LFTSGN,IRISGN,NGLSHD,NETNGL,
     9NETSEP,NETWID,NETOFF,NETKNT,KNTEDT,LMTEDT,LMTBIG,
     1LNGBIG,NGLBIG,KNTBIG,NXTSKP,JBORDR,INIMAG,INIOBJ,
     2IBORDR
      COMMON/RNOEIG/INDLST(10)  ,KMDARG(250) ,KMDBRK(250) ,
     1 KNDLVL(6)   ,KNDTTL(16)  ,LOCTAB(32)  ,LSTMRG(10)  ,
     2 LSTRIT(10)  ,LSTSKP(10)  ,LSTSPC(10)  ,LSTTTL(80)  ,
     3 LSTTYP(10)  ,LSTVAL(10)  ,MCHPNT(1300),MSKBGN(300) ,
     4 MSKCHA(200) ,MSKFNR(200) ,MSKFTN(200) ,MSKMID(200) ,
     5 MSKTTL(450) ,NARGMT(44)  ,NBEGIN(19)  ,NMINUS(32)  ,
     6 NOTPNT(1300),NUMLVL(6)   ,NUMNDX(300) ,NUMTTL(11)  ,
     7 NVALUE(32)  ,NXTCMD(81)  ,NXTPNT(12)  ,NXTUNT(4)   ,
     8 MSKWRK(200) ,MTYSTR(4)   ,MAGEDT(50)
      COMMON/RNONIN/LTRAMP,LTRBAC,LTRBAR,LTRCAR,LTRCOM,
     1LTRDOL,LTRDOT,LTREFN,LTREXC,LTRFNC,LTRLES,
     2LTRMNS,LTRNDX,LTRNOW,LTRNUM,LTRPLS,LTRQUO,LTRRUL,
     3LTRSBX,LTRSEM,LTRSPA,LTRSUB,LTRSUP,LTRTAB,
     4LTRPUT,LTRTXT,LTRUND,LTR1ST,LTRMAG
      COMMON/RNOTEN/LTRABC(26)  ,LTRAPP(9)   ,LTRBGN(300) ,
     1 LTRCPT(8)   ,LTRCLS(10)  ,LTRCOD(70)  ,LTRDGT(10)  ,
     2 LTRFLG(18)  ,LTRFTN(200) ,LTRIND(5)   ,LTRLST(10,6),
     3 LTRMID(200) ,LTRONL(26)  ,LTRONU(26)  ,LTROPN(10)  ,
     4 LTRPAG(5)   ,LTRREF(4)   ,LTRSPL(200) ,LTRTWO(4)   ,
     5 LTRTYP(8)   ,LTRWRK(200) ,LWRABC(26)  ,LWRAPP(9)   ,
     6 LWRCHA(8)   ,LWRIND(5)   ,LWRONL(26)  ,LWRONU(26)  ,
     7 LWRTYP(8)   ,LTRTTL(450) ,LTRCHA(200) ,LTRFNR(200) ,
     8 LTRSHD(50)  ,LTRBIG(50)
C
C     ARRAYS USED IN DATA STATEMENTS TO CONSTRUCT KMDARG AND
C     KMDBRK ARRAYS
      DIMENSION IAR001(100),IAR101(100),IAR201(50)
      DIMENSION IBR001(100),IBR101(100),IBR201(50)
      EQUIVALENCE (KMDARG(1),IAR001(1)),(KMDARG(101),IAR101(1)),
     1(KMDARG(201),IAR201(1))
      EQUIVALENCE (KMDBRK(1),IBR001(1)),(KMDBRK(101),IBR101(1)),
     1(KMDBRK(201),IBR201(1))
C
C     ARRAY CONTAINING CHARACTERS IN ORDER IN WHICH THESE
C     ARE TO BE SORTED IN INDEX.  THIS ARRAY IS DIMENSIONED
C     AT KNTFXD.
      DIMENSION LTRFXD(10)
      EQUIVALENCE (LTRCOD(1),LTRFXD(1))
C
C     COMMAND 1 IS FOR ALL AMBIGUOUS ABBREVIATIONS OF WHICH
C     LEFT CHARACTERS HAVE BEEN DEFINED AS ANOTHER COMMAND
C     ***** INSERT KEYWRD OUTPUT HERE *****
C     2 B
C     2 BL
C     2 BLA
C     2 BLAN
C     2 BLANK
C     3 BR
C     3 BREAK
C     4 C
C     4 CE
C     4 CEN
C     4 CENT
C     4 CENTE
C     4 CENTR
C     4 CENTER
C     4 CENTRE
C     WHEN THERE WAS AN .END FIELD COMMAND, EVEN PUTTING
C     EFI IN EXPLICITLY HERE DID NOT CAUSE IT TO BE KNOWN
C     5 END FILE
C     6 F
C     6 FI
C     6 FIL
C     6 FILL
C     7 FL
C     7 FLA
C     7 FLAG
C     7 FLAGS
C     7 FLAGS ALL
C     8 FLAGS C
C     8 FLAGS CAPITALIZE
C     9 T
C     9 TITLE
C     10 FLAGS CONTROL
C     11 FLAGS LOWER CASE
C     12 FLAGS QUOTE
C     13 FLAGS SPACE
C     14 FLAGS UPPER CASE
C     15 ST
C     15 SUBTITLE
C     15 ST
C     16 I
C     16 IN
C     16 IND
C     16 INDE
C     16 INDEN
C     16 INDENT
C     17 INPUT WIDTH
C     18 PG
C     18 PAG
C     18 PAGE
C     19 J
C     19 JUSTIFY
C     20 LEFT MARGIN
C     21 TP
C     21 TEST PG
C     21 TEST PAGE
C     NOTE THAT .LO SELECTS .LOOP COMMAND
C     22 LOWER CASE
C     23 NO F
C     23 NO FILL
C     24 NO FL
C     24 NO FLA
C     24 NO FLAG
C     24 NO FLAGS
C     24 NO FLAGS ALL
C     25 NO FLAGS C
C     25 NO FLAGS CAPITALIZE
C     26 NU
C     26 NUM
C     26 NUMB
C     26 NUMBE
C     26 NUMBER
C     26 NM
C     26 NM PG
C     26 NUMBER PG
C     26 NM PAGE
C     26 NUMBER PAGE
C     27 NO FLAGS CONTROL
C     28 NO FLAGS LOWER CASE
C     29 NO FLAGS QUOTE
C     30 NO FLAGS SPACE
C     31 NO FLAGS UPPER CASE
C     32 NJ
C     32 NO JUSTIFY
C     INCLUDING EXPLICIT REFERENCE TO .NONUMBER CAUSES
C     .NONUMBER FOOTNOTES NOT TO BE RECOGNIZED.
C     33 NO N
C     33 NO NU
C     33 NO NUM
C     33 NO NUMB
C     33 NO NUMBE
C     33 NO NUMBER
C     33 NO NM
C     FOLLOWING PREVENTS CONFLICT WITH .OMIT PAGE
C     34 O
C     34 OF
C     34 OFF
C     34 OFFS
C     34 OFFSE
C     34 OFFSET
C     35 HD
C     35 H
C     35 HE
C     35 HEA
C     35 HEAD
C     35 HEADE
C     35 HEADER
C     35 HEADERS
C     35 HEADERS ON
C     35 HEADI
C     35 HEADIN
C     35 HEADING
C     35 HEADINGS
C     35 HEADINGS ON
C     36 P
C     NOTE THAT PA IS ABBREVIATION FOR PAGING
C     36 PARAGRAPH
C     37 NO HD
C     37 NO HEADERS
C     37 NO HEADINGS
C     38 PS
C     38 PG SIZE
C     38 PAGE SIZE
C     38 PAPER SIZE
C     38 PG LENGTH
C     38 PAGE LENGTH
C     39 RE
C     39 RES
C     39 RESE
C     39 RESET
C     40 RIGHT MARGIN
C     41 S
C     41 SK
C     41 SKI
C     41 SKIP
C     42 SP
C     42 SPA
C     42 SPAC
C     42 SPACI
C     42 SPACIN
C     42 SPACING
C     43 CARRIAGE
C     44 UPPER CASE
C     45 FN
C     45 FO
C     45 FOO
C     45 FOOT
C     45 FOOTN
C     45 FOOTNO
C     45 FOOTNOT
C     45 FOOTNOTE
C     45 FOOTNOTES
C     46 E F
C     46 EN F
C     46 END F
C     46 E FN
C     46 EN FN
C     46 END FN
C     46 EF
C     46 ENF
C     46 ENDF
C     46 EFN
C     46 ENFN
C     46 ENDFN
C     46 END FOOTNOTES
C     47 FLAGS COMMENT
C     48 FLAGS END COMMAND
C     49 FN HEADER
C     49 FOOTNOTES HEADER
C     50 NO FLAGS COMMENT
C     51 NO FLAGS END COMMAND
C     52 NO FN HEADER
C     52 NO FOOTNOTES HEADER
C     53 CH
C     53 CHAPTER
C     54 SX
C     54 SUBINDEX
C     54 X
C     54 INDEX
C     .DX COULD BE .DISPLAY X OR .DISABLE X
C     55 DX
C     55 DO X
C     55 DO I
C     55 DO IN
C     55 DO IND
C     55 DO INDE
C     55 DO INDEX
C     56 AX
C     56 APPENDIX
C     57 DISPLAY CH
C     57 DISPLAY CHAPTER
C     58 DISPLAY NM
C     58 DISPLAY NUMBER
C     58 DISPLAY PG
C     58 DISPLAY PAGE
C     59 NMCH
C     59 NM CH
C     59 NM CHAPTER
C     59 NUMBER CH
C     59 NUMBER CHAPTER
C     60 DISPLAY AX
C     60 DISPLAY APPENDIX
C     61 NMAX
C     61 NM AX
C     61 NM APPENDIX
C     61 NUMBER AX
C     61 NUMBER APPENDIX
C     62 NO OFFSET
C     FOLLOWING PREVENTS CONFLICT WITH .LOWER CASE
C     63 LO
C     63 LOOP
C     64 END LOOP
C     65 SPLICE
C     66 END SPLICE
C     67 SIMULATE SPLICE
C     68 LS
C     68 LI
C     68 LIS
C     68 LIST
C     69 LE
C     69 LS ELEMENTS
C     69 LIST ELEMENTS
C     70 ELS
C     70 END LS
C     70 END LIST
C     71 NM LS
C     71 NM LIST
C     71 NUMBER LST
C     71 NUMBER LIST
C     71 NM ELEMENTS
C     71 NUMBER ELEMENTS
C     FOLLOWING PREVENTS CONFLICT WITH .DEBUG
C     72 DE
C     FOLLOWING PREVENTS CONFLICT WITH .DISPLAY LEVELS
C     72 DISPLAY LE
C     72 DISPLAY LIST ELEMENTS
C     72 DISPLAY LS ELEMENTS
C     72 DISPLAY ELEMENTS
C     73 COMMENT
C     74 COLLECT FN
C     74 COLLECT FOOTNOTES
C     .DFN COULD BE .DISPLAY FOOT NOTE
C     IN AN EARLIER VERSION OF THIS PROGRAM IN WHICH
C     THE ABBREVIATION FN OF FOOTNOTE WAS OBTAINED BY
C     SEPARATING THE WORDS FOOT AND NOTE, THE FOLLOWING
C     SEQUENCE OF DEFINITIONS SERVED TO PREVENT .DFN
C     FROM BEING RECOGNIZED AS DISPLAY FOOTNOTE
C     *    75 DO F
C     *    75 DO FO
C     *    75 DO FOO
C     *    75 DO FOOT
C     *    75 DO FOOT N
C     *    75 DO FOOT NO
C     *    75 DO FOOT NOT
C     *    75 DO FOOT NOTE
C     *    75 DO FOOT NOTES
C     *    169 DISPLAY FOOT NOTES
C     AN EXTREME AMOUNT OF TROUBLE WAS ENCOUNTERED WHEN
C     I CHOSE TO HAVE FN AND FOOTNOTE APPEAR EXPLICITY,
C     RATHER THAN HAVE THE WORDS FOOT AND NOTE SEPARATE.
C     THE ONLY METHOD THAT I FOUND TO WORK WAS TO HAVE
C     THE F AND N IN DISPLAY FN BE SEPARATED INTO 2 WORDS
C     AS IN THE FOLLOWING
C     *    75 DO FN
C     *    75 DO FOOTNOTES
C     *    169 DISPLAY F N
C     *    169 DISPLAY FOOTNOTES
C     75 DO FN
C     75 DO FOOTNOTES
C     76 FLAGS END FN
C     76 FLAGS END FOOTNOTES
C     77 NO FLAGS END FN
C     77 NO FLAGS END FOOTNOTES
C     78 FLAGS UNDERLINE
C     78 FLAGS UL
C     79 NO FLAGS UNDERLINE
C     79 NO FLAGS UL
C     FOLLOWING PREVENTS CONFLICT WITH .APPENDIX
C     80 AP
C     80 AUTO PARAGRAPH
C     FOLLOWING PREVENTS CONFLICT WITH .NUMBER APPENDIX
C     81 NO AP
C     81 NO AUTO PARAGRAPH
C     NOTE THAT IFN IS ABBREVIATION FOR INDENT FOOTNOTES
C     82 IMMEDIATE FN
C     82 IMMEDIATE FOOTNOTES
C     83 SPACE FN
C     83 SPACE FOOTNOTES
C     84 INDENT LEVELS
C     84 INDENT LV
C     85 LT
C     85 LITERAL
C     86 EL
C     86 END LT
C     86 END LITERAL
C     87 RESET ALL
C     TS COULD ALSO SELECT TEST SPACING
C     88 TAB S
C     88 TAB STOPS
C     89 HL
C     89 HD LEVEL
C     89 HEADER L
C     89 HEADER LEVEL
C     90 NM LEVELS
C     90 NM LV
C     90 NUMBER LEVELS
C     90 NUMBER LV
C     91 STYLE HD
C     91 STYLE HEADERS LEVELS
C     91 STYLE LEVELS
C     92 DISPLAY HEADERS LEVELS
C     92 DISPLAY LEVELS
C     93 SPACE LEVELS
C     93 SPACE HEADERS LEVELS
C     94 PRINT FN
C     94 PRINT FOOTNOTES
C     95 NT
C     95 NOTE
C     96 END NT
C     96 EN
C     96 END NOTE
C     97 SPACE NT
C     97 SPACE NOTES
C     98 DEBUG
C     99 TEST SPACE
C     99 TEST SPACING
C     100 EB BAR
C     100 ENABLE BAR
C     101 BEGIN B
C     101 BEGIN BAR
C     .EB COULD ALSO BE .ENABLE BAR
C     102 EB
C     102 END B
C     102 END BA
C     102 END BAR
C     103 DB BAR
C     103 DISABAR
C     103 DISABLE BAR
C     104 FLAGS TEXT
C     105 NO FLAGS TEXT
C     106 FG
C     106 FIG
C     106 FIGU
C     106 FIGUR
C     106 FIGURE
C     107 FLAGS X
C     107 FLAGS INDEX
C     108 NO FLAGS X
C     108 NO FLAGS INDEX
C     109 SD
C     109 STANDARD
C     110 FG DEFERRED
C     110 FIGURE DEFERRED
C     111 R
C     111 RI
C     111 RIG
C     111 RIGH
C     111 RIGHT
C     112 LEFT NO FILL
C     113 CENTER NO FILL
C     113 CENTRE NO FILL
C     114 RIGHT NO FILL
C     115 LAST FORM
C     116 FT
C     116 FIRST TITLE
C     DEFINING THE .SPG COMMAND TO  MEAN  .SUBPAGE  TOOK  A
C     GREAT  DEAL  OF  FIDDLING.   THIS WAS DUE TO THE FACT
C     THAT .SPG COULD ALSO MEAN .SHOW PAGE OR  .SKIP  PAGE.
C     ALL  OF  MY  ATTEMPTS TO DEFINE .SUBPAGE WITH ENTRIES
C     SIMILAR TO
C          117 SPG
C          117 SUB PG
C          117 SUB PAGE
C     RESULTED IN .SPG BEING RECOGNIZED AS .SPACING.  SINCE
C     .SUBPAGE IS A SINGLE WORD, AND WOULD NEVER BE WRITTEN
C     AS 2 WORDS, THE SOLUTION TO THIS  WAS  TO  WRITE  OUT
C     EACH ABBREVIATION, AND THEN TO DECOUPLE THE RIGHT END
C     OF EACH OF THESE ABBREVIATIONS FROM  THE  .SHOW  PAGE
C     AND  .SKIP  PAGE COMMANDS BY ADDING AN EXTRA S TO THE
C     END OF THE .SUBPAGE ABBREVIATIONS.  TO MARK  .SPG  AS
C     BEING ENOUGH, RATHER THAN .SPGS WHICH THE USERS WOULD
C     NEVER BE TOLD ABOUT, I PUT IN EXTRA ENTRIES ALSO  FOR
C     THE  ABBREVIATIONS  WITHOUT  THE FINAL LETTER S.  THE
C     .SPAG ENTRY WAS  PUT  IN  SINCE  THIS  SHOULD  BE  AN
C     ABBREIVATION IF .SPAGE IS ALLOWED.
C     117 SPG
C     117 SUPG
C     117 SUBPG
C     117 SPAG
C     117 SPAGE
C     117 SUPAGE
C     117 SUBPAGE
C     117 SPGS
C     117 SUPGS
C     117 SUBPGS
C     117 SPAGES
C     117 SUPAGES
C     117 SUBPAGES
C     118 ES
C     118 END SPG
C     118 END SUBPAGE
C     119 NM SPG
C     119 NUMBER SPG
C     119 NM SUBPAGE
C     119 NUMBER SUBPAGE
C     120 SPACE CH
C     120 SPACE CHAPTERS
C     FOLLOWING PREVENTS CONFLICT WITH .SPACE X
C     121 SPAX
C     121 SPACE AX
C     121 SPACE APPENDIXES
C     122 FIRST FORM FEED
C     123 DISPLAY SECTION
C     124 DISPLAY SPG
C     124 DISPLAY SUBPAGE
C     125 PR
C     125 PERIOD
C     126 NPR
C     126 NO PR
C     126 NO PERIOD
C     127 PA
C     127 PAGING
C     AN ENTRY OF .NPA HERE DID NOT WORK (BUG?)
C     128 NO PA
C     128 NO PAG
C     128 NO PAGI
C     128 NO PAGIN
C     128 NO PAGING
C     129 FLAGS SX
C     129 FLAGS SUBINDEX
C     130 NO FLAGS SX
C     130 NO FLAGS SUBINDEX
C     131 Y
C     131 ENTRY
C     132 PX
C     132 PRINT X
C     132 PRINT INDEX
C     133 DISPLAY X
C     133 DISPLAY INDEX
C     134 SPACE X
C     134 SPACE INDEX
C     135 FORCE PG
C     135 FORCE PAGE
C     135 FP
C     135 FPG
C     135 FPA
C     135 FPAG
C     135 FPAGE
C     135 F P
C     135 F PG
C     135 F PA
C     135 F PAG
C     135 F PAGE
C     136 SHOW PG
C     136 SHOW PAGE
C     137 OMIT PG
C     137 OMIT PAGE
C     138 FLAGS PG
C     138 FLAGS PAGE
C     139 NO FLAGS PG
C     139 NO FLAGS PAGE
C     140 LEFT PAGE
C     140 LEFT PG
C     141 RIGHT PAGE
C     141 RIGHT PG
C     142 LEFT TOP TITLE
C     143 RIGHT TOP TITLE
C     144 LEFT TOP SUBTITLE
C     144 LEFT TOP ST
C     145 RIGHT TOP SUBTITLE
C     145 RIGHT TOP ST
C     146 TOP TITLE
C     147 TOP SUBTITLE
C     147 TOP ST
C     TST COULD ALSO BE TAB STOPS
C     147 TOP S T
C     147 TOP ST
C     148 LEFT BOTTOM TITLE
C     149 RIGHT BOTTOM TITLE
C     150 LEFT BOTTOM SUBTITLE
C     150 LEFT BOTTOM ST
C     151 RIGHT BOTTOM SUBTITLE
C     151 RIGHT BOTTOM ST
C     152 BOTTOM TITLE
C     153 BOTTOM SUBTITLE
C     153 BOTTOM ST
C     154 SPACE TOP
C     155 SPACE BOTTOM
C     156 ENABLE INDEX
C     156 ENABLE X
C     156 EIX
C     .DIX COULD BE .DISPLAY X
C     157 DIX
C     157 DISX
C     157 DISABLE INDEX
C     157 DISABLE X
C     158 RULE
C     159 TERMINAL
C     160 TELL
C     160 TE
C     160 TEL
C     160 TL
C     161 SKIP LEFT PAGE
C     161 SKIP LEFT PG
C     162 SKIP RIGHT PAGE
C     162 SKIP RIGHT PG
C     163 SKIP PAGE
C     163 SKIP PG
C     164 FLAGS TABS
C     165 NO FLAGS TABS
C     .N FOOT NOTES   COULD BE   .NO FOOT NOTES HEADER
C     166 NUMBER FN
C     166 NUMBER FOOTNOTES
C     166 NM FN
C     166 NM FOOTNOTES
C     167 NO NUMBER FN
C     167 NO NM FN
C     167 NO NUMBER FOOTNOTES
C     167 NO NM FOOTNOTES
C     PREVENT CONFLICT WITH .IMMEDIATE FOOTNOTES AND IF NOT
C     168 IFN
C     168 INDENT FN
C     168 INDENT FOOTNOTES
C     169 DISPLAY F N
C     169 DISPLAY FOOTNOTES
C     170 DISPLAY R
C     170 DISPLAY RE
C     170 DISPLAY REF
C     170 DISPLAY REFE
C     170 DISPLAY REFER
C     170 DISPLAY REFERE
C     170 DISPLAY REFEREN
C     170 DISPLAY REFERENC
C     170 DISPLAY REFERENCE
C     170 DISPLAY REFERENCES
C     171 JO
C     171 JOIN
C     172 INDENT LISTS
C     172 INDENT LS
C     172 INDENT ELEMENTS
C     173 OPEN SPLICE
C     174 FN RULE
C     174 FOOTNOTES RULE
C     175 INITIAL PAGE
C     175 INITIAL PG
C     176 NO TITLE
C     177 NO ST
C     177 NO SUBTITLE
C     177 NO ST
C     178 OFFSET LEFT PAGES
C     178 OFFSET LEFT PG
C     179 OFFSET RIGHT PAGES
C     179 OFFSET RIGHT PG
C     180 U
C     180 UL
C     180 UNDERLINE
C     181 LV
C     181 LEVELS
C     182 UNDERLINE SPACES
C     182 UL SPACES
C     .NULS COULD BE AN ABBREVIATION FOR .NUMBER LIST
C     WHICH ORIGINALLY HAD THE ALIAS .NUMBER LS
C     TO REMOVE THIS CONFLICT, THE KEYWRD INPUT WAS
C     CHANGED SO .NUMBER LS BECAME .NUMBER LST
C     WITH THIS CHANGE, .NUMBER LS IS STILL RECOGNIZED
C     AS .NUMBER LIST, BUT .NULS IS RECOGNIZED
C     AS .NO UNDER LINE SPACE
C     183 NULS
C     183 NO UNDERLINE SPACES
C     183 NO UL SPACES
C     184 INDENT NOTES
C     184 INDENT NT
C     184 INT
C     185 LEFT EDGE
C     185 LED
C     185 LEDG
C     185 LEDGE
C     186 RIGHT EDGE
C     187 END OBJECT
C     188 LETTER
C     188 LTR
C     189 NO LEFT PAGES
C     189 NO LEFT PG
C     190 NO RIGHT PAGES
C     190 NO RIGHT PG
C     191 MOVABLE FIGURE
C     191 MOVABLE FG
C     192 MOVABLE PAGES
C     192 MOVABLE PG
C     193 FLAGS HALF UP
C     194 NO FLAGS HALF UP
C     195 FLAGS HALF DOWN
C     196 NO FLAGS HALF DOWN
C     197 STYLE INDEX
C     197 STYLE X
C     198 BOLD
C     199 FLAGS BOLD
C     200 NO FLAGS BOLD
C     201 SEQUENCE
C     202 SECTION
C     202 SE
C     203 NUMBER SECTION
C     203 NM SECTION
C     204 BULLET
C     205 IGNORE SPLICE
C     206 VERSION
C     207 IF
C     208 IF NOT
C     209 END IF
C     210 ELSE
C     211 FLAGS OVER STRIKE
C     212 NO FLAGS OVER STRIKE
C     213 BACKGROUND
C     213 BG
C     214 OUTLINE
C     214 OL
C     217 SQUEEZE
C     218 FLAGS LETTER
C     218 FLAGS LTR
C     219 NO FLAGS LETTER
C     219 NO FLAGS LTR
C     220 PG WIDTH
C     220 PAGE WIDTH
C     221 FACING PAGE
C     221 FACING PG
C
C     FINAL STORAGE USED=1226, MOST USED=15075, LIMIT=18600
C
C     CHECKSUMS 2701,6822,1125, 123,6246
C     DIMENSION MCHPNT(1226)
      DIMENSION MCHPN1(83),MCHP84(79),MCH163(79),
     1MCH242(78),MCH320(79),MCH399(76),MCH475(81),
     2MCH556(81),MCH637(95),MCH732(87),MCH819(82),
     3MCH901(85),MCH986(79),MC1065(83),MC1148(79)
      EQUIVALENCE (MCHPN1(1),MCHPNT(1)),
     1(MCHP84(1),MCHPNT(84)),(MCH163(1),MCHPNT(163)),
     2(MCH242(1),MCHPNT(242)),(MCH320(1),MCHPNT(320)),
     3(MCH399(1),MCHPNT(399)),(MCH475(1),MCHPNT(475)),
     4(MCH556(1),MCHPNT(556)),(MCH637(1),MCHPNT(637)),
     5(MCH732(1),MCHPNT(732)),(MCH819(1),MCHPNT(819)),
     6(MCH901(1),MCHPNT(901)),(MCH986(1),MCHPNT(986)),
     7(MC1065(1),MCHPNT(1065)),(MC1148(1),MCHPNT(1148))
C     DIMENSION NOTPNT(1226)
      DIMENSION NOTPN1(86),NOTP87(80),NOT167(86),
     1NOT253(83),NOT336(82),NOT418(81),NOT499(81),
     2NOT580(84),NOT664(85),NOT749(87),NOT836(82),
     3NOT918(81),NOT999(84),NO1083(82),NO1165(62)
      EQUIVALENCE (NOTPN1(1),NOTPNT(1)),
     1(NOTP87(1),NOTPNT(87)),(NOT167(1),NOTPNT(167)),
     2(NOT253(1),NOTPNT(253)),(NOT336(1),NOTPNT(336)),
     3(NOT418(1),NOTPNT(418)),(NOT499(1),NOTPNT(499)),
     4(NOT580(1),NOTPNT(580)),(NOT664(1),NOTPNT(664)),
     5(NOT749(1),NOTPNT(749)),(NOT836(1),NOTPNT(836)),
     6(NOT918(1),NOTPNT(918)),(NOT999(1),NOTPNT(999)),
     7(NO1083(1),NOTPNT(1083)),(NO1165(1),NOTPNT(1165))
      DATA KNTPNT,KNTXTR/ 1226,    0/
      DATA MCHPN1/1229,98163,98794,69335,98788,68712,98793,
     12463,261361,261362,261363,261364,261365,261366,
     2262056,123944,123945,123946,123947,123969,261351,
     32477,2478,2479,2454,1254,243996,1256,1257,1258,1270,
     4187764,187731,3716,3717,3718,3681,250347,250348,
     5251116,123969,124657,188697,187694,4954,52808,52809,
     652810,53589,4959,4960,4961,4962,4976,4964,4976,65089,
     765669,1287,90859,90860,90861,90862,91202,90261,91809,
     891809,139608,1297,126452,127111,126571,88418,120321,
     9121427,88985,1305,67564,67606,1308,1309,1310,127111/
      DATA MCHP84/1312,1315,74221,73620,126571,193751,
     1192639,1319,1320,1321,1322,74220,73746,70069,88984,
     2207498,113986,164303,1370,71318,72338,208748,1395,
     3163191,192639,73746,126571,70069,88984,207498,113986,
     41112,1344,93036,67604,67605,67606,67607,67485,67485,
     567485,73746,74221,73620,126571,70069,70070,70577,
     688984,1361,92025,1096,207363,113986,67624,67625,
     767626,68600,1370,88488,88985,114004,88491,88492,
     888494,88494,88984,71318,71166,71320,71321,71892,
     972338,208748,208749,208750,208751,208752,208753/
      DATA MCH163/208754,208755,208756,208590,1395,151743,
     1153329,152765,1399,125327,125884,122890,56654,191589,
     2256443,192525,105702,1447,79668,86073,257670,117977,
     31413,1414,1415,1416,122890,730,192524,1420,56654,
     4125349,125350,125154,56654,256642,256443,1446,118018,
     5229677,1460,56654,160943,161522,144994,1461,125364,
     6125884,56654,7327,56442,57538,1443,256443,192525,
     71446,220,86907,106005,79668,85890,105522,118018,
     8118540,229677,229678,229679,229680,230466,1460,234,
     9144786,82119,145403,191412,7601,271407,271408,271409/
      DATA MCH242/271410,272300,9745,130313,7609,130310,
     1130311,130312,130313,135282,7615,7362,132402,1483,
     21484,1486,135282,150017,143522,8851,8852,8853,8854,
     39549,244852,10123,1545,1497,1558,132401,1568,259630,
     4170498,15470,1581,1505,201986,128368,55504,55497,
     555498,55499,55500,55501,55502,55503,55504,60798,
     6213850,165937,165938,166778,214690,259631,60798,
     7166817,213850,259634,165946,165947,165994,142690,
     89549,244852,10123,10499,1536,58359,12964,135282,
     9135283,135284,135285,135286,135298,1545,319,320/
      DATA MCH320/59597,94263,150017,150018,150019,150020,
     1150021,150022,1050,1557,331,332,333,239982,237952,
     260837,239982,237149,236811,132401,1568,268210,14225,
     3268216,14706,259630,1574,348,349,169326,15470,213850,
     4214690,1581,16702,159036,158283,1585,201986,128368,
     5143523,1589,95706,96470,18382,18387,131289,43313,
     643314,109585,43316,43317,43318,43319,43320,43330,
     743322,43323,43324,43330,109585,109585,109586,109587,
     8110359,44169,20019,254377,206527,1096,255607,256233,
     9251928,251929,251930,252527,101011,101012,101013/
      DATA MCH399/101014,101015,101016,101017,101018,1011,
     120038,20039,20040,20041,20045,66258,211684,206567,
     2211684,207147,1666,226784,215143,215144,215145,
     3215146,215858,256233,21283,215898,214725,21286,21310,
     4225768,211684,206567,206136,1666,226784,215897,
     5211684,1664,100614,1666,104178,211485,211689,211044,
     6103068,1672,446,447,226985,225768,215897,252670,
     721778,23766,210271,211041,24094,1684,141563,141564,
     8141565,141615,85125,227458,227459,226995,1693,1694,
     91695,1724,85304,231147,1744,231149,231406,177208/
      DATA MCH475/1190,223207,1723,227945,83916,83917,
     183926,104778,484,1155,77787,78442,28199,28203,83926,
     285303,104787,1744,230676,222087,1723,1724,1725,1726,
     31727,1728,185016,184553,184050,182786,28203,1734,
     4228168,85304,141615,141616,142190,25492,138381,
     5172952,1743,517,518,177654,177208,176688,175424,1750,
     61751,1752,1753,1754,1755,1756,234887,234357,234889,
     7234890,234891,235568,236459,1764,40044,32441,75447,
     873029,75447,73029,87757,204693,1773,111540,87908,
     987117,1777,117116,116565,99940,99941,100021,100015/
      DATA MCH556/28778,28869,30098,64476,64365,64470,
     1260858,64479,46170,40044,232769,41288,76879,1797,
     2157627,157869,155496,234000,218145,155412,117142,
     3217143,32481,225121,111540,87908,225124,225755,
     4110430,32488,32489,32490,32491,75447,73029,87757,
     5204693,1833,33074,1823,249903,147194,225375,75447,
     6601,623,73029,87757,204693,1833,111540,87908,88134,
     7110430,33074,1839,249903,1841,225756,146013,146630,
     8618,828,1847,100008,100021,75470,624,625,626,1115,
     9100015,629,630,633,74847,100020,634,888,73029,73030/
      DATA MCH637/73031,725,87757,641,642,643,644,645,1217,
     128868,28869,29377,30098,30099,30100,30101,30408,
     2246079,31357,1925,1885,1936,133628,1950,260857,
     3171725,1899,1892,1893,667,668,669,670,671,672,64479,
     4260858,64479,714,260861,30408,246079,680,1050,31357,
     531358,684,685,686,687,917,1916,62040,691,692,1017,
     633823,695,696,1156,1925,1926,1927,63278,702,703,704,
     7705,1050,95490,1935,1936,1937,1938,241209,239179,
     864518,715,726,241209,718,1224,238758,238038,133628,
     91950,269437,725,726,730,35084,1205,269443,0,35565/
      DATA MCH732/260857,734,735,736,737,738,739,740,1211,
     1171295,171296,171297,170553,36329,747,748,1211,1977,
     237561,1138,160263,754,1112,159510,1984,203213,1217,
     3129595,1017,1989,96933,97697,765,766,862,39241,39246,
     4132516,46170,45399,46172,46173,46174,46491,46176,
     546177,46616,40044,40045,782,783,784,785,0,2014,788,
     6232776,111550,87908,88134,87910,87117,110430,232778,
     741288,41294,41290,41291,41292,41293,41294,205920,
     876879,76880,76881,76882,1017,2037,157867,157868,
     931902,157870,157871,157056,155496,31902,154602/
      DATA MCH819/234000,2048,249903,975,147194,217179,
     12053,827,146841,1173,218369,217142,225373,225382,
     2225375,225376,225377,225378,225379,225380,225381,
     3225382,225754,42561,42562,42563,42564,42565,42566,
     4219272,220503,263429,219273,219281,168953,169231,
     5213127,169272,213129,213265,168099,263439,263440,863,
     6864,1211,219272,867,873,169271,220503,871,872,873,
     7874,875,876,1216,213406,45051,156709,22967,22984,
     8157009,47510,47511,47512,47543,45060,889,890,891,892,
     9922,154269,895,896,1050,22984,47539,47543,270859/
      DATA MCH901/154277,2130,2131,2132,116349,163076,
     147534,47669,161964,116349,163076,47539,47540,47541,
     247547,47543,1043,270859,920,921,922,0,161964,137122,
     348779,229395,48781,48782,48783,107709,137129,137130,
     4137131,137132,2163,2168,195058,107709,2167,2168,2169,
     52170,2171,2172,186243,186224,185277,184013,229172,
     61173,50032,953,954,955,1224,140835,958,959,960,1156,
     7174179,2190,964,965,178881,0,178883,177915,1186,
     8176651,51279,133743,248828,248829,1222,247604,247605,
     9247606,247765,167853,111657,1103,167856,168005,1109/
      DATA MCH986/83196,83197,83198,83199,83200,83201,994,
     11113,1135,51303,51304,51305,198546,198547,198679,
     2201173,199903,52538,52539,52540,2234,149496,191266,
     3148327,102852,0,115213,165530,115220,120035,1125,0,
     452553,52554,165532,51534,144626,148467,149539,144628,
     580782,115221,149496,149540,191266,148327,102935,
     6115213,165530,115220,120143,190098,164418,267299,
     7267300,267301,267302,1211,19450,134789,134790,134791,
     8134792,134793,0,190099,2280,2281,2282,112758,242831,
     9112766,241719,2287,2288,67370,144624,19595,144624/
      DATA MC1065/144625,144626,144628,144628,143559,66258,
     1149539,149540,149541,149542,149543,149544,149545,
     2149683,148467,191266,191267,191268,191269,191270,0,
     3148327,148328,148329,148330,148331,148332,1217,
     4102935,101841,1096,1097,1098,1099,1125,2328,111657,
     51103,1104,1105,1106,1107,1108,1109,1110,1120,1112,
     61113,1114,1115,0,2344,1118,198679,1120,1121,1217,
     7198719,120143,120144,1216,119019,1172,199903,199904,
     8199905,199906,1133,1172,83344,1136,1137,1138,1211,
     9190098,1141,0,0,12187,109121,109122,109123,109159/
      DATA MC1148/197469,197470,196320,196245,196246,
     1196247,196248,1156,0,2385,2386,26939,122634,122649,
     212234,196320,2392,2393,181536,180369,26936,26940,
     325767,26939,1173,1211,109151,122649,122650,122651,
     4121473,122653,1181,0,181552,109160,109193,181555,
     51187,1190,180369,180332,1191,1192,1211,222054,222072,
     62423,2424,2425,2426,2427,2428,2429,222072,55192,1205,
     71206,1207,1209,55197,1210,1211,0,224527,1214,1215,
     81216,1217,0,253981,253982,253983,253984,1223,1224,0,
     966258,160737/
      DATA NOTPN1/-1235,19637,1231,19632,25773,29455,
     1-19632,-2499,1243,3681,13497,8589,22086,18405,25767,
     26156,8609,11063,17198,-2454,8611,14750,1227,17178,
     313497,18439,14752,24583,24572,18437,15983,-23357,
     425509,22124,6135,1227,13497,25808,14724,14724,-2497,
     51227,-23357,-24540,-3750,1277,22086,22086,11043,6192,
     617246,24608,6190,22154,22154,6203,9875,1227,18472,
     714789,15128,6539,4085,24944,16017,-7362,-7430,-17178,
     8-5079,2527,1299,-2454,6212,2530,25767,14724,11159,
     917258,5060,23421,1318,2540,1311,14812,6223,19719/
      DATA NOTP87/29536,-2543,-11133,-29448,19740,14820,
     11322,30771,-1324,-1324,-3779,-6234,-7462,-9917,
     2-11145,-14827,-17282,-19737,-22192,-23420,-29448,
     329557,-1337,-2565,-3793,-6248,-7476,-9931,-11185,
     418529,-7480,-11166,17178,4908,6135,29448,-29448,
     529573,-1355,19759,29448,-2583,-3813,9816,1227,-6268,
     6-7499,17313,18541,-17178,-9954,-11185,17178,4908,
     76135,-14875,6281,14869,26994,11192,23463,24690,23463,
     8-6135,-17334,16104,25767,15951,2454,-19789,-22253,
     96135,7362,6135,22086,6135,17178,3681,6135,23313/
      DATA NOT167/-24455,6304,19802,25767,-6373,2629,1401,
     1-2454,7538,11222,7540,18293,14908,11224,18587,23537,
     26135,17385,1419,2643,14913,6324,-2645,1227,-11280,
     35112,7556,-2651,1227,22086,-7560,-11243,7362,-14925,
     4-17380,-18608,-23313,7567,24749,22086,23522,19868,
     5-2665,1227,-7577,11256,17392,18405,-11261,7579,17178,
     6-14949,11265,23534,24540,18628,23537,24540,-17405,
     719422,-18637,2454,12270,6135,3681,-23550,19868,8824,
     814724,25767,-29448,-7729,1472,3925,12176,18311,9722,
     915857,8835,11304,8841,26018,22337,6386,-4908,14978/
      DATA NOT253/14724,17433,22344,23572,24799,-5167,
     1-7622,-24540,15004,1492,8854,23578,-1493,-2721,-3949,
     2-6404,-10087,1560,-11315,-14997,-18679,-19907,-21135,
     3-23590,-24901,1506,6135,17459,18705,18696,24829,
     417467,18694,24829,6424,23602,-10106,-22086,22381,
     53975,7268,26900,27290,-10113,-19930,-22385,-23313,
     619935,2408,8589,24844,-1532,-2760,-3992,1535,18405,
     716261,17178,-5225,6135,7362,6135,22086,22086,-6457,
     817498,5228,-4002,-7362,-7691,18731,22412,16277,-7362,
     96135,6135,-10155,1562,15057,7695,-5242,-25767,6471/
      DATA NOT336/-5245,-25767,19632,-11383,-15069,6477,
     118748,24884,-3681,-18751,-19982,2408,8589,6135,
     2-21210,-22439,25767,-23670,19987,26123,29448,-24901,
     31586,6495,11043,-26133,15087,17542,19997,-3681,
     4-29448,-10202,5278,-14724,6515,1608,5289,6511,22467,
     523694,11424,17563,8974,23698,15105,-15109,6135,26994,
     66135,-18405,-11495,7754,17567,18795,-17178,18405,
     78985,18172,19399,23080,16356,16355,6539,5312,11447,
     81631,24944,6539,-7362,17613,5325,6548,17588,24951,
     929859,-6547,-7777,-6549,-7777,-15140,-17178,11465/
      DATA NOT418/25673,12176,2360,15857,18828,20060,1652,
     19015,26218,24991,24969,-6565,-7794,18273,-15157,
     2-17612,-20083,-6571,-7800,18273,-15168,6575,11485,
     323313,23756,26994,-17627,18853,24540,6135,24540,
     4-20082,-23764,-28221,-12726,18860,11043,25767,-15246,
     51688,23773,25000,-7362,6614,5373,8589,6135,7831,
     625017,-2932,18906,15194,25016,18877,25014,7325,
     7-23788,-24540,27471,-2932,-6647,11528,23795,25030,
     825030,6135,22086,18894,18892,28709,-3681,23804,-6135,
     925034,18898,22605,27489,-2959,18907,25041,25042/
      DATA NOT499/18907,16453,-23817,-23817,25509,-24540,
     1-4187,-6644,5416,14724,-7874,18405,22086,-16464,
     2-17692,-20147,-24540,18924,20151,-23834,-23834,25509,
     3-24540,-16487,18934,27523,1756,2983,15253,6664,-7897,
     49120,11043,8589,25767,22086,-19632,-18020,12808,
     516500,1767,4222,-1769,-4224,-6679,-7907,-15318,6682,
     611591,23922,18980,25092,7325,-1783,20187,1227,26397,
     7-7926,11601,15283,17738,19082,18967,27557,-10552,
     8-10381,-12836,-15291,-17746,-18974,-20205,1799,8589,
     96953,-22660,-24143,20208,25118,11043,26386,15309/
      DATA NOT580/6716,11625,23897,20425,27835,16549,3043,
     16724,22675,-1817,-4272,-6727,-7955,-15318,-20227,
     2-23313,6732,20248,17777,-1829,20747,19632,-4284,
     3-6739,-7967,-15334,6742,11651,23922,26994,-20243,
     4-23313,6748,20248,1842,8589,25767,2454,19632,-1862,
     520259,1849,19632,6135,17178,4908,11043,26398,25170,
     619035,-19632,30080,-19632,1227,22086,-4320,9816,1227,
     719632,-6781,14724,6135,15951,6135,17178,24540,-8132,
     811692,15836,15387,1880,9242,23966,-1881,-3109,-4337,
     9-6792,-10475,1938,-11703,-15385,-19067,-20377,17842/
      DATA NOT664/19082,19078,25212,17850,19077,25212,6807,
     123985,-9816,27668,-10492,6135,-23313,-1905,-3135,
     218405,14724,-4378,1915,19632,11043,24540,1227,14724,
     318405,16644,15951,6135,17178,17178,24540,22086,18405,
     4-6842,17878,5608,-4387,18405,15951,15951,1227,17178,
     5-7362,-10537,1940,15435,8073,-5620,-25767,6851,1227,
     64908,-5627,18405,28221,-25767,19632,-11765,-15456,
     76862,24540,24540,6135,19134,29428,25271,22086,-3681,
     8-19146,27730,6871,22822,-23313,24540,22086,11043,
     913497,-20377,2408,8589,6135,-21608,25767,18405,24540/
      DATA NOT749/-24069,20384,1227,26522,2454,11043,29448,
     1-25301,1986,2454,6135,29448,-26536,15487,17945,4908,
     26135,22086,20400,-3681,-29448,-10595,5680,6135,1227,
     34908,6911,11043,17178,8589,-13056,25767,23313,24540,
     411043,7362,30675,-15520,6925,8151,27789,11835,23313,
     524107,24540,27789,-19632,-17982,16749,26570,16754,
     63257,6938,22889,-7362,-19214,7362,7362,23313,6135,
     7-20451,2043,8589,6948,11043,17178,8589,6952,9407,
     822086,-22906,-24143,6958,3681,20456,25365,25767,2454,
     920461,1227,24540,-25371,-25767,15557,18019,5749,6976/
      DATA NOT836/22927,15565,11884,18019,6976,-23313,
     1-19283,8212,8210,24161,6983,25388,-15573,-22086,
     215577,6987,-19632,16806,12176,20492,2084,6994,18172,
     39583,26632,24540,14724,11043,17178,-15592,7009,8236,
     4-20501,-22963,11917,9463,10690,25414,-19632,2408,
     58589,-23313,-20556,2120,9472,7017,11941,20519,7021,
     622972,-23313,22984,1227,8589,22086,1227,19632,7032,
     722086,11043,18405,9490,-15623,-24213,-28221,22993,
     811948,18083,25445,-8268,-11966,24222,11043,30358,
     9-8273,-11955,-15640,6135,17178,8589,-24231,11043/
      DATA NOT918/-29144,11043,4908,24540,9816,-29448,
     1-23057,7066,5835,24243,7065,25470,-1227,11980,9528,
     210755,25479,-3403,19350,26705,-2166,-3403,19351,
     325485,25486,19351,16897,-24261,-24261,25509,-24540,
     4-7086,4908,-16907,1227,22086,8589,11043,-18139,19363,
     5-7362,11043,14724,-20594,-24540,19372,20599,-24283,
     625509,-24283,25509,25767,-24540,-24456,5881,7115,
     74657,24540,20859,25767,6135,17178,10802,5890,7118,
     819390,29354,-15857,12038,16944,26761,15718,2221,
     925534,7129,18172,-23313,14500,12041,20630,-15725/
      DATA NOT999/7268,8495,-20634,-22086,20671,2252,4703,
     17153,-2235,-3463,-4691,-8374,18273,-10829,-12057,
     2-15739,-18215,19422,24540,12067,17178,5929,8589,9612,
     330472,-2257,9615,15752,7272,-2257,20747,-3485,-4713,
     4-8395,-10850,-12078,-15760,-18215,-25578,-29448,
     521903,25767,6135,6135,31902,25599,2278,17178,4908,
     61227,22086,4908,19457,31730,15779,7190,-10872,-12100,
     7-15782,-29448,26837,3518,12105,20695,24540,19632,
     82295,8589,6135,8589,23313,30519,-2307,20711,19632,
     96135,17178,4908,11043,29448,29448,-3540,18405,24540/
      DATA NO1083/24540,18405,15951,-4774,9816,1227,19632,
     124540,6135,22086,-8462,18273,18405,18405,24540,17178,
     218405,-10927,6010,7243,2335,6016,7243,23194,24421,
     3-14724,6135,26994,-12159,17178,4908,6135,29448,
     4-15847,7257,8481,28116,6135,14724,-19632,-18305,
     519531,24540,24540,-20760,-23220,12176,9722,10949,
     625673,-19632,-24452,19632,14724,11043,3681,-25682,
     718405,19632,-29448,-25733,2375,3600,-23313,24540,
     87297,15875,14724,23243,15951,11043,17178,1227,14724,
     924472,25699,-20792,-23313,19632,12206,15888,19573/
      DATA NO1165/20798,-24502,25725,20803,2397,8589,
     1-20806,2408,8589,-24502,20814,1227,3681,7314,11043,
     217178,8589,25725,18405,19632,26955,2454,24540,-24540,
     3-24540,11043,24540,14724,-26985,15919,18381,6120,
     47347,23298,15936,12255,18390,7347,20840,20839,7342,
     523293,-3681,-4893,1227,23313,6135,-23313,19632,1227,
     63681,6135,23313,-28219,6135,22086,23313,11043,18405,
     717178,-30674,-30675/
C     ***** INSERT KEYWRD OUTPUT HERE *****
C
C     KMDARG = SPECIFIES THE TYPE OF ARGUMENT LIST FOR EACH
C              COMMAND.   FOR  EACH  TYPE, THE NBEGIN ARRAY
C              POINTS TO THE START  OF  THE  ARGUMENT  LIST
C              DESCRIPTION IN THE NARGMT ARRAY.
C            = 0, NO ARGUMENTS ALLOWED.
C            = 1, 2 OR  3,  THIS  NUMBER  OF  INTEGERS  CAN
C              APPEAR IN ARGUMENT LIST.
C            = 4, TEXT  STRING  EXTENDING  THROUGH  END  OF
C              LINE.
C            = 5, NOT USED
C            = 6, SINGLE CHARACTER.
C            = 7, DISPLAY TYPE (D, O, H, RU,  RL,  RM,  LU,
C              LL, OR LM).
C            = 8, CHARACTER, DISPLAY TYPE, CHARACTER.
C            = 9, NUMBER, MULTIPLE CHARACTERS.
C            = 10, UNQUOTED TEXT STRING REGARDLESS OF
C                  IF FLAG TEXT COMMAND HAS BEEN ISSUED
C            = 11, ALLOW UP TO 32 INTEGERS
C            = 12, ALLOW NUMBER THEN TEXT THROUGH END OF
C              LINE.
C            = 13, ALLOW UP TO 6 NUMBERS.
C            = 14, ALLOW UP TO 6 DISPLAY TYPES.
C            = 15, ALLOW UP TO 4 NUMBERS.
C            = 16, ALLOW UP TO 3 QUOTED TEXT STRINGS
C            = 17, CHARACTER, DISPLAY TYPE, CHARACTER, NUMBER
C            = 18, QUOTED TEXT STRING, NUMBER, NUMBER
C            = 19, QUOTED TEXT STRING
C     NBEGIN = SPECIFIES   START   IN   NARGMT   ARRAY   OF
C              DESCRIPTION OF EACH TYPE OF ARGUMENT LIST.
C     NARGMT = SPECIFIES TYPE OF ARGUMENTS ALLOWED FOR EACH
C              ARGUMENT LIST TYPE.  IF THIS ARGUMENT TYPE
C              IS TO BE REPEATED, THEN HUNDREDS DIGITS
C              SPECIFIES NUMBER OF TIMES.
C            = 0, END OF DESCRIPTION OF ARGUMENT LIST.   NO
C              ADDITIONAL ARGUMENTS ALLOWED.
C            = 1, INTEGER ARGUMENT.
C            = 2, SINGLE CHARACTER ARGUMENT.
C            = 3, DISPLAY TYPE ARGUMENT.
C            = 4, MULTIPLE CHARACTER QUOTED TEXT STRING IF
C              FLAGS TEXT COMMAND IS ACTIVE, OR TEXT STRING
C              EXTENDING THROUGH END OF LINE OTHERWISE.
C            = 5, UNQUOTED TEXT STRING REGARDLESS OF
C              IF FLAG TEXT COMMAND HAS BEEN ISSUED
C            = 6, QUOTED TEXT STRING REGARDLESS OF
C              IF FLAG TEXT COMMAND HAS BEEN ISSUED
C
      DATA IAR001/  0,  1,  0,  2,  0,  0,  0,  6,  4,  6,
     1              6,  6,  6,  6,  4,  1,  1,  0,  0,  1,
     2              1,  0,  2,  0,  0,  1,  0,  0,  0,  0,
     3              0,  0,  0,  1,  0,  3,  0,  2,  0,  1,
     4              1,  1,  6,  0,  1,  0,  6,  6,  4,  0,
     5              0,  0,  4,  4,  4,  4,  7,  7,  1,  7,
     6              1,  0,  1,  0,  1,  0,  0,  9,  0,  0,
     7              2,  8, 10,  0,  0,  6,  0,  6,  0,  3,
     8              0,  0,  3,  1,  2,  0,  0, 11, 12, 13,
     9             15, 14,  2,  0,  4,  0,  3, 10,  1,  0/
      DATA IAR101/  0,  0,  0,  6,  0,  1,  6,  0,  1,  1,
     1              2,  2,  2,  2,  0,  0,  0,  0,  1,  3,
     2              3,  0,  0,  7,  0,  0,  0,  0,  6,  0,
     3              4,  4,  7, 15,  0,  0,  0,  6,  0,  0,
     4              0, 16, 16, 16, 16, 16, 16, 16, 16, 16,
     5             16, 16, 16,  3,  1,  0,  0, 18,  1,  4,
     6              0,  0,  1,  0,  0,  1,  0,  1, 17, 17,
     7              0,  1,  0,  6,  0,  0,  0,  1,  1,  0,
     8             12,  0,  0,  3, 18, 18,  0, 18,  0,  0,
     9              1,  1,  6,  0,  6,  0,  2,  0,  0,  0/
      DATA IAR201/ 19,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     1              0,  0, 18, 18,  0,  3, 11,  6,  0,  1,
     2              0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     3              0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     4              0,  0,  0,  0,  0,  0,  0,  0,  0,  0/
C
      DATA NBEGIN/  1,  3, 20,  5,  4,  7,  9, 11, 15, 18,
     1             22, 24, 27, 29, 31, 33, 35, 40, 43/
      DATA NARGMT/101,  0,201,  0,  4,  0,  2,  0,  3,  0,
     1              2,  3,  2,  0,  1,  6,  0,  5,  0,301,
     2             0,3201,  0,  1,  4,  0,601,  0,603,  0,
     3            401,  0,306,  0,  2,  3,  2,  1,  0,  6,
     4           1001,  0,  6,  0/
C
C     KMDBRK = SELECTS THE SEQUENCE OF OPERATIONS TO BE
C              APPLIED BEFORE RNOSET IS CALLED TO TURN ON
C              THE SWITCHES FOR THE COMMAND.  KMDBRK IS A
C              POINTER INTO THE NXTPNT ARRAY, WHICH IN TURN
C              POINTS TO THE FIRST LOCATION IN THE NXTCMD
C              ARRAY DESCRIBING WHAT IS TO BE DONE.
C            = 0, APPLY COMMAND WITHOUT BREAKING TEXT.
C            = 1, BREAK TEXT WITHOUT GENERATING SHADOW.
C              APPLY NEW COMMAND.
C            = 2 (CHAPTER, APPENDIX, FORCE PAGE COMMANDS).
C              BREAK TEXT.
C              APPLY END NOTE COMMAND.
C              APPLY END FOOTNOTE COMMAND.
C              DUMP  FOOTNOTES  UNLESS  THESE   ARE   BEING
C              DEFERRED.
C              PRINT BOTTOM OF PAGE
C              APPLY NEW COMMAND.
C            = 3 (DO FOOTNOTE, DO INDEX COMMANDS)
C              BREAK TEXT.
C              APPLY END NOTE COMMAND.
C              APPLY END FOOTNOTE COMMAND.
C              TURN OFF DEFERRED FOOTNOTES.
C              DUMP FOOTNOTES INCLUDING  THOSE  WHICH  WERE
C              DEFERRED.
C              PRINT BOTTOM OF PAGE
C              TURN DEFERRING OF FOOTNOTES BACK ON  IF  WAS
C              ON BEFORE.
C              APPLY NEW COMMAND.
C            = 4, (RESTORE, RESTORE ALL, END OF FILE
C              COMMANDS)
C              SAME AS KMDBRK=3, EXCEPT THAT A DO INDEX IS
C              PERFORMED.
C            = 5, (THE VARIOUS PAGE COMMANDS
C              BREAK TEXT
C              WRITE OUT FOOTNOTES ON CURRENT PAGE IF ANY
C            = 6, (PRINT FOOTNOTE, PRINT INDEX COMMAND)
C              SAME AS KMDBRK=3, EXCEPT THAT BOTTOM OF PAGE
C              IS NOT PRINTED AFTERWARDS.
C            = 7, (FOOTNOTE)
C              LOGIC TO INSERT FOOTNOTE NUMBER INTO TEXT
C            = 8, (END LITERAL)
C              BREAK TEXT GENERATING REST OF SHADOW IF CHANGING
C              BACK TO FILL MODE.
C              APPLY NEW COMMAND.
C            = 9, (END FOOTNOTE)
C              BREAK TEXT
C              APPLY END NOTE COMMAND
C            = 12, (FILL, VARIOUS SHADOWS, END SHADOW)
C              BREAK TEXT GENERATING REST OF SHADOW.
C              APPLY NEW COMMAND.
C
      DATA IBR001/  0,  1,  1,  1,  4, 12,  0,  0,  0,  0,
     1              0,  0,  0,  0,  0,  1,  0,  5,  1,  1,
     2              1,  0,  1,  0,  0,  0,  0,  0,  0,  0,
     3              0,  1,  0,  1,  0,  1,  0,  1,  4,  1,
     4              1,  1,  0,  0,  7,  9,  0,  0,  0,  0,
     5              0,  0,  2,  0,  3,  2,  1,  1,  0,  1,
     6              0,  1,  0,  0,  0,  0,  0,  1,  1,  1,
     7              0,  1,  0,  0,  3,  0,  0,  0,  0,  0,
     8              0,  0,  0,  0,  1,  8,  4,  0,  1,  0,
     9              0,  0,  0,  6,  1,  1,  0,  0,  1,  0/
      DATA IBR101/  0,  0,  0,  0,  0,  1,  0,  0,  1,  1,
     1              1,  1,  1,  1,  1,  0,  5,  5,  0,  0,
     2              0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     3              0,  6,  0,  0,  2,  0,  0,  0,  0,  5,
     4              5,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     5              0,  0,  0,  0,  0,  0,  0, 11,  0,  0,
     6              5,  5,  5,  0,  0,  0,  0,  0,  0,  0,
     7              0,  0,  0,  0,  5,  0,  0,  1,  1,  0,
     8              1,  0,  0,  0, 12, 12, 12,  1,  0,  0,
     9             10,  0,  0,  0,  0,  0,  0,  0,  0,  0/
      DATA IBR201/  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     1              0,  0, 12, 12,  0,  0,  0,  0,  0,  1,
     2              5,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     3              0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     4              0,  0,  0,  0,  0,  0,  0,  0,  0,  0/
C
      DATA NXTPNT/1,3,11,24,38,43,51,57,62,65,69,75/
C
C     NXTCMD = -4, FORCE PAGE
C            = -3, PAGE
C            = -2, WRITE ALL FOOTNOTES TO THE DOCUMENT FILE
C              UNLESS THE FOOTNOTES ARE BEING DEFERRED.
C            = -1,  WRITE  CURRENT  LINE  OF  TEXT  TO  THE
C              DOCUMENT FILE OR CURRENT LINE OF FOOTNOTE TO
C              THE SCRATCH FILE.  EQUIVALENT  TO  A  .BREAK
C              COMMAND.
C            = 0, CALL RNOSET TO TURN ON THE SWITCHES FOR
C              THE CURRENT COMMAND.  NO FURTHER OPERATIONS
C              ARE TO BE PERFORMED FOR THE CURRENT COMMAND.
C            = GREATER THAN ZERO BUT LESS THAN 501, SET THE
C              SWITCHES INDICATED BY THE COMMAND HAVING THE
C              VALUE INDICATED BY THIS VALUE IN THE  NXTCMD
C              ARRAY.
C            = 501, TURN OFF  DEFERRED  FOOTNOTES  SO  THAT
C              THESE CAN BE GENERATED.
C            = 502, TURN DEFERRED FOOTNOTES BACK ON IF THEY
C              WERE ON BEFORE THE 501 COMMAND WAS GIVEN.
C            = 504, SIMULATE DO INDEX COMMAND WITHOUT ANY
C              ARGUMENTS.  USED INSTEAD OF DO INDEX COMMAND
C              DIRECTLY SINCE PREVIOUS COMMAND MIGHT HAVE
C              LEFT ARGUMENTS LYING AROUND.
C            = 510, FOR THE VARIOUS PAGE COMMANDS, INSERT
C              ALL MOVABLE PAGES NOT YET APPLIED.
C
      DATA NXTCMD/
     1-6,0,
     2-1,96,46,-1,-2,-3,-4,0,
     3-1,96,46,-1,-2,-3,-4,501,-2,-3,-4,502,0,
     4-1,96,46,-1,-2,-3,-4,501,-2,-3,-4,502,504,0,
     5-1,-3,510,0,0,
     6-1,96,46,-1,501,-2,502,0,
     7505,-1,506,-5,507,0,
     8513,-6,0,-1,0,
     9-1,96,0,
     1508,-3,509,0,
     2-1,511,-5,512,-1,0,
     3-1,0,
     40,0,0,0,0/
C
      DATA LTRABC /1HA,1HB,1HC,1HD,1HE,1HF,1HG,1HH,1HI,1HJ,
     1 1HK,1HL,1HM,1HN,1HO,1HP,1HQ,1HR,1HS,1HT,1HU,1HV,1HW,
     2 1HX,1HY,1HZ/
      DATA LWRABC /1Ha,1Hb,1Hc,1Hd,1He,1Hf,1Hg,1Hh,1Hi,1Hj,
     1 1Hk,1Hl,1Hm,1Hn,1Ho,1Hp,1Hq,1Hr,1Hs,1Ht,1Hu,1Hv,1Hw,
     2 1Hx,1Hy,1Hz/
      DATA LTRDGT /1H0,1H1,1H2,1H3,1H4,1H5,1H6,1H7,1H8,1H9/
      DATA LTRMNS,LTRPLS/1H-,1H+/
      DATA LTRSPA,LTRTAB/1H ,"045004020100/
      DATA LTRCOM,LTRRUL,LTRBAR/1H,,1H_,1H|/
      DATA LTRFLG/1H;,1H<,1H.,1H$,1H\,1H_,1H!,1H#,1H^,1H&,
     11H!,1H',1H>,1H>,1H>,1H|,1H/,1H>/
      DATA LTRPAG/1HP,1Ha,1Hg,1He,1H /
      DATA LTRIND/1HI,1HN,1HD,1HE,1HX/
      DATA LWRIND/1HI,1Hn,1Hd,1He,1Hx/
      DATA LTRCPT/1HC,1HH,1HA,1HP,1HT,1HE,1HR,1H /
      DATA LWRCHA/1HC,1Hh,1Ha,1Hp,1Ht,1He,1Hr,1H /
      DATA LTRAPP/1HA,1HP,1HP,1HE,1HN,1HD,1HI,1HX,1H /
      DATA LWRAPP/1HA,1Hp,1Hp,1He,1Hn,1Hd,1Hi,1Hx,1H /
      DATA LTRTYP/1HD,1HO,1HH,1HR,1HL,1HU,1HL,1HM/
      DATA LWRTYP/1Hd,1Ho,1Hh,1Hr,1Hl,1Hu,1Hl,1Hm/
      DATA LTRFXD/1H0,1H1,1H2,1H3,1H4,1H5,1H6,1H7,1H8,1H9/
      DATA KNTFXD/10/
C
C     2 SPACES ARE NEEDED TO RIGHT OF FOLLOWING IN FILL
C     MODE.  THESE VARIABLES ARE NOT REFERENCED OTHERWISE.
      DATA LTRTWO/1H:,1H!,1H.,1H?/
C
C     ARRAY DIMENSIONS
C     LMTBGN = DIMENSION  OF  LTRBGN  AND  MSKBGN   ARRAYS.
C              THESE  HOLD  THE  LINE OF TEXT READ FROM THE
C              INPUT FILE.
C     LMTFNR = DIMENSION OF MSKFNR ARRAY.  THIS  HOLDS  THE
C              FOOTNOTE HEADER.
C     LMTMID = DIMENSION  OF  LTRMID,  MSKMID,  LTRFTN  AND
C              MSKFTN  ARRAYS.   LTRMID  AND  MSKMID HOLD A
C              LINE OF TEXT AS IT IS  BEING  FORMATTED  FOR
C              OUTPUT.  LTRFTN AND MSKFTN HOLD THE CONTENTS
C              OF  THE  LTRMID   AND   MSKMID   ARRAYS   IF
C              CONSTRUCTION  OF  AN  OUTPUT  LINE  MUST  BE
C              INTERRUPTED TO ALLOW THE SPECIFICATION OF  A
C              FOOTNOTE.
C     LMTTTL = DIMENSION OF MSKTTL ARRAY.  THIS  HOLDS  THE
C              PAGE TITLE.
C     LMTWRK = DIMENSION OF LTRWRK ARRAY.  THIS IS USED FOR
C              TEMPORARY  CONSTRUCTION  OF  LINES OF OUTPUT
C              TEXT.
C     LMTUNT = DIMENSION OF NXTUNT ARRAY.  THIS  HOLDS  THE
C              AVAILABLE   UNIT  NUMBERS  FOR  READING  AND
C              WRITING SCRATCH FILES.
C     LMTLST = DIMENSION OF LSTVAL, LSTSKP, LSTTYP, LSTMRG,
C              LSTRIT,  LSTSPC,  LTROPN  AND LTRCLS ARRAYS.
C              THESE ARE USED FOR STORIGN INFORMATION ABOUT
C              EMBEDDED LISTS.
C     LMTTAB = DIMENSION OF LOCTAB ARRAY.  THIS  HOLDS  THE
C              TAB  STOPS.   SINCE THE TAB COMMAND ALSO HAS
C              THE  MOST  ARGUMENTS,  THIS  IS   ALSO   THE
C              DIMENSION  OF NVALUE AND NMINUS IN WHICH THE
C              ARGUMENTS OF A COMMAND ARE RETURNED.
C     LMTLVL = DIMENSION  OF  NUMLVL  AND  KNDLVL   ARRAYS.
C              THESE STORE INFORMATION ABOUT HEADER LEVELS.
C     LMTCOD = DIMENSION OF LTRCOD ARRAY.  THIS  HOLDS  THE
C              VARIOUS  CHARACTERS WHICH MUST BE REFERENCED
C              BY CODE BUT WHICH ARE OUTSIDE ALPHABET.
C     LMTNDX = DIMENSION OF NUMNDX ARRAY.  THIS  HOLDS  THE
C              CODES FOR LETTERS IN AN INDEX REFERENCE.
C     LMTCHA = DIMENSION OF MSKCHA  ARRAY.   THIS  HOLDS  A
C              CHAPTER OR APPENDIX TITLE.
C     LMTSHD = DIMENSION OF LTRSHD ARRAY.   THIS  HOLDS  THE
C              LETTERS  USED  TO  DARKEN BACKGROUND GIVEN BY
C              THE SHADOW COMMAND.
C     LMTEDT = DIMENSION OF MAGEDT ARRAY.  THIS HOLDS THE
C              EDITING INSTRUCTION FOR MAGNIFIED LETTERS.
C     LMTBIG = DIMENSION OF LTRBIG ARRAY.  THIS HOLD THE
C              LETTERS USED TO DARKEN MAGNIFIED LETTERS.
C
      DATA LMTBGN,LMTFNR,LMTMID,LMTTTL,LMTWRK,
     1LMTUNT,LMTLST,LMTTAB,LMTLVL,LMTCOD,LMTNDX,LMTCHA,LMTSHD,
     2LMTEDT,LMTBIG/
     3300,200,200,450,200,4,10,32,6,70,300,200,50,50,50/
C
C     DEFINE DEVICE UNIT NUMBERS
      DATA IDISK,JDISK,ITTY,JTTY/
     11,20,5,5/
      DATA NXTUNT/21,22,23,24/
      END
      BLOCK DATA
CRENBR(RENBRSTART)(RNOFNT/BIG LETTER FONTS FOR FROFF)
      COMMON/RNOTWE/LTRFNT( 204)
      COMMON/RNOTHI/LOCKED,KNTFNT,ICLMNS( 204),
     1ILIMIT(   3),ILINES(   3),IMAXMM(   3),
     2ICOMMN(   3),IPACKD(1428)
C     DIMENSION LTRFNT(204)
      DIMENSION LTRFN1(100),LTR101(100),LTR201(  4)
C     DIMENSION ILINES(3)
      DIMENSION ILINE1(3)
C     DIMENSION ILIMIT(3)
      DIMENSION ILIMI1(3)
C     DIMENSION IMAXMM(3)
      DIMENSION IMAXM1(3)
C     DIMENSION ICOMMN(3)
      DIMENSION ICOMM1(3)
C     DIMENSION ICLMNS(204)
      DIMENSION ICLMN1(204)
C     DIMENSION IPACKD(1428)
      DIMENSION IPACK1(185),IPA186(197),IPA383(139),
     1IPA522(163),IPA685(177),IPA862(126),IPA988(141),
     2IP1129(163),IP1292(137)
      EQUIVALENCE (LTRFN1(1),LTRFNT(  1)),
     1            (LTR101(1),LTRFNT(101)),
     2            (LTR201(1),LTRFNT(201))
      EQUIVALENCE (ILINE1(1),ILINES(1))
      EQUIVALENCE (ILIMI1(1),ILIMIT(1))
      EQUIVALENCE (IMAXM1(1),IMAXMM(1))
      EQUIVALENCE (ICOMM1(1),ICOMMN(1))
      EQUIVALENCE (ICLMN1(1),ICLMNS(1))
      EQUIVALENCE (IPACK1(1),IPACKD(1)),
     1(IPA186(1),IPACKD(186)),(IPA383(1),IPACKD(383)),
     2(IPA522(1),IPACKD(522)),(IPA685(1),IPACKD(685)),
     3(IPA862(1),IPACKD(862)),(IPA988(1),IPACKD(988)),
     4(IP1129(1),IPACKD(1129)),(IP1292(1),IPACKD(1292))
      DATA LTRFN1/1HA,1HB,1HC,1HD,1HE,1HF,1HG,1HH,1HI,1HJ,
     1            1HK,1HL,1HM,1HN,1HO,1HP,1HQ,1HR,1HS,1HT,
     2            1HU,1HV,1HW,1HX,1HY,1HZ,1H0,1H1,1H2,1H3,
     3            1H4,1H5,1H6,1H7,1H8,1H9,1H!,1H@,1H#,1H$,
     4            1H%,1H^,1H&,1H*,1H(,1H),1H-,1H_,1H[,1H],
     5            1H+,1H=,1H\,1H|,1H`,1H~,1H:,1H;,1H",1H',
     6            1H{,1H},1H.,1H,,1H/,1H?,1H<,1H>,1HA,1HB,
     7            1HC,1HD,1HE,1HF,1HG,1HH,1HI,1HJ,1HK,1HL,
     8            1HM,1HN,1HO,1HP,1HQ,1HR,1HS,1HT,1HU,1HV,
     9            1HW,1HX,1HY,1HZ,1H0,1H1,1H2,1H3,1H4,1H5/
      DATA LTR101/1H6,1H7,1H8,1H9,1H!,1H@,1H#,1H$,1H%,1H^,
     1            1H&,1H*,1H(,1H),1H-,1H_,1H[,1H],1H+,1H=,
     2            1H\,1H|,1H`,1H~,1H:,1H;,1H",1H',1H{,1H},
     3            1H.,1H,,1H/,1H?,1H<,1H>,1HA,1HB,1HC,1HD,
     4            1HE,1HF,1HG,1HH,1HI,1HJ,1HK,1HL,1HM,1HN,
     5            1HO,1HP,1HQ,1HR,1HS,1HT,1HU,1HV,1HW,1HX,
     6            1HY,1HZ,1H0,1H1,1H2,1H3,1H4,1H5,1H6,1H7,
     7            1H8,1H9,1H!,1H@,1H#,1H$,1H%,1H^,1H&,1H*,
     8            1H(,1H),1H-,1H_,1H[,1H],1H+,1H=,1H\,1H|,
     9            1H`,1H~,1H:,1H;,1H",1H',1H{,1H},1H.,1H,/
      DATA LTR201/1H/,1H?,1H<,1H>/
      DATA ILINE1/5,7,9/
      DATA ILIMI1/68,136,204/
      DATA IMAXM1/5,10,12/
      DATA ICOMM1/5,8,10/
      DATA ICLMN1/5,5,5,5,5,5,5,5,3,5,5,5,5,5,5,5,5,5,5,5,
     15,5,5,5,5,5,5,3,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5,5,3,3,
     25,5,3,3,5,5,5,1,2,5,2,2,5,2,3,3,2,2,5,5,2,2,8,8,8,8,
     38,8,8,8,6,8,8,8,10,8,8,8,8,8,8,8,8,8,10,8,8,8,8,6,8,
     48,8,8,8,8,8,8,2,8,8,8,8,8,8,8,5,5,8,8,5,5,8,8,8,2,3,
     58,2,3,8,3,6,6,2,3,8,8,6,6,10,10,10,10,10,10,10,10,6,
     610,10,10,12,10,10,10,10,10,10,10,10,10,12,10,10,10,
     710,6,10,10,10,10,10,10,10,10,4,10,10,10,10,10,10,10,
     86,6,10,10,6,6,10,10,10,2,4,10,4,4,10,4,7,7,4,4,10,10,
     98,8/
      DATA IPACK1/4,10,17,31,17,30,17,30,17,30,15,16,16,16,
     115,30,17,17,17,30,31,16,30,16,31,31,16,30,16,16,15,
     216,19,17,15,17,17,31,17,17,7,2,2,2,7,1,1,1,17,14,17,
     318,28,18,17,16,16,16,16,31,17,27,21,17,17,17,25,21,
     419,17,14,17,17,17,14,30,17,30,16,16,14,17,21,18,13,
     530,17,30,18,17,15,16,14,1,30,31,4,4,4,4,17,17,17,17,
     614,17,17,17,10,4,17,17,21,27,17,17,10,4,10,17,17,10,
     74,4,4,31,2,4,8,31,14,17,17,17,14,6,2,2,2,7,30,1,14,
     816,31,30,1,6,1,30,3,5,9,31,1,31,16,30,1,30,4,8,30,17,
     914,31,1,2,4,4,14,17,14,17,14,14,17,15,2,4,1,1,1,0,1/
      DATA IPA186/14,19,19,16,14,10,31,10,31,10,15,20,14,5,
     130,25,26,4,11,19,4,10,17,0,0,28,8,21,18,13,0,14,31,
     214,0,3,4,4,4,3,6,1,1,1,6,0,0,31,0,0,0,0,0,0,31,7,4,4,
     34,7,7,1,1,1,7,0,4,31,4,0,0,31,0,31,0,16,8,4,2,1,1,1,
     41,1,1,3,2,0,0,0,13,22,0,0,0,3,0,0,0,3,3,0,0,3,1,27,9,
     50,0,0,3,1,0,0,0,3,2,6,2,3,6,2,3,2,6,0,0,0,3,3,0,0,0,
     63,1,1,2,4,8,16,30,1,6,0,4,0,1,2,1,0,0,2,1,2,0,24,60,
     7102,195,255,195,195,252,195,195,252,195,195,252,31,
     896,192,192,192,96,31,248,198,195,195,195,198,248,255,
     9192,192,252,192,192,255,255,192,192,252,192,192,192/
      DATA IPA383/31,96,192,207,195,99,31,195,195,195,255,
     1195,195,195,63,12,12,12,12,12,63,3,3,3,3,195,102,60,
     2198,204,216,248,236,198,195,192,192,192,192,192,192,
     3255,771,903,975,891,819,771,771,195,227,243,219,207,
     4199,195,60,102,195,195,195,102,60,252,195,195,252,
     5192,192,192,60,102,195,195,205,102,59,252,195,195,
     6252,204,198,195,63,192,192,60,3,3,252,255,24,24,24,
     724,24,24,195,195,195,195,195,102,60,195,195,195,195,
     8102,60,24,771,771,819,891,975,903,771,195,102,60,24,
     960,102,195,195,102,60,24,24,24,24,255,6,12,24,48,96/
      DATA IPA522/255,60,102,195,195,195,102,60,12,60,12,
     112,12,12,63,252,3,3,60,192,192,255,252,3,3,28,3,3,
     2252,15,27,51,99,255,3,3,255,192,192,252,3,3,252,12,
     324,48,124,195,195,60,255,3,6,12,24,24,24,60,195,195,
     460,195,195,60,60,195,195,62,12,24,48,3,3,3,3,0,3,3,
     560,102,207,207,198,96,62,102,255,102,102,102,255,102,
     624,127,216,126,27,254,24,227,230,12,24,48,103,199,24,
     760,102,195,0,0,0,56,108,56,120,207,206,123,0,102,60,
     8255,60,102,0,7,12,24,24,24,12,7,28,6,3,3,3,6,28,0,0,
     90,255,0,0,0,0,0,0,0,0,0,255,31,24,24,24,24,24,31,31/
      DATA IPA685/3,3,3,3,3,31,0,24,24,255,24,24,0,0,0,255,
     10,255,0,0,192,96,48,24,12,6,3,3,3,3,3,3,3,3,7,6,3,0,
     20,0,0,51,204,0,0,0,0,0,3,3,0,0,0,3,3,3,3,0,0,7,3,6,
     3231,99,198,0,0,0,0,7,3,6,0,0,0,0,7,12,12,56,12,12,7,
     456,12,12,7,12,12,56,0,0,0,0,0,3,3,0,0,0,0,7,3,6,3,6,
     512,24,48,96,192,252,3,3,28,0,24,24,0,3,12,48,12,3,0,
     60,48,12,3,12,48,0,48,120,204,390,771,771,1023,771,
     7771,1016,774,771,774,1016,774,771,774,1016,127,384,
     8768,768,768,768,768,384,127,1016,774,771,771,771,771,
     9771,774,1016,1023,768,768,768,1016,768,768,768,1023/
      DATA IPA862/1023,768,768,768,1016,768,768,768,768,
     1127,384,768,768,799,771,771,387,127,771,771,771,771,
     21023,771,771,771,771,63,12,12,12,12,12,12,12,63,3,3,
     33,3,3,771,771,390,120,780,792,816,864,1008,920,780,
     4774,771,768,768,768,768,768,768,768,768,1023,3075,
     53591,3855,3483,3315,3171,3075,3075,3075,771,899,963,
     6867,819,795,783,775,771,120,390,771,771,771,771,771,
     7390,120,1016,774,771,774,1016,768,768,768,768,120,
     8390,771,771,771,819,793,396,102,1016,774,771,774,
     91016,792,780,774,771,127,384,768,384,120,6,3,6,1016/
      DATA IPA988/1023,48,48,48,48,48,48,48,48,771,771,771,
     1771,771,771,771,390,120,771,771,771,771,771,390,204,
     2120,48,3075,3075,3075,3171,3315,3483,3855,3591,3075,
     3771,390,204,120,48,120,204,390,771,771,390,204,120,
     448,48,48,48,48,1023,6,12,24,48,96,192,384,1023,120,
     5390,771,771,771,771,771,390,120,12,60,12,12,12,12,12,
     612,63,1016,6,3,6,120,384,768,768,1023,1016,6,3,6,120,
     76,3,6,1016,31,51,99,195,387,1023,3,3,3,1023,768,768,
     81016,6,3,3,6,1016,24,48,96,192,504,774,771,390,120,
     91023,3,6,12,24,48,48,48,48,120,390,771,390,120,390/
      DATA IP1129/771,390,120,120,390,771,387,126,12,24,48,
     196,6,6,6,6,6,0,6,15,6,120,390,771,799,819,819,798,
     2384,126,204,204,1023,204,204,204,1023,204,204,48,48,
     3511,816,510,51,1022,48,48,451,870,460,24,48,96,206,
     4411,782,48,120,204,390,771,0,0,0,0,240,408,408,240,
     5432,795,780,798,227,0,390,204,120,1023,120,204,390,0,
     67,24,48,48,48,48,48,24,7,56,6,3,3,3,3,3,6,56,0,0,0,0,
     71023,0,0,0,0,0,0,0,0,0,0,0,0,1023,63,48,48,48,48,48,
     848,48,63,63,3,3,3,3,3,3,3,63,0,48,48,48,1023,48,48,
     948,0,0,0,1023,0,0,0,1023,0,0,768,384,192,96,48,24,12/
      DATA IP1292/6,3,3,3,3,3,3,3,3,3,3,7,15,12,6,0,0,0,0,
     10,483,798,0,0,0,0,0,0,0,6,15,6,0,0,0,6,15,6,6,15,6,0,
     20,14,15,3,6,910,975,195,390,0,0,0,0,0,14,15,3,6,0,0,
     30,0,0,15,24,24,24,112,24,24,24,15,120,12,12,12,7,12,
     412,12,120,0,0,0,0,0,0,6,15,6,0,0,0,0,0,14,15,3,6,3,6,
     512,24,48,96,192,384,768,1016,6,3,6,120,0,96,240,96,0,
     63,12,48,192,48,12,3,0,0,192,48,12,3,12,48,192,0/
      DATA KNTFNT,LOCKED/  3,999/
      END
C     RENBR(FROFF/MACHINE INDEPENDENT RUNOFF SIMULATOR)
C
C     DONALD E. BARTH, YALE SCHOOL OF MANAGEMENT
C
C     THIS MAIN PROGRAM ALLOWS FROFF TO BE LOADED AS 3
C     OVERLAYS, THE FIRST CONTAINING THE USER INTERACTION,
C     THE SECOND CONTAINING ALL FEATURES EXCEPT FOR THE
C     CONSTRUCTION OF INDEX, AND THE THIRD CONTAINING THE
C     INDEX CONSTRUCTION.
C
      COMMON/RNOONE/I     ,IAPNDX,IBRFTN,IBYTE ,ICENTR,
     1ICHAPT,IDEBUG,IDEFER,IDFILE,IDFRFG,IDFRPG,IDISK ,
     2IFABAR,IFAUTO,IFENCE,IFFILL,IFFLAG,IFHEAD,IFLIST,
     3IFLOOP,IFLSUB,IFNATO,IFNBGN,IFNFIL,IFNGAP,
     4IFNGSP,IFNHAV,IFNIBR,IFNICN,IFNIDF,IFNIFA,IFNIIN,
     5IFNILF,IFNIND,IFNIRT,IFNISP,IFNJCN,IFNJDF,IFNJFL,
     6IFNJST,IFNKCN,IFNKDF,IFNKLM,IFNLBR,IFNLBS,IFNLOF,
     7IFNLSP,IFNMBR,IFNMFR,IFNMLF,IFNMNS,IFNMRT,
     8IFNNBR,IFNNIN,IFNNLF,IFNNOF,IFNNOT,IFNNRT,IFNNSK,
     9IFNNTF,IFNNTL,IFNNTR,IFNNTS,IFNNTT,IFNNT1,IFNNT2
      COMMON/RNOTWO/IFNNT3,IFNOFF,IFNOPN,IFNOTE,IFNPIN,
     1IFNPRD,IFNPSK,IFNPTS,IFNRBS,IFNRDY,IFNRED,IFNRIT,
     2IFNROF,IFNTTL,IFNULS,IFNUMB,IFPAGE,IFRSUB,IFSPLC,
     3IGAPHI,IGAPLO,IGROUP,IMINUS,INDENT,INDFTN,INIALL,
     4INIAPP,INIBAR,INICHA,INIFRM,INILIN,ININDX,ININXT,
     5INISPA,INITAL,INNOTE,INTIND,INTLFT,INTRIT,INTRVL,
     6IOFFST,IPEROD,IPGSHO,IQUOTE,IRANGE,IREVRS,IRTBAS,
     7IRTFTN,IRTOFF,IRUNIN,ISECTN,ISKFTN,ISKIP ,ISPACE,
     8ISTART,ISUBPG,ITLALL,ITLLIN,ITLNXT,ITLSPA,ITRMNL,
     9ITTY  ,IULSPC,IVALUE,IWIZRD,J     ,JCENTR,JDFRFG
      COMMON/RNOTHR/JDFRPG,JDISK ,JFILL ,JFNBGN,JFNGAP,
     1JFNOPN,JFNRED,JFNRIT,JGROUP,JMINUS,JOFFST,JRANGE,
     2JSECTN,JSKIP ,JSTIFY,JTTY  ,JVALUE,K     ,KAPITL,
     3KASALL,KASFLG,KASLCL,KCENTR,KDFRFG,KDISK ,KFNGAP,
     4KLMFIL,KLMMNS,KMINUS,KNDAPP,KNDCHA,KNDFIL,KNDLFT,
     5KNDLIN,KNDPAG,KNDRIT,KNDSPL,KNDSUB,KNDTRN,KNTARG,
     6KNTCOD,KNTFTN,KNTFXD,KNTLIN,KNTLOP,KNTLVL,KNTPAG,
     7KNTPNT,KNTRST,KNTSHO,KNTSPC,KNTSPL,KNTTOP,KNTXTR,
     8KOMAND,KOMENT,KONECT,KPYBGN,KPYKAS,KPYMID,KPYPRT,
     9KRANGE,KSKIP ,KVALUE,LCLBAR,LCLNDX,LCLSUP,KAPNDX
      COMMON/RNOFOU/LDISK ,LENGTH,LEVEL0,LEVEL1,LEVEL3,
     1LEVEL4,LFNGAP,LFTBAS,ILFFTN,LFTOFF,LFTRIT,LINFIG,
     2LINSPL,LITERL,LMTBGN,LMTCHA,LMTCOD,LMTFNR,LMTKAS,
     3LMTLST,LMTLVL,LMTMID,LMTNDX,LMTTAB,LMTTTL,LMTUNT,
     4LMTWRK,LNGBGN,LNGBOT,LNGCHA,LNGFNR,LNGFTN,LNGMID,
     5NXTFTN,LNGPAG,LNGSPL,LNGSRC,LNGTRN,LNGTTL,KNDNDX,
     6LOCABC,LOCATE,LOCPAG,LOCPNT,LOKSUP,LOWBFR,NSKIP ,
     7LRADJS,LRFORC,LSNSPL,LSNSRC,LSTAPP,LSTCHA,LSTELM,
     8LSTFRM,LSTSPL,LSTTRN,MAJOR ,MASTER,MAXBGN,MAXLIN,
     9MAXLOP,MAXSPL,MAXTAB,MAXWRD,MDISK ,MIDAPP,MIDCHA
      COMMON/RNOFIV/MINLVL,MINTOP,MOVBAC,MRGFAR,MRGLFT,
     1MRGRIT,MRGTOP,MRKAMP,MRKBAC,MRKBAR,MRKCAR,MRKDOL,
     2MRKDOT,MRKEFN,MRKEXC,MRKFTN,MRKLES,MRKNDX,MRKNUM,
     3MRKREF,MRKSBX,MRKSEM,MRKSUB,MRKSUP,MRKTTL,MRKTXT,
     4MRKUND,MSTLST,NDISK ,NDXDSK,NDXFOU,NDXHOW,NDXKNT,
     5NDXMAK,NDXONE,NDXOPN,NDXTHR,NDXTWO,NEEDED,NEWCHA,
     6NEWPAG,NOTFIL,NOTIND,NOTKLM,NOTLFT,NOTMNS,NOTONE,
     7NOTRIT,NOTSEM,NOTSKP,NOTSPC,NOTTHR,NOTTST,NOTTWO,
     8NOWBAR,NOWFTN,NOWIND,NOWLFT,NOWLST,NOWOFF,NOWPAG,
     9NOWPHW,NOWRIT,NOWSEC,NOWSHW,NOWSKP,NOWSPH,NOWSUB
      COMMON/RNOSIX/NOWTST,NULTTL,NUMFTN,NXTFIG,NXTHDR,
     1NXTLST,NXTLVL,NXTONE,NXTPAG,NXTSUB,KNDOUT,LNGWRK,
     2KAPFTN,KOFFST,IRECRD,KNTNDX,INIPAG,INIHIA,MAGNFY,
     3INIHIB,IFHALF,KTRMNL,ITTLLO,ISUBLO,LNGTOP,MAGFNT,
     4ITTLHI,ISUBHI,IFINDX,IXTRSS,JXTRSS,KXTRSS,MAGSPC,
     5MXTRSS,NXTRSS,IFORMR,JTRMNL,IFNREF,IFNNUM,KMPPAG,
     6KMPLIN,KMPCLM,KMPVAL,INICLM,MFNGAP,NFNGAP,MAGSAV,
     7MAGSHD,MAGHIH,MRKMAG,LMTSHD,LNGSHD,LFTSHD,IRISHD,
     8IHISHD,ILOSHD,KNTSHD,LFTSGN,IRISGN,NGLSHD,NETNGL,
     9NETSEP,NETWID,NETOFF,NETKNT,KNTEDT,LMTEDT,LMTBIG,
     1LNGBIG,NGLBIG,KNTBIG,NXTSKP,JBORDR,INIMAG,INIOBJ,
     2IBORDR
      COMMON/RNOEIG/INDLST(10)  ,KMDARG(250) ,KMDBRK(250) ,
     1 KNDLVL(6)   ,KNDTTL(16)  ,LOCTAB(32)  ,LSTMRG(10)  ,
     2 LSTRIT(10)  ,LSTSKP(10)  ,LSTSPC(10)  ,LSTTTL(80)  ,
     3 LSTTYP(10)  ,LSTVAL(10)  ,MCHPNT(1300),MSKBGN(300) ,
     4 MSKCHA(200) ,MSKFNR(200) ,MSKFTN(200) ,MSKMID(200) ,
     5 MSKTTL(450) ,NARGMT(44)  ,NBEGIN(19)  ,NMINUS(32)  ,
     6 NOTPNT(1300),NUMLVL(6)   ,NUMNDX(300) ,NUMTTL(11)  ,
     7 NVALUE(32)  ,NXTCMD(81)  ,NXTPNT(12)  ,NXTUNT(4)   ,
     8 MSKWRK(200) ,MTYSTR(4)   ,MAGEDT(50)
      COMMON/RNONIN/LTRAMP,LTRBAC,LTRBAR,LTRCAR,LTRCOM,
     1LTRDOL,LTRDOT,LTREFN,LTREXC,LTRFNC,LTRLES,
     2LTRMNS,LTRNDX,LTRNOW,LTRNUM,LTRPLS,LTRQUO,LTRRUL,
     3LTRSBX,LTRSEM,LTRSPA,LTRSUB,LTRSUP,LTRTAB,
     4LTRPUT,LTRTXT,LTRUND,LTR1ST,LTRMAG
      COMMON/RNOTEN/LTRABC(26)  ,LTRAPP(9)   ,LTRBGN(300) ,
     1 LTRCPT(8)   ,LTRCLS(10)  ,LTRCOD(70)  ,LTRDGT(10)  ,
     2 LTRFLG(18)  ,LTRFTN(200) ,LTRIND(5)   ,LTRLST(10,6),
     3 LTRMID(200) ,LTRONL(26)  ,LTRONU(26)  ,LTROPN(10)  ,
     4 LTRPAG(5)   ,LTRREF(4)   ,LTRSPL(200) ,LTRTWO(4)   ,
     5 LTRTYP(8)   ,LTRWRK(200) ,LWRABC(26)  ,LWRAPP(9)   ,
     6 LWRCHA(8)   ,LWRIND(5)   ,LWRONL(26)  ,LWRONU(26)  ,
     7 LWRTYP(8)   ,LTRTTL(450) ,LTRCHA(200) ,LTRFNR(200) ,
     8 LTRSHD(50)  ,LTRBIG(50)
C
C     FORCE RETENSION OF VARIABLES AND ARRAYS NEEDED FOR
C     PARSING THE USER COMMAND EVEN IF OVERLAY THE PARSER
      CALL RNOCMN
C
C     INITIALIZE THE USER COMMAND PARSER AND ALL STORAGE
      LEVEL0=5
C
C     PERFORM INFREQUENT OPERATIONS
    1 CALL RNOODD
      IF(LEVEL0.EQ.0)GO TO 4
      IF(LEVEL0.EQ.1)GO TO 2
      IF(LEVEL0.NE.5)GO TO 3
C
C     TTYSIM = (CALLED ONLY IF THE OUTPUT IS TO BE  TO  THE
C              DISK) TTYSIM SPECIFIES THAT THE CHARACTER IN
C              COLUMN 1 IS TO BE CONVERTED DIRECTLY TO  THE
C              APPROPRIATE CONTROL CHARACTER.  IF TTYSIM IS
C              CONVERTED TO A DUMMY ROUTINE, THEN THE FIRST
C              CHARACTER  ON  THE  FIRST  LINE OF THE FIRST
C              PAGE WILL BE  A  PLUS  SIGN  AND  THE  FIRST
C              CHARACTER ON THE FIRST LINE OF ALL FOLLOWING
C              PAGES WILL BE  THE  DIGIT  ONE.   ALL  OTHER
C              LINES   WILL   BEGIN   WITH  SPACES.   THESE
C              CHARACTERS   SHOULD   GIVE   THE   FOLLOWING
C              CARRIAGE MOTIONS.
C                   PLUS GIVES NO CARRIAGE MOTION
C                   SPACE GIVES SINGLE LINE ADVANCE
C                   ONE GIVES FORM FEED
C     TTYSET = (CALLED ONLY IF THE OUTPUT IS TO BE  TO  THE
C              TERMINAL)   TTYSET   CHANGES   THE  TERMINAL
C              CHARACTERISTICS TO ALLOW THE TERMINAL TO ACT
C              AS  AN  OUTPUT  TYPEWRITER.   THE  FOLLOWING
C              TERMINAL CHARACTERISTICS ARE SET.
C                   NO CHECKING OF LINE WIDTH
C                   NO CHECKING OF PAGE LENGTH
C                   NO PAUSING AT TOP OF PAGE
C                   LOWER CASE LETTERS
C                   HARDWARE FORM FEEDS
C                   NO HARDWARE TABS
C                   REFUSING OF ALL SYSTEM MESSAGES
C              THESE CHARACTERISTICS WILL HAVE TO BE SET AT
C              THE  MONITOR LEVEL IF TTYSET IS REPLACE BY A
C              DUMMY ROUTINE.
C
    2 IF(ITRMNL.EQ.0)CALL TTYSIM(JDISK)
      IF(ITRMNL.NE.0)CALL TTYSET
C
C     PERFORM ALL BUT MOST INFREQUENT OPERATIONS
    3 CALL RNOALL
      GO TO 1
C
C     LEAVE IS AN ASSEMBLY LANGUAGE ROUTINE FOR THE DECSYSTEM10
C     AND DECSYSTEM20 WHICH EXITS WITHOUT TYPING THE STATISTICS
C     WHICH FORTRAN USUALLY PRODUCES ON THESE COMPUTERS.  THE
C     LEAVE ROUTINE CAN BE SIMULATED BY A SIMPLE FORTRAN ROUTINE
C     CONTAINING EITHER JUST A RETURN OR JUST A STOP STATEMENT.
    4 CALL LEAVE
      STOP
      END
      SUBROUTINE RNOODD
C     RENBR(/ALL INFREQUENTLY PERFORMED OPERATIONS)
C
C     DONALD E. BARTH, YALE SCHOOL OF MANAGEMENT
C
C     THIS MAIN PROGRAM ALLOWS FROFF TO BE LOADED AS 3
C     OVERLAYS, THE FIRST CONTAINING THE USER INTERACTION,
C     THE SECOND CONTAINING ALL FEATURES EXCEPT FOR THE
C     CONSTRUCTION OF INDEX, AND THE THIRD CONTAINING THE
C     INDEX CONSTRUCTION.
C
      COMMON/RNOONE/I     ,IAPNDX,IBRFTN,IBYTE ,ICENTR,
     1ICHAPT,IDEBUG,IDEFER,IDFILE,IDFRFG,IDFRPG,IDISK ,
     2IFABAR,IFAUTO,IFENCE,IFFILL,IFFLAG,IFHEAD,IFLIST,
     3IFLOOP,IFLSUB,IFNATO,IFNBGN,IFNFIL,IFNGAP,
     4IFNGSP,IFNHAV,IFNIBR,IFNICN,IFNIDF,IFNIFA,IFNIIN,
     5IFNILF,IFNIND,IFNIRT,IFNISP,IFNJCN,IFNJDF,IFNJFL,
     6IFNJST,IFNKCN,IFNKDF,IFNKLM,IFNLBR,IFNLBS,IFNLOF,
     7IFNLSP,IFNMBR,IFNMFR,IFNMLF,IFNMNS,IFNMRT,
     8IFNNBR,IFNNIN,IFNNLF,IFNNOF,IFNNOT,IFNNRT,IFNNSK,
     9IFNNTF,IFNNTL,IFNNTR,IFNNTS,IFNNTT,IFNNT1,IFNNT2
      COMMON/RNOTWO/IFNNT3,IFNOFF,IFNOPN,IFNOTE,IFNPIN,
     1IFNPRD,IFNPSK,IFNPTS,IFNRBS,IFNRDY,IFNRED,IFNRIT,
     2IFNROF,IFNTTL,IFNULS,IFNUMB,IFPAGE,IFRSUB,IFSPLC,
     3IGAPHI,IGAPLO,IGROUP,IMINUS,INDENT,INDFTN,INIALL,
     4INIAPP,INIBAR,INICHA,INIFRM,INILIN,ININDX,ININXT,
     5INISPA,INITAL,INNOTE,INTIND,INTLFT,INTRIT,INTRVL,
     6IOFFST,IPEROD,IPGSHO,IQUOTE,IRANGE,IREVRS,IRTBAS,
     7IRTFTN,IRTOFF,IRUNIN,ISECTN,ISKFTN,ISKIP ,ISPACE,
     8ISTART,ISUBPG,ITLALL,ITLLIN,ITLNXT,ITLSPA,ITRMNL,
     9ITTY  ,IULSPC,IVALUE,IWIZRD,J     ,JCENTR,JDFRFG
      COMMON/RNOTHR/JDFRPG,JDISK ,JFILL ,JFNBGN,JFNGAP,
     1JFNOPN,JFNRED,JFNRIT,JGROUP,JMINUS,JOFFST,JRANGE,
     2JSECTN,JSKIP ,JSTIFY,JTTY  ,JVALUE,K     ,KAPITL,
     3KASALL,KASFLG,KASLCL,KCENTR,KDFRFG,KDISK ,KFNGAP,
     4KLMFIL,KLMMNS,KMINUS,KNDAPP,KNDCHA,KNDFIL,KNDLFT,
     5KNDLIN,KNDPAG,KNDRIT,KNDSPL,KNDSUB,KNDTRN,KNTARG,
     6KNTCOD,KNTFTN,KNTFXD,KNTLIN,KNTLOP,KNTLVL,KNTPAG,
     7KNTPNT,KNTRST,KNTSHO,KNTSPC,KNTSPL,KNTTOP,KNTXTR,
     8KOMAND,KOMENT,KONECT,KPYBGN,KPYKAS,KPYMID,KPYPRT,
     9KRANGE,KSKIP ,KVALUE,LCLBAR,LCLNDX,LCLSUP,KAPNDX
      COMMON/RNOFOU/LDISK ,LENGTH,LEVEL0,LEVEL1,LEVEL3,
     1LEVEL4,LFNGAP,LFTBAS,ILFFTN,LFTOFF,LFTRIT,LINFIG,
     2LINSPL,LITERL,LMTBGN,LMTCHA,LMTCOD,LMTFNR,LMTKAS,
     3LMTLST,LMTLVL,LMTMID,LMTNDX,LMTTAB,LMTTTL,LMTUNT,
     4LMTWRK,LNGBGN,LNGBOT,LNGCHA,LNGFNR,LNGFTN,LNGMID,
     5NXTFTN,LNGPAG,LNGSPL,LNGSRC,LNGTRN,LNGTTL,KNDNDX,
     6LOCABC,LOCATE,LOCPAG,LOCPNT,LOKSUP,LOWBFR,NSKIP ,
     7LRADJS,LRFORC,LSNSPL,LSNSRC,LSTAPP,LSTCHA,LSTELM,
     8LSTFRM,LSTSPL,LSTTRN,MAJOR ,MASTER,MAXBGN,MAXLIN,
     9MAXLOP,MAXSPL,MAXTAB,MAXWRD,MDISK ,MIDAPP,MIDCHA
      COMMON/RNOFIV/MINLVL,MINTOP,MOVBAC,MRGFAR,MRGLFT,
     1MRGRIT,MRGTOP,MRKAMP,MRKBAC,MRKBAR,MRKCAR,MRKDOL,
     2MRKDOT,MRKEFN,MRKEXC,MRKFTN,MRKLES,MRKNDX,MRKNUM,
     3MRKREF,MRKSBX,MRKSEM,MRKSUB,MRKSUP,MRKTTL,MRKTXT,
     4MRKUND,MSTLST,NDISK ,NDXDSK,NDXFOU,NDXHOW,NDXKNT,
     5NDXMAK,NDXONE,NDXOPN,NDXTHR,NDXTWO,NEEDED,NEWCHA,
     6NEWPAG,NOTFIL,NOTIND,NOTKLM,NOTLFT,NOTMNS,NOTONE,
     7NOTRIT,NOTSEM,NOTSKP,NOTSPC,NOTTHR,NOTTST,NOTTWO,
     8NOWBAR,NOWFTN,NOWIND,NOWLFT,NOWLST,NOWOFF,NOWPAG,
     9NOWPHW,NOWRIT,NOWSEC,NOWSHW,NOWSKP,NOWSPH,NOWSUB
      COMMON/RNOSIX/NOWTST,NULTTL,NUMFTN,NXTFIG,NXTHDR,
     1NXTLST,NXTLVL,NXTONE,NXTPAG,NXTSUB,KNDOUT,LNGWRK,
     2KAPFTN,KOFFST,IRECRD,KNTNDX,INIPAG,INIHIA,MAGNFY,
     3INIHIB,IFHALF,KTRMNL,ITTLLO,ISUBLO,LNGTOP,MAGFNT,
     4ITTLHI,ISUBHI,IFINDX,IXTRSS,JXTRSS,KXTRSS,MAGSPC,
     5MXTRSS,NXTRSS,IFORMR,JTRMNL,IFNREF,IFNNUM,KMPPAG,
     6KMPLIN,KMPCLM,KMPVAL,INICLM,MFNGAP,NFNGAP,MAGSAV,
     7MAGSHD,MAGHIH,MRKMAG,LMTSHD,LNGSHD,LFTSHD,IRISHD,
     8IHISHD,ILOSHD,KNTSHD,LFTSGN,IRISGN,NGLSHD,NETNGL,
     9NETSEP,NETWID,NETOFF,NETKNT,KNTEDT,LMTEDT,LMTBIG,
     1LNGBIG,NGLBIG,KNTBIG,NXTSKP,JBORDR,INIMAG,INIOBJ,
     2IBORDR
      COMMON/RNOEIG/INDLST(10)  ,KMDARG(250) ,KMDBRK(250) ,
     1 KNDLVL(6)   ,KNDTTL(16)  ,LOCTAB(32)  ,LSTMRG(10)  ,
     2 LSTRIT(10)  ,LSTSKP(10)  ,LSTSPC(10)  ,LSTTTL(80)  ,
     3 LSTTYP(10)  ,LSTVAL(10)  ,MCHPNT(1300),MSKBGN(300) ,
     4 MSKCHA(200) ,MSKFNR(200) ,MSKFTN(200) ,MSKMID(200) ,
     5 MSKTTL(450) ,NARGMT(44)  ,NBEGIN(19)  ,NMINUS(32)  ,
     6 NOTPNT(1300),NUMLVL(6)   ,NUMNDX(300) ,NUMTTL(11)  ,
     7 NVALUE(32)  ,NXTCMD(81)  ,NXTPNT(12)  ,NXTUNT(4)   ,
     8 MSKWRK(200) ,MTYSTR(4)   ,MAGEDT(50)
      COMMON/RNONIN/LTRAMP,LTRBAC,LTRBAR,LTRCAR,LTRCOM,
     1LTRDOL,LTRDOT,LTREFN,LTREXC,LTRFNC,LTRLES,
     2LTRMNS,LTRNDX,LTRNOW,LTRNUM,LTRPLS,LTRQUO,LTRRUL,
     3LTRSBX,LTRSEM,LTRSPA,LTRSUB,LTRSUP,LTRTAB,
     4LTRPUT,LTRTXT,LTRUND,LTR1ST,LTRMAG
      COMMON/RNOTEN/LTRABC(26)  ,LTRAPP(9)   ,LTRBGN(300) ,
     1 LTRCPT(8)   ,LTRCLS(10)  ,LTRCOD(70)  ,LTRDGT(10)  ,
     2 LTRFLG(18)  ,LTRFTN(200) ,LTRIND(5)   ,LTRLST(10,6),
     3 LTRMID(200) ,LTRONL(26)  ,LTRONU(26)  ,LTROPN(10)  ,
     4 LTRPAG(5)   ,LTRREF(4)   ,LTRSPL(200) ,LTRTWO(4)   ,
     5 LTRTYP(8)   ,LTRWRK(200) ,LWRABC(26)  ,LWRAPP(9)   ,
     6 LWRCHA(8)   ,LWRIND(5)   ,LWRONL(26)  ,LWRONU(26)  ,
     7 LWRTYP(8)   ,LTRTTL(450) ,LTRCHA(200) ,LTRFNR(200) ,
     8 LTRSHD(50)  ,LTRBIG(50)
C
C     LEVEL0 DETERMINES WHY THIS ROUTINE WAS CALLED
      GO TO(2,8,12,11,1,9,13),LEVEL0
C
C     FIRST TIME CALLED, USER HAS NOT YET BEEN ASKED ANYTHING
C     GET UNIQUE NUMBER TO USE IN CONSTRUCTING FILE NAMES
    1 CALL RNONAM(IDFILE)
      MASTER=0
      GO TO 10
C
C     ALL FILES IN PREVIOUS REQUEST HAVE BEEN PROCESSED
    2 MASTER=1
      CALL RNOEND(2,IDISK,JDISK)
      IF(ITRMNL.LE.0)GO TO 4
      IF(KNTSHO.NE.0)READ(JTTY,3)I
    3 FORMAT(1A1)
    4 IF(KNTSHO.GT.0)GO TO 6
      WRITE(ITTY,5)
    5 FORMAT(12H Pages: NONE)
      GO TO 10
    6 WRITE(ITTY,7)KNTSHO
    7 FORMAT(7H Pages:,I5)
      GO TO 10
C
C     DETERMINE AVAILABLE UNIT NUMBER FOR SPLICE FILE
    8 CALL RNOFIL(4,4,NDISK,NXTUNT,LMTUNT,ITTY,JTTY,
     1IDFILE)
      MASTER=2
      GO TO 10
C
C     FILE PROCESSED, BUT ANOTHER MAY STILL CONTINUE THIS
    9 MASTER=3
      CALL RNOEND(1,IDISK,JDISK)
C
C     ASK USER FOR NAME OF NEXT FILE
   10 CALL RNOASK(MASTER,ITTY,JTTY,IDISK,JDISK,NDISK,JOFFST,
     1ITRMNL,JTRMNL,IRANGE,JRANGE,KRANGE)
C     MASTER = -1, NOT FIRST TIME RNOASK CALLED, BUT USER
C              HAS SPECIFIED THAT ANOTHER FILE BE PROCESSED
C            = 0, FIRST TIME RNOASK WAS CALLED
C            = 1, MASTER WAS INPUT SET TO 1, AND NO
C              FILES WERE SPECIFIED BY USER.
C            = 2, SPLICE FILE OPENED
      IF(LEVEL0.EQ.2)GO TO 61
      IF(LEVEL0.EQ.6)GO TO 61
      IF(MASTER.EQ.1)GO TO 60
C
C     CALL RNONEW TO INITIALIZE OR TO RESET VARIABLES
C     MASTER = 0, PREPARE FOR FIRST INPUT FILE.
C              INITIALIZE EVERYTHING INCLUDING SORTED
C              ALPHABETS
C            = -1, PREPARE FOR 2ND OR FOLLOWING INPUT FILE.
C              INITIALIZE EVERYTHING EXCEPT ALPHABETS
C              WHICH ARE NEVER CHANGED DURING EXECUTION.
C              DISCARD REST OF CURRENT INPUT LINE
C            = 1, .RESET ALL COMMAND.
C              INITIALIZE EVERYTHING EXCEPT ALPHABETS
C              AND WHETHER NEXT PAGE IS FIRST OUTPUT PAGE
C              AND WHETHER DEBUG SWITCH IS ON.
C            = 2, .RESET COMMAND.
C              INITIALIZE EVERYTHING EXCEPT ALPHABETS.
C              RETAIN THE REST OF CURRENT INPUT LINE
C              AND LOOP VALUES AND SPLICE FILE.
   11 CALL RNONEW
      GO TO 61
C
C     CONSTRUCT THE INDEX
   12 CALL RNONDX
      GO TO 61
C
C     STORE LETTERS TO BE MAGNIFIED
   13 IF(MAGNFY.GT.0)GO TO 18
      MAGSAV=ISPACE
      ISPACE=0
      KNTBIG=NGLBIG
      MAGNFY=1
      IF(INIMAG.LT.0)INIMAG=1
      LNGBGN=LNGBGN-KPYBGN
      KPYMID=KPYBGN
      KPYBGN=0
   14 IF(KPYBGN.GE.LNGBGN)GO TO 17
      KPYBGN=KPYBGN+1
      KPYMID=KPYMID+1
      LTRNOW=LTRBGN(KPYMID)
      DO 15 I=1,26
      IF(LTRNOW.NE.LWRABC(I))GO TO 15
      LTRNOW=LTRABC(I)
      GO TO 16
   15 CONTINUE
   16 LTRBGN(KPYBGN)=LTRNOW
      MSKBGN(KPYBGN)=MSKBGN(KPYMID)
      GO TO 14
   17 KPYMID=0
      LNGMID=0
      MAGLIN=1
      GO TO 19
C
C     ALLOW FOR SHADOWS BELOW LETTERS
   18 MAGLIN=MAGNFY
      IF(MAGSHD.EQ.0)GO TO 19
      IF(MAGLIN.LE.MAGHIH)GO TO 19
      MAGLIN=(2*MAGHIH)-MAGNFY+1
C
C     CONSTRUCT MAGNIFIED LETTERS
   19 LNGMID=0
      CALL RNOBIG(MAGFNT,MAGLIN,-1,0,MAGSPC,
     11,0,LTRBGN,1,LNGBGN,0,LMTMID,
     2LMTMID,LTRMID,LNGMID,MAGHIH,MAGOVR,MSKBGN,MRKMAG,
     3LTRMAG)
C     SUBROUTINE RNOBIG(MAGFNT,MAGLIN,JSTIFY,IFILL ,MAGSPC,
C    1    MOVE  ,ISPACE,LTRBGN,MAGBGN,LNGBGN,LFTCOL,IWIDTH,
C    2    LMTMID,LTRMID,LNGMID,MAGMAX,MAGOVR,MSKBGN,MRKMAG,
C    3    LTRMAG)
C
C     EDIT THE MAGNIFIED TEXT
      IF(KNTEDT.LE.0)GO TO 25
      I=1
      J=1
      K=0
   20 IF(I.GT.KNTEDT)GO TO 21
      IF(MAGEDT(I).GE.J)GO TO 21
      I=I+1
      GO TO 20
   21 IF(J.GT.LNGMID)GO TO 24
      IF(I.GT.KNTEDT)GO TO 23
      IF(J.NE.MAGEDT(I))GO TO 23
      IF(I.GE.KNTEDT)GO TO 22
      L=MAGEDT(I+1)
      IF(L.GE.0)GO TO 22
      J=J-L
      I=I+2
      GO TO 20
   22 I=I+1
      J=J+1
      GO TO 20
   23 K=K+1
      LTRMID(K)=LTRMID(J)
      J=J+1
      GO TO 20
   24 LNGMID=K
   25 CONTINUE
C
C     JUSTIFY THE MAGNIFIED TEXT
      NEEDED=MRGLFT
      IF(JFILL.EQ.0)GO TO 31
      GO TO(26,27,28,29,30,28),JFILL
C     CENTER COMMAND
   26 IF(KCENTR.LE.0)NEEDED=((MRGFAR+ICENTR-LNGMID)/2)
      IF(KCENTR.GT.0)NEEDED=((ICENTR-LNGMID)/2)
      GO TO 31
C     RIGHT COMMAND
   27 NEEDED=MRGRIT-LNGMID-ICENTR
      GO TO 31
C     FLUSH LEFT COMMAND
   28 IF(KCENTR.LE.0)NEEDED=MRGLFT+ICENTR
      IF(KCENTR.GT.0)NEEDED=ICENTR
      GO TO 31
C     MIDDLE COMMAND
   29 IF(KCENTR.LE.0)NEEDED=MRGLFT+
     1((MRGRIT-MRGLFT-LNGMID)/2)+ICENTR
      IF(KCENTR.GT.0)NEEDED=ICENTR-(LNGMID/2)
      GO TO 31
C     FLUSH RIGHT COMMAND
   30 IF(KCENTR.LE.0)NEEDED=MRGRIT-LNGMID+ICENTR
      IF(KCENTR.GT.0)NEEDED=ICENTR-LNGMID
   31 IF(NEEDED.LT.0)NEEDED=0
C
C     ADJUST POSITION OF SHADOW
      KOLUMN=0
      IF(MAGSHD.EQ.0)GO TO 32
      IF(MAGNFY.LE.MAGHIH)GO TO 32
      KOLUMN=MAGNFY-MAGHIH
      IF(MAGSHD.EQ.1)KOLUMN=-KOLUMN
      IF(MAGSHD.EQ.3)KOLUMN=-KOLUMN+1
      IF(MAGSHD.EQ.4)KOLUMN=KOLUMN-1
      NEEDED=NEEDED+KOLUMN
   32 CONTINUE
C
C     BRANCH TO SHADOW CONSTRUCTION CODE
      IF(MAGSHD.EQ.0)GO TO 46
      IF(MAGNFY.LE.MAGHIH)GO TO 46
      IF(MAGSHD.LE.2)GO TO 46
      IF(LNGMID.LE.0)GO TO 46
      IF(MAGSHD.EQ.4)GO TO 39
C
C     REVERSE SHADOW CAST TO LEFT
      I=0
   33 I=I+1
      IF(I.GT.LNGMID)GO TO 34
      IF(LTRMID(I).EQ.LTRSPA)GO TO 33
      LTRNOW=LTRMID(I)
      GO TO 36
   34 I=0
   35 I=I+1
      IF(I.GT.LNGBGN)GO TO 46
      IF(LTRBGN(I).EQ.LTRSPA)GO TO 35
      LTRNOW=LTRBGN(I)
      GO TO 36
   36 I=LNGMID+1
   37 I=I-1
      IF(I.LE.0)GO TO 46
      IF(LTRMID(I).EQ.LTRSPA)GO TO 38
      LTRNOW=LTRMID(I)
      LTRMID(I)=LTRSPA
      GO TO 37
   38 LTRMID(I)=LTRNOW
      GO TO 37
C
C     REVERSE SHADOW CAST TO RIGHT
   39 I=LNGMID+1
   40 I=I-1
      IF(I.LE.0)GO TO 41
      IF(LTRMID(I).EQ.LTRSPA)GO TO 40
      LTRNOW=LTRMID(I)
      GO TO 43
   41 I=LNGBGN+1
   42 I=I-1
      IF(I.LE.0)GO TO 46
      IF(LTRBGN(I).EQ.LTRSPA)GO TO 42
      LTRNOW=LTRBGN(I)
      GO TO 43
   43 I=0
   44 I=I+1
      IF(I.GT.LNGMID)GO TO 46
      IF(LTRMID(I).EQ.LTRSPA)GO TO 45
      LTRNOW=LTRMID(I)
      LTRMID(I)=LTRSPA
      GO TO 44
   45 LTRMID(I)=LTRNOW
      GO TO 44
   46 CONTINUE
C
C     CHANGE PRINTING CHARACTERS TO REPEATED PHRASE
      IF(LNGBIG.LE.0)GO TO 51
      IF(LNGMID.LE.0)GO TO 51
      I=NGLBIG
      IF(I.LE.(-LNGBIG))I=0
      IF(I.GE.LNGBIG)I=0
      IF(KOLUMN.LT.0)I=I+1
      IF(KOLUMN.GT.0)I=I-1
      KNTBIG=KNTBIG-I
      IF(I.GT.0)GO TO 47
      IF(KNTBIG.GE.LNGBIG)KNTBIG=KNTBIG-LNGBIG
      GO TO 48
   47 IF(KNTBIG.LT.0)KNTBIG=KNTBIG+LNGBIG
   48 KOLUMN=KNTBIG
      DO 50 I=1,LNGMID
      KOLUMN=KOLUMN+1
      IF(KOLUMN.GT.LNGBIG)KOLUMN=1
      IF(LTRMID(I).EQ.LTRSPA)GO TO 50
      IF(INIMAG.LE.0)GO TO 49
      INIMAG=-1
      KNTBIG=KNTBIG-KOLUMN+1
      IF(KNTBIG.LT.0)KNTBIG=KNTBIG+LNGBIG
      KOLUMN=1
   49 LTRMID(I)=LTRBIG(KOLUMN)
   50 CONTINUE
   51 CONTINUE
C
C     SHIFT LETTERING TO LEFT
      IF(NEEDED.GE.0)GO TO 54
      I=0
      J=-NEEDED
   52 IF(J.GE.LNGMID)GO TO 53
      I=I+1
      J=J+1
      LTRMID(I)=LTRMID(J)
      MSKMID(I)=0
      GO TO 52
   53 LNGMID=I
      GO TO 57
C
C     SHIFT LETTERING TO RIGHT
   54 I=LNGMID+NEEDED
      J=LNGMID
      IF(I.GT.LMTMID)I=LMTMID
      LNGMID=I
   55 IF(J.LE.0)GO TO 56
      LTRMID(I)=LTRMID(J)
      MSKMID(I)=0
      I=I-1
      J=J-1
      GO TO 55
   56 IF(I.LE.0)GO TO 57
      LTRMID(I)=LTRSPA
      MSKMID(I)=0
      I=I-1
      GO TO 56
   57 CONTINUE
C
C     PREPARE FOR NEXT LINE TO BE MAGNIFIED
      KPYMID=LNGMID
      KPYBGN=-1
      MAGNFY=MAGNFY+1
      IF(MAGSHD.NE.0)GO TO 58
      IF(MAGNFY.LE.MAGHIH)GO TO 61
      GO TO 59
   58 IF(MAGNFY.LE.(2*MAGHIH))GO TO 61
   59 KPYBGN=LNGBGN
      MAGNFY=0
      KNTEDT=0
      GO TO 61
C
C     FIRST FILE HAS BEEN COMPLETELY PROCESSED AND THE
C     USER HAS NOT SPECIFIED A SECOND FILE TO PROCESS
   60 LEVEL0=0
   61 RETURN
      END
      SUBROUTINE RNONEW
C     RENBR(/RETURN CONDITIONS TO ORIGINAL SETTINGS)
C
C     DONALD E. BARTH, YALE SCHOOL OF MANAGEMENT
C
      COMMON/RNOONE/I     ,IAPNDX,IBRFTN,IBYTE ,ICENTR,
     1ICHAPT,IDEBUG,IDEFER,IDFILE,IDFRFG,IDFRPG,IDISK ,
     2IFABAR,IFAUTO,IFENCE,IFFILL,IFFLAG,IFHEAD,IFLIST,
     3IFLOOP,IFLSUB,IFNATO,IFNBGN,IFNFIL,IFNGAP,
     4IFNGSP,IFNHAV,IFNIBR,IFNICN,IFNIDF,IFNIFA,IFNIIN,
     5IFNILF,IFNIND,IFNIRT,IFNISP,IFNJCN,IFNJDF,IFNJFL,
     6IFNJST,IFNKCN,IFNKDF,IFNKLM,IFNLBR,IFNLBS,IFNLOF,
     7IFNLSP,IFNMBR,IFNMFR,IFNMLF,IFNMNS,IFNMRT,
     8IFNNBR,IFNNIN,IFNNLF,IFNNOF,IFNNOT,IFNNRT,IFNNSK,
     9IFNNTF,IFNNTL,IFNNTR,IFNNTS,IFNNTT,IFNNT1,IFNNT2
      COMMON/RNOTWO/IFNNT3,IFNOFF,IFNOPN,IFNOTE,IFNPIN,
     1IFNPRD,IFNPSK,IFNPTS,IFNRBS,IFNRDY,IFNRED,IFNRIT,
     2IFNROF,IFNTTL,IFNULS,IFNUMB,IFPAGE,IFRSUB,IFSPLC,
     3IGAPHI,IGAPLO,IGROUP,IMINUS,INDENT,INDFTN,INIALL,
     4INIAPP,INIBAR,INICHA,INIFRM,INILIN,ININDX,ININXT,
     5INISPA,INITAL,INNOTE,INTIND,INTLFT,INTRIT,INTRVL,
     6IOFFST,IPEROD,IPGSHO,IQUOTE,IRANGE,IREVRS,IRTBAS,
     7IRTFTN,IRTOFF,IRUNIN,ISECTN,ISKFTN,ISKIP ,ISPACE,
     8ISTART,ISUBPG,ITLALL,ITLLIN,ITLNXT,ITLSPA,ITRMNL,
     9ITTY  ,IULSPC,IVALUE,IWIZRD,J     ,JCENTR,JDFRFG
      COMMON/RNOTHR/JDFRPG,JDISK ,JFILL ,JFNBGN,JFNGAP,
     1JFNOPN,JFNRED,JFNRIT,JGROUP,JMINUS,JOFFST,JRANGE,
     2JSECTN,JSKIP ,JSTIFY,JTTY  ,JVALUE,K     ,KAPITL,
     3KASALL,KASFLG,KASLCL,KCENTR,KDFRFG,KDISK ,KFNGAP,
     4KLMFIL,KLMMNS,KMINUS,KNDAPP,KNDCHA,KNDFIL,KNDLFT,
     5KNDLIN,KNDPAG,KNDRIT,KNDSPL,KNDSUB,KNDTRN,KNTARG,
     6KNTCOD,KNTFTN,KNTFXD,KNTLIN,KNTLOP,KNTLVL,KNTPAG,
     7KNTPNT,KNTRST,KNTSHO,KNTSPC,KNTSPL,KNTTOP,KNTXTR,
     8KOMAND,KOMENT,KONECT,KPYBGN,KPYKAS,KPYMID,KPYPRT,
     9KRANGE,KSKIP ,KVALUE,LCLBAR,LCLNDX,LCLSUP,KAPNDX
      COMMON/RNOFOU/LDISK ,LENGTH,LEVEL0,LEVEL1,LEVEL3,
     1LEVEL4,LFNGAP,LFTBAS,ILFFTN,LFTOFF,LFTRIT,LINFIG,
     2LINSPL,LITERL,LMTBGN,LMTCHA,LMTCOD,LMTFNR,LMTKAS,
     3LMTLST,LMTLVL,LMTMID,LMTNDX,LMTTAB,LMTTTL,LMTUNT,
     4LMTWRK,LNGBGN,LNGBOT,LNGCHA,LNGFNR,LNGFTN,LNGMID,
     5NXTFTN,LNGPAG,LNGSPL,LNGSRC,LNGTRN,LNGTTL,KNDNDX,
     6LOCABC,LOCATE,LOCPAG,LOCPNT,LOKSUP,LOWBFR,NSKIP ,
     7LRADJS,LRFORC,LSNSPL,LSNSRC,LSTAPP,LSTCHA,LSTELM,
     8LSTFRM,LSTSPL,LSTTRN,MAJOR ,MASTER,MAXBGN,MAXLIN,
     9MAXLOP,MAXSPL,MAXTAB,MAXWRD,MDISK ,MIDAPP,MIDCHA
      COMMON/RNOFIV/MINLVL,MINTOP,MOVBAC,MRGFAR,MRGLFT,
     1MRGRIT,MRGTOP,MRKAMP,MRKBAC,MRKBAR,MRKCAR,MRKDOL,
     2MRKDOT,MRKEFN,MRKEXC,MRKFTN,MRKLES,MRKNDX,MRKNUM,
     3MRKREF,MRKSBX,MRKSEM,MRKSUB,MRKSUP,MRKTTL,MRKTXT,
     4MRKUND,MSTLST,NDISK ,NDXDSK,NDXFOU,NDXHOW,NDXKNT,
     5NDXMAK,NDXONE,NDXOPN,NDXTHR,NDXTWO,NEEDED,NEWCHA,
     6NEWPAG,NOTFIL,NOTIND,NOTKLM,NOTLFT,NOTMNS,NOTONE,
     7NOTRIT,NOTSEM,NOTSKP,NOTSPC,NOTTHR,NOTTST,NOTTWO,
     8NOWBAR,NOWFTN,NOWIND,NOWLFT,NOWLST,NOWOFF,NOWPAG,
     9NOWPHW,NOWRIT,NOWSEC,NOWSHW,NOWSKP,NOWSPH,NOWSUB
      COMMON/RNOSIX/NOWTST,NULTTL,NUMFTN,NXTFIG,NXTHDR,
     1NXTLST,NXTLVL,NXTONE,NXTPAG,NXTSUB,KNDOUT,LNGWRK,
     2KAPFTN,KOFFST,IRECRD,KNTNDX,INIPAG,INIHIA,MAGNFY,
     3INIHIB,IFHALF,KTRMNL,ITTLLO,ISUBLO,LNGTOP,MAGFNT,
     4ITTLHI,ISUBHI,IFINDX,IXTRSS,JXTRSS,KXTRSS,MAGSPC,
     5MXTRSS,NXTRSS,IFORMR,JTRMNL,IFNREF,IFNNUM,KMPPAG,
     6KMPLIN,KMPCLM,KMPVAL,INICLM,MFNGAP,NFNGAP,MAGSAV,
     7MAGSHD,MAGHIH,MRKMAG,LMTSHD,LNGSHD,LFTSHD,IRISHD,
     8IHISHD,ILOSHD,KNTSHD,LFTSGN,IRISGN,NGLSHD,NETNGL,
     9NETSEP,NETWID,NETOFF,NETKNT,KNTEDT,LMTEDT,LMTBIG,
     1LNGBIG,NGLBIG,KNTBIG,NXTSKP,JBORDR,INIMAG,INIOBJ,
     2IBORDR
      COMMON/RNOEIG/INDLST(10)  ,KMDARG(250) ,KMDBRK(250) ,
     1 KNDLVL(6)   ,KNDTTL(16)  ,LOCTAB(32)  ,LSTMRG(10)  ,
     2 LSTRIT(10)  ,LSTSKP(10)  ,LSTSPC(10)  ,LSTTTL(80)  ,
     3 LSTTYP(10)  ,LSTVAL(10)  ,MCHPNT(1300),MSKBGN(300) ,
     4 MSKCHA(200) ,MSKFNR(200) ,MSKFTN(200) ,MSKMID(200) ,
     5 MSKTTL(450) ,NARGMT(44)  ,NBEGIN(19)  ,NMINUS(32)  ,
     6 NOTPNT(1300),NUMLVL(6)   ,NUMNDX(300) ,NUMTTL(11)  ,
     7 NVALUE(32)  ,NXTCMD(81)  ,NXTPNT(12)  ,NXTUNT(4)   ,
     8 MSKWRK(200) ,MTYSTR(4)   ,MAGEDT(50)
      COMMON/RNONIN/LTRAMP,LTRBAC,LTRBAR,LTRCAR,LTRCOM,
     1LTRDOL,LTRDOT,LTREFN,LTREXC,LTRFNC,LTRLES,
     2LTRMNS,LTRNDX,LTRNOW,LTRNUM,LTRPLS,LTRQUO,LTRRUL,
     3LTRSBX,LTRSEM,LTRSPA,LTRSUB,LTRSUP,LTRTAB,
     4LTRPUT,LTRTXT,LTRUND,LTR1ST,LTRMAG
      COMMON/RNOTEN/LTRABC(26)  ,LTRAPP(9)   ,LTRBGN(300) ,
     1 LTRCPT(8)   ,LTRCLS(10)  ,LTRCOD(70)  ,LTRDGT(10)  ,
     2 LTRFLG(18)  ,LTRFTN(200) ,LTRIND(5)   ,LTRLST(10,6),
     3 LTRMID(200) ,LTRONL(26)  ,LTRONU(26)  ,LTROPN(10)  ,
     4 LTRPAG(5)   ,LTRREF(4)   ,LTRSPL(200) ,LTRTWO(4)   ,
     5 LTRTYP(8)   ,LTRWRK(200) ,LWRABC(26)  ,LWRAPP(9)   ,
     6 LWRCHA(8)   ,LWRIND(5)   ,LWRONL(26)  ,LWRONU(26)  ,
     7 LWRTYP(8)   ,LTRTTL(450) ,LTRCHA(200) ,LTRFNR(200) ,
     8 LTRSHD(50)  ,LTRBIG(50)
C
      IF(MASTER.NE.0)GO TO 7
C
C     SORT LOWER CASE  LETTERS  INTO  INCREASING  NUMERICAL
C     ORDER,   KEEPING   UPPER   CASE   LETTERS   PARALLEL.
C     RESULTING SORTED ARRAYS ARE USED IN A TERNARY SEARCH.
      DO 1 I=1,26
      LTRONL(I)=LTRABC(I)
    1 LWRONL(I)=LWRABC(I)
      DO 3 I=1,25
      J=I
      LTRNOW=LWRONL(I)
      DO 2 K=I,26
      IF(LTRNOW.LE.LWRONL(K))GO TO 2
      J=K
      LTRNOW=LWRONL(K)
    2 CONTINUE
      LWRONL(J)=LWRONL(I)
      LWRONL(I)=LTRNOW
      LTRNOW=LTRONL(J)
      LTRONL(J)=LTRONL(I)
    3 LTRONL(I)=LTRNOW
C
C     SORT UPPER CASE  LETTERS  INTO  INCREASING  NUMERICAL
C     ORDER,   KEEPING   LOWER   CASE   LETTERS   PARALLEL.
C     RESULTING SORTED ARRAYS ARE USED IN A TERNARY SEARCH.
      DO 4 I=1,26
      LTRONU(I)=LTRABC(I)
    4 LWRONU(I)=LWRABC(I)
      DO 6 I=1,25
      J=I
      LTRNOW=LTRONU(I)
      DO 5 K=I,26
      IF(LTRNOW.LE.LTRONU(K))GO TO 5
      J=K
      LTRNOW=LTRONU(K)
    5 CONTINUE
      LTRONU(J)=LTRONU(I)
      LTRONU(I)=LTRNOW
      LTRNOW=LWRONU(J)
      LWRONU(J)=LWRONU(I)
    6 LWRONU(I)=LTRNOW
      IBYTE=KNTPNT+1
C
C     ********************************
C     *                              *
C     *  PREPARE FOR NEW INPUT FILE  *
C     *                              *
C     ********************************
C
    7 IF(MASTER.GT.1)GO TO 9
      IF(MASTER.GT.0)GO TO 8
      KNTPAG=0
      KNTSHO=0
    8 KNTRST=0
      KNTLIN=0
      LNGBGN=0
      KPYBGN=0
      MAXBGN=132
      LMTKAS=132
      IFLOOP=0
      IFSPLC=0
      KNDSPL=0
      INIFRM=0
      IF(ITRMNL.NE.0)INIFRM=1
      IF(IRANGE.LE.0)IRANGE=1
      IWIZRD=0
      JSKIP=0
      KNTCOD=KNTFXD
      LSTFRM=ITRMNL
      IFHALF=0
      KRANGE=1
      IF(IRANGE.GT.JRANGE)KRANGE=-1
      KMPPAG=-1
      KTRMNL=JTRMNL
C
C     ***************************************************
C     *                                                 *
C     *  REDEFINE CONDITIONS WHICH COMMANDS CAN CHANGE  *
C     *                                                 *
C     ***************************************************
C
    9 ITLNXT=0
      ITLALL=0
      ITLSPA=0
      ITLLIN=0
      LCLSUP=0
      LOKSUP=0
C
C     NEW PAGE
      MAXLIN=58
      LNGPAG=58
      LNGBOT=0
      LOCPAG=0
      NEWPAG=-1
      NULTTL=-1
      KNDLIN=0
      ISKIP=-1
C
C     .PAGING
      IFPAGE=-1
C
C     INDICATE THAT NO TOP OF PAGE YET GENERATED
      KNTTOP=0
C
C     .DISPLAY APPENDIX LU
      KNDAPP=7
C
C     .DISPLAY CHAPTER D
      KNDCHA=1
C
C     .DISPLAY NUMBER D
      KNDPAG=1
      NOWPHW=KNDPAG
C
C     .DISPLAY SUBPAGE LU
      KNDSUB=7
      NOWSPH=KNDSUB
C
C     NO ACTIVE SUBPAGE
      ISUBPG=-2
C
C     .SPACE INDEX 0,4,2,2
      NDXONE=0
      NDXTWO=4
      NDXTHR=2
      NDXFOU=2
C
C     .DISPLAY INDEX D
      NDXHOW=1
C
C     .ENABLE INDEX
      IFINDX=1
C
C     .NO UNDERLINE SPACE
      IULSPC=1
C
C     .END FOOT NOTE
      IFNOTE=0
      IFNOPN=0
      JFNOPN=0
      IFNRIT=0
      IFNRED=0
      JFNRIT=0
      JFNRED=0
      IFNTTL=0
      IFNRDY=0
      IFNHAV=0
      IFORMR=0
C
C     .END NOTE
      INNOTE=0
C
C     .NO FOOT NOTE HEADER
      IFNGAP=0
      LNGFNR=0
C
C     .SPACE FOOT NOTE 1,0,0
      KFNGAP=1
      JFNGAP=0
      LFNGAP=0
      MFNGAP=KFNGAP
      NFNGAP=JFNGAP
C
C     SPACE NOTES 2,1,2
      NOTONE=2
      NOTTWO=1
      NOTTHR=2
C
C     INDENT NOTES 0,4,-4
      INTIND=0
      INTLFT=4
      INTRIT=-4
C
C     .NUMBER 1
      NXTPAG=1
      NOWPAG=NXTPAG
      IFNUMB=1
C
C     .NUMBER SUBPAGE 1
      NXTSUB=1
C
C     NO SUBPAGE ACTIVE
      NOWSUB=0
C
C     NO SHADOW TRANSFORM COMMAND ACTIVE
      KNDTRN=0
      LNGTRN=0
      LSTTRN=0
      NSKIP=0
C
C     NO CHAPTER ACTIVE
      JSECTN=0
      NOWSEC=0
      NOWSHW=0
C
C     HEADER
      IFHEAD=1
C
C     .SHOW PAGE
      IPGSHO=1
C
C     NO ACTIVE COMMAND
      KOMAND=0
C
C     .INPUT WIDTH 132
      LNGSRC=132
C     NOTE THAT LNGSPL=132 IS SET IN RNOSET
C
C     .UPPER CASE
      KASLCL=0
      KASALL=0
C
C     .INDENT 0
      INDENT=0
C
C     .INDENT FOOTNOTES 0
      INDFTN=0
C
C     .FILL
      JFILL=0
      IFFILL=0
      ICENTR=0
      JCENTR=0
      KCENTR=0
      KLMFIL=ICENTR
      KLMMNS=KCENTR
C
C     .PARAGRAPH 5,1,2
      NOWIND=5
      NOWSKP=1
      NOWTST=3
C
C     PARAGRAPH SPECIFICATIONS INSIDE NOTE
      NOTIND=NOWIND
      NOTSKP=NOWSKP
      NOTTST=NOWTST
C
C     .NO AUTO PARAGRAPH
      IFAUTO=0
C
C     .OFFSET 0
      NOWOFF=JOFFST
      IOFFST=JOFFST
C
C     .OFFSET LEFT 0
      LFTOFF=JOFFST
      LFTBAS=JOFFST
C
C     .OFFSET RIGHT 0
      IRTOFF=JOFFST
      IRTBAS=JOFFST
C
C     .LEFT MARGIN 0
      NOWLFT=0
      MRGLFT=NOWLFT
C
C     .RIGHT MARGIN 60
      NOWRIT=60
      MRGFAR=NOWRIT
      MRGRIT=NOWRIT
C
C     NO ACTIVE HEADER LEVELS
      NXTHDR=0
      KSKIP=0
      KNTLVL=0
      NXTLVL=0
      DO 10 I=1,LMTLVL
      KNDLVL(I)=1
      NUMLVL(I)=0
   10 CONTINUE
      NUMLVL(1)=1
C
C     .SPACE LEVELS 3,1
      LEVEL1=3
      LEVEL3=1
C
C     .INDENT LEVELS 0
      LEVEL4=0
C
C     .STYLE HEADERS 3,1,6,1
      IRUNIN=3
      KAPITL=1
      INITAL=6
      MINLVL=2
C
C     .STYLE INDEX -1,1
      KNDNDX=-1
      KAPNDX=1
C
C     .TAB STOPS 8,16,24,32 ...
      MAXTAB=LMTTAB
      DO 11 I=1,MAXTAB
      LOCTAB(I)=8*I
   11 CONTINUE
C
C     .SPACING 1
      ISPACE=0
C
C     .DISABLE BAR
      MRKBAR=0
      NOWBAR=0
      LCLBAR=0
      INIBAR=0
      IFABAR=0
C
C     .PERIOD
      IPEROD=1
C
C     .JUSTIFY
      JSTIFY=1
      IREVRS=1
C
C     .CARRIAGE
      LTR1ST=LTRSPA
C
C     SET INITIAL FLAGS
      LTRSEM=LTRFLG(1)
      LTRLES=LTRFLG(2)
      LTRDOT=LTRFLG(3)
      LTRDOL=LTRFLG(4)
      LTRBAC=LTRFLG(5)
      LTRUND=LTRFLG(6)
      LTREXC=LTRFLG(7)
      LTRNUM=LTRFLG(8)
      LTRCAR=LTRFLG(9)
      LTRAMP=LTRFLG(10)
      LTREFN=LTRFLG(11)
      LTRTXT=LTRFLG(12)
      LTRNDX=LTRFLG(13)
      LTRSBX=LTRFLG(14)
      LTRPUT=LTRFLG(15)
      LTRSUP=LTRFLG(16)
      LTRSUB=LTRFLG(17)
      LTRMAG=LTRFLG(18)
      MRKSEM=1
      MRKLES=0
      MRKDOT=1
      MRKDOL=0
      MRKBAC=1
      MRKUND=1
      MRKEXC=1
      MRKNUM=1
      MRKCAR=1
      MRKAMP=1
      MRKEFN=1
      MRKTXT=0
      MRKNDX=0
      MRKSBX=1
      MRKTTL=1
      MRKSUP=0
      MRKSUB=0
      MRKMAG=1
      IFFLAG=1
C
C     NO .MAGNIFY COMMAND IS ACTIVE
      MAGNFY=0
C
C     NO .EDIT MAGNIFY COMMAND IS ACTIVE
      KNTEDT=0
C
C     SET DEFAULTS TO .MAGNIFY '',1,1,0,0,0
      LNGBIG=0
      MAGFNT=1
      MAGSPC=1
      MAGSHD=0
      NGLBIG=0
      INIMAG=0
C
C     NO .LIST COMMAND IS ACTIVE
      IFLIST=0
      MSTLST=0
      LSTELM=0
      NOWLST=NOWSKP
C
C     NO .SPLICE COMMAND IS ACTIVE
      IF(IFSPLC.GT.0)IFSPLC=-1
C
C     NO .FIGURE COMMAND IS ACTIVE
      LINFIG=0
C
C     .NO .FIGURE DEFERRED COMMAND IS ACTIVE
      NXTFIG=0
C     NO DEFER FIGURE COMMAND IS ACTIVE
      JDFRFG=0
      KDFRFG=0
C
C     NO DEFER PAGE COMMAND IS ACTIVE
      IDFRPG=0
      JDFRPG=0
C
C     .SPACE APPENDIX 9,1,3
      INIAPP=9
      MIDAPP=1
      LSTAPP=3
C
C     .SPACE CHAPTER 9,1,3
      INICHA=9
      MIDCHA=1
      LSTCHA=3
C
C     INDICATE THAT IN NEITHER CHAPTER NOR APPENDIX
      NEWCHA=0
      ISECTN=0
C
C     INITIAL CHAPTER COUNT
      ICHAPT=1
C
C     INITIAL APPENDIX COUNT
      IAPNDX=1
C
C     SET CONDITIONS AT START OF FIRST FOOTNOTE
      IFNNLF=NOWLFT
      IFNMLF=MRGLFT
      IFNOFF=IOFFST
      IFNNRT=NOWRIT
      IFNMFR=MRGFAR
      IFNMRT=MRGRIT
      IFNFIL=IFFILL
      ISKFTN=0
      IFNISP=ISPACE
      IFNNOF=NOWOFF
      IFNIFA=IFABAR
      IFNLOF=LFTOFF
      IFNROF=IRTOFF
      IFNLBS=LFTBAS
      IFNRBS=IRTBAS
      IFNNT1=NOTONE
      IFNNT2=NOTTWO
      IFNNT3=NOTTHR
      IFNJST=JSTIFY
      IFNIBR=INIBAR
      IFNMBR=MRKBAR
      IFNNBR=NOWBAR
      IFNLBR=LCLBAR
      IFNICN=ICENTR
      IFNJFL=JFILL
      IFNJCN=JCENTR
      IFNKCN=KCENTR
      IFNPRD=IPEROD
      IFNKLM=KLMFIL
      IFNMNS=KLMMNS
      IFNPIN=NOWIND
      IFNPSK=NOWSKP
      IFNPTS=NOWTST
      IFNIIN=INTIND
      IFNILF=INTLFT
      IFNIRT=INTRIT
      IFNNIN=NOTIND
      IFNNTT=NOTTST
      IFNNSK=NOTSKP
      IFNULS=IULSPC
      IFNATO=0
      IFNIND=0
      IFNIDF=NXTFIG
      IFNJDF=JDFRFG
      IFNKDF=KDFRFG
C
C     NO .COLLECT FOOTNOTE COMMAND IS ACTIVE
      IDEFER=0
C
C     NO AUTO FOOTNOTE NUMBERING
      KNTFTN=1
      NUMFTN=0
C
C     .DISPLAY REFERENCES [,D,],0
      LTRREF(1)=1H[
      LTRREF(2)=1H]
      MRKREF=1
      IFNREF=0
C
C     .DISPLAY FOOTNOTES [,D,],0
      LTRREF(3)=1H[
      LTRREF(4)=1H]
      MRKFTN=1
      IFNNUM=0
C
C     NO .DEBUG COMMAND IS ACTIVE
      IDEBUG=0
C
C     NO INDEX FILE IS OPEN
      NDXOPN=0
      NDXKNT=0
      NDXMAK=0
C
C     INDICATE THAT OUTPUT BUFFER IS EMPTY
      LNGMID=0
      KPYMID=0
C
C     NO .NO SPACE COMMAND ACTIVE
      KONECT=0
C
C     .SPACE TOP 0,2,3
      MRGTOP=0
      IGAPHI=2
      MINTOP=3
      LNGTOP=MINTOP
      ITTLHI=MRGTOP
      ISUBHI=0
C
C     .SPACE BOTTOM 1
      IGAPLO=1
C
C     TOP AND BOTTOM TITLE COMMANDS INACTIVE
      J=1
      DO 12 I=1,2
      LSTTTL(J)=1
      LSTTTL(J+1)=1
      LSTTTL(J+2)=0
      LSTTTL(J+3)=0
      LSTTTL(J+4)=1
      J=J+5
   12 CONTINUE
      DO 13 I=3,16
      LSTTTL(J)=0
      LSTTTL(J+1)=0
      LSTTTL(J+2)=-1
      LSTTTL(J+3)=-1
      LSTTTL(J+4)=-1
      J=J+5
   13 CONTINUE
      DO 14 I=1,16
      KNDTTL(I)=0
   14 CONTINUE
      MSKTTL(1)=-1
      ITTLLO=-1
      ISUBLO=-1
      LNGTTL=1
      KNDLFT=1
      KNDRIT=1
      IFLSUB=0
      IFRSUB=0
      LRADJS=0
      LRFORC=-1
      LFTRIT=0
      RETURN
      END
      SUBROUTINE RNONDX
C     RENBR(/CONSTRUCT INDEX)
C
C     DONALD E. BARTH, YALE SCHOOL OF MANAGEMENT
C
      COMMON/RNOONE/I     ,IAPNDX,IBRFTN,IBYTE ,ICENTR,
     1ICHAPT,IDEBUG,IDEFER,IDFILE,IDFRFG,IDFRPG,IDISK ,
     2IFABAR,IFAUTO,IFENCE,IFFILL,IFFLAG,IFHEAD,IFLIST,
     3IFLOOP,IFLSUB,IFNATO,IFNBGN,IFNFIL,IFNGAP,
     4IFNGSP,IFNHAV,IFNIBR,IFNICN,IFNIDF,IFNIFA,IFNIIN,
     5IFNILF,IFNIND,IFNIRT,IFNISP,IFNJCN,IFNJDF,IFNJFL,
     6IFNJST,IFNKCN,IFNKDF,IFNKLM,IFNLBR,IFNLBS,IFNLOF,
     7IFNLSP,IFNMBR,IFNMFR,IFNMLF,IFNMNS,IFNMRT,
     8IFNNBR,IFNNIN,IFNNLF,IFNNOF,IFNNOT,IFNNRT,IFNNSK,
     9IFNNTF,IFNNTL,IFNNTR,IFNNTS,IFNNTT,IFNNT1,IFNNT2
      COMMON/RNOTWO/IFNNT3,IFNOFF,IFNOPN,IFNOTE,IFNPIN,
     1IFNPRD,IFNPSK,IFNPTS,IFNRBS,IFNRDY,IFNRED,IFNRIT,
     2IFNROF,IFNTTL,IFNULS,IFNUMB,IFPAGE,IFRSUB,IFSPLC,
     3IGAPHI,IGAPLO,IGROUP,IMINUS,INDENT,INDFTN,INIALL,
     4INIAPP,INIBAR,INICHA,INIFRM,INILIN,ININDX,ININXT,
     5INISPA,INITAL,INNOTE,INTIND,INTLFT,INTRIT,INTRVL,
     6IOFFST,IPEROD,IPGSHO,IQUOTE,IRANGE,IREVRS,IRTBAS,
     7IRTFTN,IRTOFF,IRUNIN,ISECTN,ISKFTN,ISKIP ,ISPACE,
     8ISTART,ISUBPG,ITLALL,ITLLIN,ITLNXT,ITLSPA,ITRMNL,
     9ITTY  ,IULSPC,IVALUE,IWIZRD,J     ,JCENTR,JDFRFG
      COMMON/RNOTHR/JDFRPG,JDISK ,JFILL ,JFNBGN,JFNGAP,
     1JFNOPN,JFNRED,JFNRIT,JGROUP,JMINUS,JOFFST,JRANGE,
     2JSECTN,JSKIP ,JSTIFY,JTTY  ,JVALUE,K     ,KAPITL,
     3KASALL,KASFLG,KASLCL,KCENTR,KDFRFG,KDISK ,KFNGAP,
     4KLMFIL,KLMMNS,KMINUS,KNDAPP,KNDCHA,KNDFIL,KNDLFT,
     5KNDLIN,KNDPAG,KNDRIT,KNDSPL,KNDSUB,KNDTRN,KNTARG,
     6KNTCOD,KNTFTN,KNTFXD,KNTLIN,KNTLOP,KNTLVL,KNTPAG,
     7KNTPNT,KNTRST,KNTSHO,KNTSPC,KNTSPL,KNTTOP,KNTXTR,
     8KOMAND,KOMENT,KONECT,KPYBGN,KPYKAS,KPYMID,KPYPRT,
     9KRANGE,KSKIP ,KVALUE,LCLBAR,LCLNDX,LCLSUP,KAPNDX
      COMMON/RNOFOU/LDISK ,LENGTH,LEVEL0,LEVEL1,LEVEL3,
     1LEVEL4,LFNGAP,LFTBAS,ILFFTN,LFTOFF,LFTRIT,LINFIG,
     2LINSPL,LITERL,LMTBGN,LMTCHA,LMTCOD,LMTFNR,LMTKAS,
     3LMTLST,LMTLVL,LMTMID,LMTNDX,LMTTAB,LMTTTL,LMTUNT,
     4LMTWRK,LNGBGN,LNGBOT,LNGCHA,LNGFNR,LNGFTN,LNGMID,
     5NXTFTN,LNGPAG,LNGSPL,LNGSRC,LNGTRN,LNGTTL,KNDNDX,
     6LOCABC,LOCATE,LOCPAG,LOCPNT,LOKSUP,LOWBFR,NSKIP ,
     7LRADJS,LRFORC,LSNSPL,LSNSRC,LSTAPP,LSTCHA,LSTELM,
     8LSTFRM,LSTSPL,LSTTRN,MAJOR ,MASTER,MAXBGN,MAXLIN,
     9MAXLOP,MAXSPL,MAXTAB,MAXWRD,MDISK ,MIDAPP,MIDCHA
      COMMON/RNOFIV/MINLVL,MINTOP,MOVBAC,MRGFAR,MRGLFT,
     1MRGRIT,MRGTOP,MRKAMP,MRKBAC,MRKBAR,MRKCAR,MRKDOL,
     2MRKDOT,MRKEFN,MRKEXC,MRKFTN,MRKLES,MRKNDX,MRKNUM,
     3MRKREF,MRKSBX,MRKSEM,MRKSUB,MRKSUP,MRKTTL,MRKTXT,
     4MRKUND,MSTLST,NDISK ,NDXDSK,NDXFOU,NDXHOW,NDXKNT,
     5NDXMAK,NDXONE,NDXOPN,NDXTHR,NDXTWO,NEEDED,NEWCHA,
     6NEWPAG,NOTFIL,NOTIND,NOTKLM,NOTLFT,NOTMNS,NOTONE,
     7NOTRIT,NOTSEM,NOTSKP,NOTSPC,NOTTHR,NOTTST,NOTTWO,
     8NOWBAR,NOWFTN,NOWIND,NOWLFT,NOWLST,NOWOFF,NOWPAG,
     9NOWPHW,NOWRIT,NOWSEC,NOWSHW,NOWSKP,NOWSPH,NOWSUB
      COMMON/RNOSIX/NOWTST,NULTTL,NUMFTN,NXTFIG,NXTHDR,
     1NXTLST,NXTLVL,NXTONE,NXTPAG,NXTSUB,KNDOUT,LNGWRK,
     2KAPFTN,KOFFST,IRECRD,KNTNDX,INIPAG,INIHIA,MAGNFY,
     3INIHIB,IFHALF,KTRMNL,ITTLLO,ISUBLO,LNGTOP,MAGFNT,
     4ITTLHI,ISUBHI,IFINDX,IXTRSS,JXTRSS,KXTRSS,MAGSPC,
     5MXTRSS,NXTRSS,IFORMR,JTRMNL,IFNREF,IFNNUM,KMPPAG,
     6KMPLIN,KMPCLM,KMPVAL,INICLM,MFNGAP,NFNGAP,MAGSAV,
     7MAGSHD,MAGHIH,MRKMAG,LMTSHD,LNGSHD,LFTSHD,IRISHD,
     8IHISHD,ILOSHD,KNTSHD,LFTSGN,IRISGN,NGLSHD,NETNGL,
     9NETSEP,NETWID,NETOFF,NETKNT,KNTEDT,LMTEDT,LMTBIG,
     1LNGBIG,NGLBIG,KNTBIG,NXTSKP,JBORDR,INIMAG,INIOBJ,
     2IBORDR
      COMMON/RNOEIG/INDLST(10)  ,KMDARG(250) ,KMDBRK(250) ,
     1 KNDLVL(6)   ,KNDTTL(16)  ,LOCTAB(32)  ,LSTMRG(10)  ,
     2 LSTRIT(10)  ,LSTSKP(10)  ,LSTSPC(10)  ,LSTTTL(80)  ,
     3 LSTTYP(10)  ,LSTVAL(10)  ,MCHPNT(1300),MSKBGN(300) ,
     4 MSKCHA(200) ,MSKFNR(200) ,MSKFTN(200) ,MSKMID(200) ,
     5 MSKTTL(450) ,NARGMT(44)  ,NBEGIN(19)  ,NMINUS(32)  ,
     6 NOTPNT(1300),NUMLVL(6)   ,NUMNDX(300) ,NUMTTL(11)  ,
     7 NVALUE(32)  ,NXTCMD(81)  ,NXTPNT(12)  ,NXTUNT(4)   ,
     8 MSKWRK(200) ,MTYSTR(4)   ,MAGEDT(50)
      COMMON/RNONIN/LTRAMP,LTRBAC,LTRBAR,LTRCAR,LTRCOM,
     1LTRDOL,LTRDOT,LTREFN,LTREXC,LTRFNC,LTRLES,
     2LTRMNS,LTRNDX,LTRNOW,LTRNUM,LTRPLS,LTRQUO,LTRRUL,
     3LTRSBX,LTRSEM,LTRSPA,LTRSUB,LTRSUP,LTRTAB,
     4LTRPUT,LTRTXT,LTRUND,LTR1ST,LTRMAG
      COMMON/RNOTEN/LTRABC(26)  ,LTRAPP(9)   ,LTRBGN(300) ,
     1 LTRCPT(8)   ,LTRCLS(10)  ,LTRCOD(70)  ,LTRDGT(10)  ,
     2 LTRFLG(18)  ,LTRFTN(200) ,LTRIND(5)   ,LTRLST(10,6),
     3 LTRMID(200) ,LTRONL(26)  ,LTRONU(26)  ,LTROPN(10)  ,
     4 LTRPAG(5)   ,LTRREF(4)   ,LTRSPL(200) ,LTRTWO(4)   ,
     5 LTRTYP(8)   ,LTRWRK(200) ,LWRABC(26)  ,LWRAPP(9)   ,
     6 LWRCHA(8)   ,LWRIND(5)   ,LWRONL(26)  ,LWRONU(26)  ,
     7 LWRTYP(8)   ,LTRTTL(450) ,LTRCHA(200) ,LTRFNR(200) ,
     8 LTRSHD(50)  ,LTRBIG(50)
C
      DIMENSION IHEADR(8),JHEADR(8),KHEADR(8),ILETTR(300)
C
      IF(KOMAND.EQ.132)GO TO 3
      IF(KOMAND.EQ.55)GO TO 2
      IF(KOMAND.NE.504)GO TO 122
C
C     ENTRY IF SIMULATING DO INDEX COMMAND
    1 IVALUE=0
      IMINUS=0
      NVALUE(1)=0
      NMINUS(1)=0
      KNTARG=0
C
C     ENTRY FOR DO INDEX COMMAND
    2 IF(NDXKNT.LE.0)GO TO 122
      I=NDXHOW
      NDXHOW=KNDPAG
      KNDPAG=I
      NEWPAG=NULTTL
      NDXMAK=NXTPAG
      NXTPAG=1
      LRADJS=LFTRIT+NOWSUB
      IF(ISUBPG.LT.0)GO TO 4
      ISUBPG=ISUBPG-2
      NXTSUB=1
      GO TO 4
C
C     ENTRY FOR PRINT INDEX COMMAND
    3 IF(NDXKNT.LE.0)GO TO 122
C
C     CONVERT TITLE LINE TO UPPER CASE
    4 IF(KNTARG.LE.0)GO TO 11
      IF(NMINUS(KNTARG).LE.0)GO TO 11
      IF(INITAL.LT.0)GO TO 11
      I=NVALUE(KNTARG)
      N=I+NMINUS(KNTARG)-1
      K=0
    5 MSKBIT=MSKBGN(I)
      CALL RNOUNP(1,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 6
      K=0
      GO TO 10
    6 IF(K.EQ.0)GO TO 7
      IF(KAPITL.LT.0)GO TO 10
    7 MSKBIT=MSKBGN(I)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 9
      LTRNOW=LTRBGN(I)
      DO 8 M=1,26
      IF(LTRNOW.NE.LWRABC(M))GO TO 8
      LTRBGN(I)=LTRABC(M)
      GO TO 9
    8 CONTINUE
    9 K=1
   10 I=I+1
      IF(I.LE.N)GO TO 5
C
C     TEST IF ALREAY BEYOND RANGE OF DESIRED PAGES
   11 IF(KRANGE.LT.0)GO TO 12
      IF(KNTPAG.LT.JRANGE)GO TO 13
      IF(NDXMAK.NE.0)GO TO 12
      IF(NEWPAG.NE.0)GO TO 12
      IF(KNTTOP.LT.0)GO TO 12
      IF(IFPAGE.LE.0)GO TO 13
      I=((NOWTST-1)*ISPACE)+NOWTST
      IF(NMINUS(1).GT.0)I=I+1+NDXTWO
      IF(ISKIP.GE.0)I=I+ISKIP+NDXTHR
      IF((LOCPAG+I).GT.LNGPAG)GO TO 12
      GO TO 13
C
C     DELETE INDEX FILE IF ALREADY BEYOND PAGE RANGE
   12 CALL RNOFIL(5,3,NDXDSK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
C
C     INSURE THAT CANNOT PUT ANYTHING ELSE ON LAST PAGE
      CALL RNOBOT
      CALL RNOTOP
      GO TO 121
C
C     CLOSE INDEX FILE, KEEPING IT FOR SORTING
   13 CALL RNOFIL(5,2,NDXDSK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
C
C     *****************************************************
C     *                                                   *
C     *  SPLIT FILE INTO 2 FILES CONTAINING SORTED PAIRS  *
C     *                                                   *
C     *****************************************************
C
      ICOUNT=NDXKNT
   14 CALL RNOFIL(5,4,NDXDSK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      JCOUNT=0
      KCOUNT=0
   15 IF(ICOUNT.LE.0)GO TO 28
      ICOUNT=ICOUNT-1
      READ(NDXDSK,16)IHEADR
   16 FORMAT(8I5)
      ILNGTH=IHEADR(8)
      READ(NDXDSK,17)(ILETTR(I),I=1,ILNGTH)
   17 FORMAT(24I3)
   18 IF(ICOUNT.LE.0)GO TO 21
      ICOUNT=ICOUNT-1
      READ(NDXDSK,16)JHEADR
      JLNGTH=JHEADR(8)
      READ(NDXDSK,17)(NUMNDX(I),I=1,JLNGTH)
      CALL RNOCMP(NUMNDX,ILNGTH,ILETTR,JLNGTH,LMTNDX,
     1IDIFFR)
      IF(IDIFFR.LT.0)GO TO 19
      IF(IDIFFR.GT.0)GO TO 20
      IF(IHEADR(1).LT.JHEADR(1))GO TO 19
      IF(IHEADR(1).GT.JHEADR(1))GO TO 20
      NDXKNT=NDXKNT-1
      GO TO 18
C     FIRST LINE LOWEST IN ALPHABET
   19 IFIRST=-1
      GO TO 22
C     FIRST LINE HIGHEST IN ALPHABET
   20 IFIRST=1
      GO TO 22
C     ONLY 1 LINE LEFT IN FILE
   21 IFIRST=0
   22 CONTINUE
C
C     WRITE SORTED PAIR OF LINES TO OUTPUT FILE
      IF(JCOUNT.GT.KCOUNT)GO TO 25
      IF(JCOUNT.GT.0)GO TO 23
      CALL RNOFIL(1,1,KDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
   23 IF(IFIRST.GT.0)GO TO 24
      WRITE(KDISK,16)IHEADR
      WRITE(KDISK,17)(ILETTR(I),I=1,ILNGTH)
      JCOUNT=JCOUNT+1
      IF(IFIRST.EQ.0)GO TO 15
   24 WRITE(KDISK,16)JHEADR
      WRITE(KDISK,17)(NUMNDX(I),I=1,JLNGTH)
      JCOUNT=JCOUNT+1
      IF(IFIRST.LE.0)GO TO 15
      WRITE(KDISK,16)IHEADR
      WRITE(KDISK,17)(ILETTR(I),I=1,ILNGTH)
      JCOUNT=JCOUNT+1
      GO TO 15
   25 IF(KCOUNT.GT.0)GO TO 26
      CALL RNOFIL(2,1,LDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
   26 IF(IFIRST.GT.0)GO TO 27
      WRITE(LDISK,16)IHEADR
      WRITE(LDISK,17)(ILETTR(I),I=1,ILNGTH)
      KCOUNT=KCOUNT+1
      IF(IFIRST.EQ.0)GO TO 15
   27 WRITE(LDISK,16)JHEADR
      WRITE(LDISK,17)(NUMNDX(I),I=1,JLNGTH)
      KCOUNT=KCOUNT+1
      IF(IFIRST.LE.0)GO TO 15
      WRITE(LDISK,16)IHEADR
      WRITE(LDISK,17)(ILETTR(I),I=1,ILNGTH)
      KCOUNT=KCOUNT+1
      GO TO 15
C
C     STEP 2, MERGE THE 2 FILES WITH SORTED REGIONS
   28 IF(KCOUNT.LE.0)GO TO 51
      CALL RNOFIL(5,6,NDXDSK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      CALL RNOFIL(1,2,KDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      CALL RNOFIL(2,2,LDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
C
C     ***********************************************
C     *                                             *
C     *  READ SPLIT FILES AND WRITE COMPOSITE FILE  *
C     *                                             *
C     ***********************************************
C
      NDXSIZ=2
      ICOUNT=0
   29 CALL RNOFIL(5,1,NDXDSK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      CALL RNOFIL(1,4,KDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      CALL RNOFIL(2,4,LDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
   30 JCONTN=NDXSIZ
      IF(JCONTN.GT.JCOUNT)JCONTN=JCOUNT
      KCONTN=NDXSIZ
      IF(KCONTN.GT.KCOUNT)KCONTN=KCOUNT
      IF(JCONTN.LE.0)GO TO 31
      JCONTN=JCONTN-1
      JCOUNT=JCOUNT-1
      READ(KDISK,16)IHEADR
      ILNGTH=IHEADR(8)
      READ(KDISK,17)(ILETTR(I),I=1,ILNGTH)
      GO TO 35
   31 ILNGTH=0
      GO TO 35
   32 IF(ILNGTH.LE.0)GO TO 34
      IF(JLNGTH.LE.0)GO TO 33
      CALL RNOCMP(NUMNDX,ILNGTH,ILETTR,JLNGTH,LMTNDX,
     1IDIFFR)
      IF(IDIFFR.LT.0)GO TO 33
      IF(IDIFFR.GT.0)GO TO 34
      IF(IHEADR(1).LT.JHEADR(1))GO TO 33
      IF(IHEADR(1).GT.JHEADR(1))GO TO 34
C
C     COPY ITEM FROM FIRST FILE INTO COMPOSITE IF LOWEST
   33 ICOUNT=ICOUNT+1
      WRITE(NDXDSK,16)IHEADR
      WRITE(NDXDSK,17)(ILETTR(I),I=1,ILNGTH)
      IF(JCONTN.LE.0)GO TO 36
      JCONTN=JCONTN-1
      JCOUNT=JCOUNT-1
      READ(KDISK,16)IHEADR
      ILNGTH=IHEADR(8)
      READ(KDISK,17)(ILETTR(I),I=1,ILNGTH)
      GO TO 32
C
C     COPY ITEM FROM SECOND FILE INTO COMPOSITE IF LOWEST
   34 ICOUNT=ICOUNT+1
      WRITE(NDXDSK,16)JHEADR
      WRITE(NDXDSK,17)(NUMNDX(I),I=1,JLNGTH)
   35 IF(KCONTN.LE.0)GO TO 37
      KCONTN=KCONTN-1
      KCOUNT=KCOUNT-1
      READ(LDISK,16)JHEADR
      JLNGTH=JHEADR(8)
      READ(LDISK,17)(NUMNDX(I),I=1,JLNGTH)
      GO TO 32
   36 ILNGTH=0
      IF(JLNGTH.GT.0)GO TO 34
      GO TO 38
   37 JLNGTH=0
      IF(ILNGTH.GT.0)GO TO 33
   38 IF((JCOUNT+KCOUNT).GT.0)GO TO 30
      CALL RNOFIL(5,2,NDXDSK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      CALL RNOFIL(1,6,KDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      CALL RNOFIL(2,6,LDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
C
C
C     ***************************************************
C     *                                                 *
C     *  READ COMPOSITE FILE AND WRITE THE SPLIT FILES  *
C     *                                                 *
C     ***************************************************
C
      NDXSIZ=2*NDXSIZ
      IF(ICOUNT.LE.NDXSIZ)GO TO 44
      CALL RNOFIL(5,4,NDXDSK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      CALL RNOFIL(1,1,KDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      CALL RNOFIL(2,1,LDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
   39 IF(ICOUNT.LE.0)GO TO 43
      IF(JCOUNT.GT.KCOUNT)GO TO 41
      JCONTN=NDXSIZ
      IF(JCONTN.GT.ICOUNT)JCONTN=ICOUNT
   40 READ(NDXDSK,16)IHEADR
      ILNGTH=IHEADR(8)
      READ(NDXDSK,17)(ILETTR(I),I=1,ILNGTH)
      WRITE(KDISK,16)IHEADR
      WRITE(KDISK,17)(ILETTR(I),I=1,ILNGTH)
      JCONTN=JCONTN-1
      JCOUNT=JCOUNT+1
      ICOUNT=ICOUNT-1
      IF(JCONTN.GT.0)GO TO 40
      GO TO 39
   41 KCONTN=NDXSIZ
      IF(KCONTN.GT.ICOUNT)KCONTN=ICOUNT
   42 READ(NDXDSK,16)IHEADR
      ILNGTH=IHEADR(8)
      READ(NDXDSK,17)(ILETTR(I),I=1,ILNGTH)
      WRITE(LDISK,16)IHEADR
      WRITE(LDISK,17)(ILETTR(I),I=1,ILNGTH)
      KCONTN=KCONTN-1
      KCOUNT=KCOUNT+1
      ICOUNT=ICOUNT-1
      IF(KCONTN.GT.0)GO TO 42
      GO TO 39
   43 CALL RNOFIL(5,6,NDXDSK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      CALL RNOFIL(1,2,KDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      CALL RNOFIL(2,2,LDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      GO TO 29
C
C     ***********************************************
C     *                                             *
C     *  CULL OUT DUPLICATE ENTRIES IN SORTED FILE  *
C     *                                             *
C     ***********************************************
C
   44 CALL RNOFIL(5,4,NDXDSK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      CALL RNOFIL(1,1,KDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
   45 IF(ICOUNT.LE.0)GO TO 51
      ICOUNT=ICOUNT-1
      READ(NDXDSK,16)IHEADR
      ILNGTH=IHEADR(8)
      READ(NDXDSK,17)(ILETTR(I),I=1,ILNGTH)
      IF(JCOUNT.EQ.0)GO TO 48
      DO 46 I=1,8
      IF(IHEADR(I).NE.JHEADR(I))GO TO 48
   46 CONTINUE
      DO 47 I=1,ILNGTH
      IF(ILETTR(I).NE.NUMNDX(I))GO TO 48
   47 CONTINUE
      GO TO 45
   48 DO 49 I=1,8
      JHEADR(I)=IHEADR(I)
   49 CONTINUE
      DO 50 I=1,ILNGTH
      NUMNDX(I)=ILETTR(I)
   50 CONTINUE
      JCOUNT=JCOUNT+1
      WRITE(KDISK,16)IHEADR
      WRITE(KDISK,17)(ILETTR(I),I=1,ILNGTH)
      GO TO 45
C
C     ALL THROUGH SORTING
   51 CALL RNOFIL(5,6,NDXDSK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      CALL RNOFIL(1,2,KDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
C
C     *************************
C     *                       *
C     *  CONSTRUCT THE INDEX  *
C     *                       *
C     *************************
C
      CALL RNOFIL(1,4,KDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      ILNGTH=0
      IFBACK=-1
      NDXTTL=-1
      IF(NDXMAK.NE.0)GO TO 101
      IF(NEWPAG.NE.0)GO TO 101
      IF(KNTTOP.LT.0)GO TO 101
      IF(ISKIP.GE.0)ISKIP=ISKIP+NDXTHR
      I=((NOWTST-1)*ISPACE)+NOWTST
      IF(NMINUS(1).GT.0)I=I+1+NDXTWO
      IF(ISKIP.GT.0)I=I+ISKIP
      IF(IFPAGE.LE.0)GO TO 52
      IF((LOCPAG+I).GT.LNGPAG)GO TO 101
   52 IF(NDXMAK.NE.0)ISKIP=NDXONE
      NDXTTL=0
      IF(KNTARG.LE.0)GO TO 60
      IF(NMINUS(1).LE.0)GO TO 60
   53 IF(ISKIP.LE.0)GO TO 54
      KNDOUT=3
      CALL RNOLIN
      ISKIP=ISKIP-1
      GO TO 53
   54 NEEDED=((MRGFAR-NMINUS(1))/2)
      LNGWRK=0
      IF(NEEDED.LE.0)GO TO 56
      DO 55 I=1,NEEDED
      IF(LNGWRK.GE.LMTWRK)GO TO 58
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRSPA
      MSKWRK(LNGWRK)=0
   55 CONTINUE
   56 I=NVALUE(1)
      J=I+NMINUS(1)-1
      DO 57 K=I,J
      IF(LNGWRK.GE.LMTWRK)GO TO 58
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRBGN(K)
      MSKWRK(LNGWRK)=MSKBGN(K)
   57 CONTINUE
   58 KNDOUT=4
      CALL RNOLIN
   59 IF(IFPAGE.LT.0)IFPAGE=1
      ISKIP=NDXTWO
   60 IF(IFPAGE.LE.0)GO TO 61
      IF((LOCPAG+ISKIP).GE.LNGPAG)GO TO 101
   61 NDXTTL=1
   62 JCOUNT=JCOUNT-1
      IF(JCOUNT.LT.0)GO TO 70
      READ(KDISK,16)JHEADR
      IF(JHEADR(6).EQ.0)JHEADR(7)=0
      JLNGTH=JHEADR(8)
      READ(KDISK,17)(NUMNDX(I),I=1,JLNGTH)
      IF(ILNGTH.EQ.0)GO TO 95
      IF(ILNGTH.NE.JLNGTH)GO TO 70
      IF(IHEADR(1).EQ.0)GO TO 70
      DO 63 I=1,ILNGTH
      IF(ILETTR(I).NE.NUMNDX(I))GO TO 70
   63 CONTINUE
      IF((IHEADR(1)+NDXSAM+1).NE.JHEADR(1))GO TO 71
      IF(IHEADR(2).NE.JHEADR(2))GO TO 71
      IF(IHEADR(3).NE.JHEADR(3))GO TO 71
      IF(IHEADR(5).NE.JHEADR(5))GO TO 71
      IF(IHEADR(7).NE.JHEADR(7))GO TO 71
      IF(IHEADR(7).EQ.0)GO TO 64
      IF(IHEADR(4).NE.JHEADR(4))GO TO 71
      IF((IHEADR(6)+NDXSAM+1).NE.JHEADR(6))GO TO 71
      GO TO 65
   64 IF((IHEADR(4)+NDXSAM+1).NE.JHEADR(4))GO TO 71
   65 NDXSAM=NDXSAM+1
      GO TO 62
   66 IF(IHEADR(7).EQ.0)GO TO 67
      IHEADR(6)=IHEADR(6)+NDXSAM
      GO TO 68
   67 IHEADR(4)=IHEADR(4)+NDXSAM
   68 NDXSAM=-NDXSAM
      IF(IHEADR(3).EQ.0)GO TO 69
      IF((LNGWRK+4).GT.LMTWRK)GO TO 84
      LNGWRK=LNGWRK+4
      LTRWRK(LNGWRK-3)=LTRSPA
      LTRWRK(LNGWRK-2)=1Ht
      LTRWRK(LNGWRK-1)=1Ho
      LTRWRK(LNGWRK)=LTRSPA
      GO TO 74
   69 IF(LNGWRK.GE.LMTWRK)GO TO 84
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=1H-
      GO TO 74
   70 NDXNEW=1
   71 IF(IHEADR(1).EQ.0)GO TO 77
      IF(NDXLIN.EQ.0)GO TO 73
      IF(LNGWRK.GE.LMTWRK)GO TO 82
      IF(LNGWRK.LT.MRGRIT)GO TO 72
      IF(NDXLIN.GT.1)GO TO 82
      IF(NDXSHO.NE.0)GO TO 82
   72 LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=1H,
      NDXLST=LNGWRK
      NDXINI=NDXLST
      IF(IFPAGE.LT.0)IFPAGE=1
      IF(LNGWRK.GE.LMTWRK)GO TO 84
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRSPA
   73 NDXLIN=NDXLIN+1
   74 IF(IHEADR(3).LE.0)GO TO 75
      KONTRL=IHEADR(3)
      NUMBER=IHEADR(2)
      NDXTST=LNGWRK
      CALL RNONUM(KONTRL,NUMBER,LTRWRK,LNGWRK,LMTWRK)
      IF(LNGWRK.LE.NDXTST)GO TO 84
      IF(LNGWRK.GE.LMTWRK)GO TO 84
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=1H-
   75 IF(IHEADR(5).LE.0)GO TO 76
      KONTRL=IHEADR(5)
      NUMBER=IHEADR(4)
      NDXTST=LNGWRK
      CALL RNONUM(KONTRL,NUMBER,LTRWRK,LNGWRK,LMTWRK)
      IF(LNGWRK.LE.NDXTST)GO TO 84
   76 IF(IHEADR(7).LE.0)GO TO 77
      KONTRL=IHEADR(7)
      NUMBER=IHEADR(6)
      NDXTST=LNGWRK
      CALL RNONUM(KONTRL,NUMBER,LTRWRK,LNGWRK,LMTWRK)
      IF(LNGWRK.LE.NDXTST)GO TO 84
   77 IF(NDXSAM.GT.0)GO TO 66
      IF(LNGWRK.LE.MRGRIT)GO TO 78
      IF(NDXLIN.GT.1)GO TO 88
      IF(NDXSHO.NE.0)GO TO 88
   78 IF(NDXRTN.GT.0)GO TO 80
      NDXINI=LNGWRK
      NDXRNG=NDXSAM
      DO 79 I=1,8
      KHEADR(I)=IHEADR(I)
   79 CONTINUE
      GO TO 85
   80 NDXINI=LNGWRK
      NDXSAM=NDXRNG
      DO 81 I=1,8
      IHEADR(I)=KHEADR(I)
   81 CONTINUE
      NDXRTN=0
      GO TO 71
C
C     LINE OVERFLOWS WHEN ADD COMMA TO RIGHT OF NUMBER
C     SO MUST REGENERATE BOTH OLD AND NEW NUMBERS LATER
   82 NDXINI=NDXLST
      J=NDXSAM
      NDXSAM=NDXRNG
      NDXRNG=J
      DO 83 I=1,8
      J=IHEADR(I)
      IHEADR(I)=KHEADR(I)
      KHEADR(I)=J
   83 CONTINUE
      LNGWRK=NDXINI
      NDXRTN=1
      GO TO 97
C
C     LINE OVERFLOWS WHEN CONSTRUCTING A NUMBER
C     SO IT IS THIS NUMBER WHICH MUST BE REGNERATED LATER
   84 IF(NDXLIN.GT.1)GO TO 88
      IF(NDXSHO.NE.0)GO TO 88
   85 DO 86 I=1,8
      IHEADR(I)=JHEADR(I)
   86 CONTINUE
      NDXSAM=0
      IF(NDXNEW.LE.0)GO TO 62
      IF(IFPAGE.LT.0)IFPAGE=1
      NDXRTN=-1
      GO TO 97
   87 IF(JCOUNT.LT.0)GO TO 119
      NDXLIN=0
      NDXNEW=0
      IF(IFPAGE.LE.0)GO TO 103
      IF((LOCPAG+ISKIP).GE.LNGPAG)GO TO 99
      GO TO 103
   88 LNGWRK=NDXINI
      NDXRTN=0
      GO TO 97
   89 NDXSHO=0
      MRKRIT=0
      NDXLIN=0
      IF(NDXSAM.GE.0)GO TO 91
      NDXSAM=-NDXSAM
      IF(IHEADR(7).EQ.0)GO TO 90
      IHEADR(6)=IHEADR(6)-NDXSAM
      GO TO 91
   90 IHEADR(4)=IHEADR(4)-NDXSAM
   91 IF(IFPAGE.LE.0)GO TO 92
      IF((LOCPAG+ISKIP).GE.LNGPAG)GO TO 100
   92 IF(ISKIP.LE.0)GO TO 93
      KNDOUT=3
      CALL RNOLIN
      ISKIP=ISKIP-1
      GO TO 92
   93 LNGWRK=0
      IF(NDXLMT.LE.0)GO TO 71
      DO 94 I=1,NDXLMT
      IF(LNGWRK.GE.LMTWRK)GO TO 71
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRSPA
   94 CONTINUE
      GO TO 71
   95 DO 96 I=1,8
      IHEADR(I)=JHEADR(I)
   96 CONTINUE
      NDXLIN=0
      NDXSAM=0
      NDXNEW=0
      GO TO 103
C
C     OUTPUT SINGLE LINE OF INDEX
   97 IF(MRKRIT.GE.LNGWRK)GO TO 98
      MRKRIT=MRKRIT+1
      MSKWRK(MRKRIT)=0
      GO TO 97
   98 KNDOUT=4
      CALL RNOLIN
C
C     UNDERSCORES WERE GENERATED AT THIS POINT IN AN
C     EARLIER VERSION OF THIS ROUTINE.  THE FOLLOWING
C     VARIABLES WERE KEPT AROUND FOR THIS PURPOSE.
C
C     NDXSHO = 0, CURRENT LINE CONTAINS NUMBERS ONLY.
C            = 1, CURRENT LINE CONTAINS INDEXED PHRASE
C     NDXLFT = LOCATION TO LEFT OF THAT IN ILETTR ARRAY
C              FROM WHICH FIRST LETTER IN CURRENT LINE
C              WAS OBTAINED.
C     ILNGTH = FINAL LOCATION IN ILETTR ARRAY FROM WHICH
C              LETTERS IN CURRENT LINE WERE OBTAINED.
C     NDXXTR = NUMBER OF LEADING SPACES BEFORE THE
C              COPIED LETTERS.
C
      ISKIP=ISPACE
      IF(IFMORE.GT.0)GO TO 113
      IF(NDXRTN.LT.0)GO TO 87
      GO TO 89
C
C     GENERATE TITLES AT TOP OF PAGE
   99 ILNGTH=0
      GO TO 101
  100 IFBACK=0
  101 CALL RNOBOT
      CALL RNOTOP
      IF(KRANGE.LT.0)GO TO 119
C
C     GENERATE DEFERRED PAGE
      IDFRPG=IDFRPG+JDFRPG
      JDFRPG=0
      IF(IDFRPG.LE.0)GO TO 102
      IDFRPG=IDFRPG-1
      GO TO 101
  102 NEWCHA=0
      ISKIP=0
      IF(NDXTTL.LT.0)GO TO 52
      IF(NDXTTL.EQ.0)GO TO 61
C
C     COPY NAME OF ITEM TO BE INDEXED INTO OUTPUT LINE
  103 CALL RNOCHR(MRGLFT,IFBACK,IFMORE,ILETTR,ILNGTH,
     1    NUMNDX,JLNGTH,IDIFFR,NDXLFT,NDXXTR,JDIFFR)
      I=(IFMORE*(ISPACE+1))+ISKIP
      IF(IDIFFR.NE.0)I=I+1
      IF(IFPAGE.LE.0)GO TO 104
      IF((LOCPAG+I).GE.LNGPAG)GO TO 99
  104 IF(IDIFFR.EQ.0)GO TO 105
      ISKIP=ISKIP+1
      IF(IFPAGE.LE.0)GO TO 105
      IF((LOCPAG+ISKIP).GE.LNGPAG)GO TO 99
C
C     INSERT SPACES BEFORE THE NEW INDEX ENTRY
  105 IF(ISKIP.LE.0)GO TO 106
      KNDOUT=3
      CALL RNOLIN
      ISKIP=ISKIP-1
      GO TO 105
C
C     COPY THE NEW INDEX ENTRY INTO LTRWRK AND MSKWRK ARRAYS
  106 NDXLMT=NDXXTR
      LNGWRK=0
  107 IF(NDXXTR.LE.0)GO TO 108
      IF(LNGWRK.GE.LMTWRK)GO TO 108
      NDXXTR=NDXXTR-1
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRSPA
      MSKWRK(LNGWRK)=0
      GO TO 107
  108 IF(NDXLFT.GE.ILNGTH)GO TO 112
      IF(LNGWRK.GE.LMTWRK)GO TO 112
      NDXLFT=NDXLFT+1
      MASKED=ILETTR(NDXLFT)
      IF(MASKED.LT.0)GO TO 112
      LNGWRK=LNGWRK+1
      KODE=MASKED/2
      MASKED=MASKED-(2*KODE)
      MSKBIT=0
      IF(MASKED.NE.0)CALL RNOPAK(2,MSKBIT)
      MSKWRK(LNGWRK)=MSKBIT
      IF(KODE.GT.0)GO TO 109
      LTRWRK(LNGWRK)=LTRSPA
      GO TO 108
  109 IF(KODE.GT.53)GO TO 111
      I=KODE/2
      IF(KODE.NE.(2*I))GO TO 110
      LTRWRK(LNGWRK)=LTRABC(I)
      GO TO 108
  110 LTRWRK(LNGWRK)=LWRABC(I)
      GO TO 108
  111 LTRWRK(LNGWRK)=LTRCOD(KODE-53)
      GO TO 108
  112 CONTINUE
      MRKRIT=LNGWRK
      NDXSHO=1
      IF(IFMORE.EQ.0)GO TO 114
      GO TO 97
  113 IF(IFPAGE.LE.0)GO TO 103
      IF((LOCPAG+ISKIP).LT.LNGPAG)GO TO 103
      GO TO 101
C
C     CONSTRUCT LINE OF DOTS TO RIGHT OF NAME OF ITEM
  114 JDIFFR=IHEADR(1)
      IF(JDIFFR.EQ.0)GO TO 62
      NDXLST=LNGWRK
      NDXINI=NDXLST
      IF(KNDNDX.GE.0)GO TO 117
      NDXLMT=MRGLFT+((MRGRIT-MRGLFT)/2)
      I=LNGWRK-NDXLMT
      J=I/2
      NDXODD=I-(2*J)
      NDXEND=NDXLMT
      IF(NDXEND.LT.(LNGWRK+2))NDXEND=LNGWRK+2
      IF(NDXEND.GT.LMTWRK)NDXEND=LMTWRK
      IF(LNGWRK.GE.NDXEND)GO TO 118
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRSPA
      IF(NDXODD.NE.0)GO TO 116
  115 IF(LNGWRK.GE.NDXEND)GO TO 118
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRSPA
  116 IF(LNGWRK.GE.NDXEND)GO TO 118
      IF(LNGWRK.GE.NDXLMT)GO TO 115
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=1H.
      GO TO 115
C
C     INSERT SINGLE COMMA TO RIGHT OF WORD OR PHRASE
  117 NDXLMT=NDXLMT+4
      IF(LNGWRK.GE.LMTWRK)GO TO 118
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=1H,
      IF(LNGWRK.GE.LMTWRK)GO TO 118
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRSPA
  118 IF(IFBACK.LT.0)GO TO 62
      IFBACK=-1
      GO TO 71
C
C     DELETE THE SORTED FILE OF INDEX ENTRIES WHEN ALL DONE
  119 CALL RNOFIL(1,6,KDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      IF(NDXMAK.NE.0)GO TO 120
      ISKIP=ISKIP+NDXFOU
      GO TO 121
  120 CALL RNOBOT
  121 NDXKNT=0
      IF(NDXMAK.EQ.0)GO TO 122
C
C     RESTORE PAGE NUMBERS AFTER DO INDEX COMMAND
      NOWPAG=NDXMAK
      NXTPAG=NDXMAK
      NDXMAK=0
      I=NDXHOW
      NDXHOW=KNDPAG
      KNDPAG=I
      NOWPHW=KNDPAG
      LRADJS=NXTPAG+1-LFTRIT
  122 RETURN
C     NDXLIN = NUMBER OF NUMBERS OR RANGES ON THE CURRENT
C              LINE
C     NDXSHO = 0, WHILE CONSTRUCTING A LINE OF NUMBERS
C              WITHOUT A LEADING WORD
C            = 1, WHILE CONSTRUCTING A LINE OF NUMBERS
C              WHICH HAS THE WROD INDEXED ON SAME LINE
      END
      SUBROUTINE RNOBIG(MAGFNT,MAGLIN,JSTIFY,IFILL ,MAGSPC,
     1    MOVE  ,ISPACE,LTRBGN,MAGBGN,LNGBGN,LFTCOL,IWIDTH,
     2    LMTMID,LTRMID,LNGMID,MAGHIH,MAGOVR,MSKBGN,MRKMAG,
     3    LTRMAG)
C     RENBR(/CONSTRUCT LARGE MULTI-LINE LETTERING)
C
C     DONALD BARTH, CHEMISTRY DEPT., HARVARD UNIVERSITY
C     DEVELOPED AT AIKEN COMPUTER LABORATORY
C
C     DDDDD         AAA TTTTTTTT EEEEEEEE XX    XX TTTTTTTT
C     DD   DD      AAAA    TT    EE        XX  XX     TT
C     DD    DD    AA AA    TT    EE         XXXX      TT
C     DD    DD   AA  AA    TT    EEEEE       XX       TT
C     DD    DD  AAAAAAA    TT    EE         XXXX      TT
C     DD   DD  AA    AA    TT    EE        XX  XX     TT
C     DDDDD   AA     AA    TT    EEEEEEEE XX    XX    TT
C
C     ROUTINE TO  PRODUCE MULTIPLE  LINE PRINTED  LETTERING
C     SIMILAR TO THAT USED FOR THE ABOVE TITLE.
C
C     THIS ROUTINE  MUST BE  USED  WITH A  BLOCK  DATA FONT
C     CREATED BY THE PROGRAM DAFONT.
C
C     MAGFNT = NUMBER SELECTING DESIRED FONT.  MAGFNT = 3
C              WOULD SELECT THIRD FONT OF ALL THOSE WHICH
C              ARE LOADED.
C     MAGLIN = THE LINE WITHIN  THE  LETTER  REPRESENTATION
C              WHICH   IS   TO   BE   PLACED  INTO  LTRMID.
C              CHARACTERS ARE A TOTAL OF IHIGH LINES  HIGH.
C              TO   PRINT   A  LETTER  OR  LETTERS,  IT  IS
C              NECESSARY TO CALL DATEXT  IHIGH  TIMES  WITH
C              LINE   VALUES  1  THROUGH  IHIGH,  WITH  THE
C              CALLING PROGRAM PRINTING LTRMID ARRAY  AFTER
C              EACH  RETURN  FROM  DATEXT.  THIS ALLOWS THE
C              INSERTION OF THE  CONSTRUCTED  LETTERS  INTO
C              OTHER TEXT OR OTHER FORMS.
C            = 0, REPRESENT HIGHEST  VALUED  LINE.   MAGLIN
C              MUST BE SET TO  MAGHIH-1 BEFORE THIS ROUTINE
C              IS AGAIN CALLED.
C     JSTIFY = -1, LEFT JUSTIFY THE  LETTER REPRESENTATIONS
C              IN A FIELD OF WIDTH IWIDTH.
C            = 0, CENTER  THE LETTER  REPRESENTATIONS  IN A
C              FIELD OF WIDTH IWIDTH.
C            = 1, RIGHT JUSTIFY  THE LETTER REPRESENTATIONS
C              IN A FIELD OF WIDTH IWIDTH.
C     IFILL  = 0, IF  LEFT  JUSITIFYING  OR  CENTERING  THE
C              LETTERING, DO NOT FILL THE UNUSED PORTION OF
C              THE FIELD  RIGHT  OF LETTER  REPRESENTATIONS
C              WITH SPACES. LNGMID WILL BE LEFT POINTING TO
C              RIGHT END OF RIGHTMOST LETTER REPESENTATION.
C            = 1, IF LEFT JUSIFYING OR CENTERING THE LETTER
C              REPRESENTATIONS,  DO FILL THE UNUSED PORTION
C              OF  FIELD  RIGHT  OF LETTER  REPRESENTATIONS
C              WITH SPACES.  LNGMID  WILL BE  LEFT POINTING
C              LFTCOL+IWIDTH.
C     MAGSPC = THE NUMBER OF SPACE (BLANK) CHARACTERS TO BE
C              INSERTED BETWEEN REPRESENTED CHARACTERS
C     MOVE   = -2, CHARACTERS WHICH  ARE NARROWER THAN  THE
C              WIDEST CHARACTER  ARE CENTERED  WITHIN WIDTH
C              OF WIDEST CHARACTER.  NO WHITE SPACE ADJUST-
C              MENT OF  POSITIONS  IS TO BE  MADE.   SPACES
C              WILL ALSO BE WIDTH OF THE WIDEST CHARACTER.
C            = -1, CHARACTERS WHICH  ARE NARROWER THAN MOST
C              COMMON WIDTH  WILL BE CENTERED  WITHIN  MOST
C              COMMON WIDTH.   NO WHITE SPACE ADJUSTMENT OF
C              POSITIONS  IS TO  BE MADE.  SPACES WILL ALSO
C              BE WIDTH WHICH IS MOST COMMON.
C            = 0, NORMAL INTER-CHARACTER SPACING IS ACCEPT-
C              ABLE WITHOUT WHITE SPACE ADJUSTMENT.
C            = 1, ADJUST SPACE BETWEEN CHARACTERS TO EQUAL-
C              IZE WHITE SPACES.
C     ISPACE = -1, REPRESENT  BOTH INITIAL AND FINAL SPACES
C              IN LTRBGN ARRAY.
C            = 0, REPRESENT INITIAL SPACES IN LTRBGN ARRAY.
C              SUPPRESS FINAL SPACES IN LTRBGN ARRAY.
C            = 1, SUPPRESS BOTH INITIAL AND FINAL SPACES IN
C              LTRBGN ARRAY.
C     LTRBGN = ARRAY CONTAINING LETTERS TO BE  REPRESENTED,
C              1 LETTER PER WORD, AS READ BY MULTIPLE OF A1
C              FORMAT.  SINCE  THE  LETTERING  PRODUCED  BY
C              THIS  ROUTINE IS LARGE, TERMINAL SPACES  ARE
C              IGNORED UNLESS  ISPACE=-1.  NOTE THAT LNGMID
C              EQUALS LFTCOL IF LTRBGN CONTAINS ONLY SPACES
C              AND ISPACE IS GREATER THAN OR EQUAL TO ZERO,
C              AND IFILL IS EQUAL TO ZERO.
C     MAGBGN = SEQUENCE NUMBER WITHIN LTRBGN ARRAY OF FIRST
C              LETTER   TO  BE  REPRESENTED  (THIS  IS  THE
C              SUBSCRIPT OF THE LTRBGN  ARRAY AT WHICH  THE
C              FIRST LETTER IS TO BE FOUND)
C     LNGBGN = SEQUENCE NUMBER WITHIN LTRBGN ARRAY OF FINAL
C              LETTER   TO  BE  REPRESENTED  (THIS  IS  THE
C              SUBSCRIPT OF THE LTRBGN ARRAY AT  WHICH  THE
C              FINAL LETTER IS TO BE FOUND)
C     LFTCOL = SUBSCRIPT OF OUTPUT BUFFER ARRAY LOCATION TO
C              LEFT OF 1ST LOCATION INTO WHICH THIS ROUTINE
C              CAN PLACE REPRESENTATION OF CONTENTS OF  THE
C              LTRBGN ARRAY.
C     IWIDTH = THE WIDTH OF THE FIELD INTO WHICH THE LETTER
C              REPRESENTATIONS CAN BE PLACED.   THE MAXIMUM
C              VALUE WITH WHICH LNGMID CAN THEN BE RETURNED
C              IS LFTCOL+IWIDTH OR LMTMID, WHICHEVER IS THE
C              SMALLER.
C     LMTMID = MAXIMUM SUBSCRIPT OF  LTRMID  ARRAY LOCATION
C              INTO WHICH  CAN BE PLACED  REPRESENTATION
C              OF CONTENTS OF LTRBGN ARRAY.
C
C     THE FOLLOWING ARGUMENTS ARE USED FOR OUTPUT.
C
C     LTRMID = THE ARRAY INTO WHICH IS  TO  BE  PLACED  THE
C              REPRESENTATION OF THE LETTERS IN LTRBGN.
C     LNGMID = RETURNED BY DATEXT CONTAINING THE NEW NUMBER
C              OF LOCATIONS IN USE  AFTER  THE  LETTERS  IN
C              LTRBGN HAVE BEEN REPRESENTED IN LTRMID.
C     MAGHIH = RETURNED CONTAINING THE  MAXIMUM VALUE WHICH
C              MAGLIN CAN  ATTAIN (IHIGH). THIS WILL DEPEND
C              ON WHICH  FONT HAS  BEEN LOADED.   MAGHIH IS
C              RETURNED AS ZERO IF FONT HAS NOT BEEN LOADED
C     MAGOVR = RETURNED CONTAINING THE SUBSCRIPT WITHIN THE
C              LTRBGN ARRAY OF  FIRST  LETTER WHICH WAS NOT
C              REPRESENTED.   IF ALL LETTERS REQUESTED WERE
C              REPRESENTED THEN MAGOVR WILL EQUAL LNGBGN+1.
C              IF NOT ALL LETTERS COULD BE  REPRESENTED DUE
C              TO THE VALUE OF IWIDTH BEING TOO SMALL, THEN
C              MAGOVR WILL POINT TO THE FIRST  LETTER WHICH
C              WOULD NOT FIT.
C
      COMMON/RNOTWE/LTRFNT( 204)
      COMMON/RNOTHI/LOCKED,KNTFNT,ICLMNS( 204),
     1ILIMIT(   3),ILINES(   3),IMAXMM(   3),
     2ICOMMN(   3),IPACKD(1428)
C
      DIMENSION LTRBGN(LNGBGN),LTRMID(LMTMID),
     1MSKBGN(LNGBGN),LTRDGT(10),LTRMOD(10)
      DATA LTRMOD/1HA,1HE,1HF,1HH,1HL,1HN,1HU,1HV,1HW,1H=/
      DATA LTRDGT/1H0,1H1,1H2,1H3,1H4,1H5,1H6,1H7,1H8,1H9/
      DATA LTRSPA/1H /
C
      MAGOVR=MAGBGN
      LNGMID=LFTCOL
      IF(LOCKED.NE.999)GO TO 64
      NEWFNT=MAGFNT
      IF(NEWFNT.LE.0)NEWFNT=1
      IF(NEWFNT.GT.KNTFNT)NEWFNT=KNTFNT
      MAXFNT=ILIMIT(NEWFNT)
      IHIGH=ILINES(NEWFNT)
      IWIDE=ICOMMN(NEWFNT)
      JWIDE=IMAXMM(NEWFNT)
      INIFNT=0
      IBELOW=0
      IF(NEWFNT.LE.1)GO TO 2
      INIFNT=ILIMIT(NEWFNT-1)
      I=0
      J=0
    1 I=I+1
      IF(I.GE.NEWFNT)GO TO 2
      IBELOW=IBELOW+(ILINES(I)*(ILIMIT(I)-J))
      J=ILIMIT(I)
      GO TO 1
    2 MAGHIH=IHIGH
      NOWLIN=MAGLIN
      IF(NOWLIN.LE.0)NOWLIN=IHIGH
      IF(NOWLIN.GT.IHIGH)GO TO 65
      IUSED=LFTCOL
      IWHITE=MOVE
      KWIDE=IWIDE
      IF(IWHITE.LE.-2)KWIDE=JWIDE
      JSPACE=MAGSPC
      IF(JSPACE.LT.0)JSPACE=0
      LAST=0
      KSPACE=0
      NEED=0
      MAXKNT=IUSED+IWIDTH
      IF(MAXKNT.GT.LMTMID)MAXKNT=LMTMID
      IFCASE=1
      NOWVRT=1
      NOWHRZ=1
      KASATO=0
      LWIDE=KWIDE
      NOWTST=0
      GO TO 5
C
C     FIND OUT IF CAN REPRESENT THE LETTER
    3 KSPACE=JSPACE
      LAST=MATCH
      LSTVRT=NOWVRT
      LSTHRZ=NOWHRZ
      LSTLNG=NOWLNG
    4 MAGOVR=MAGOVR+1
    5 IF(MAGOVR.GT.LNGBGN)GO TO 60
      LTRNOW=LTRBGN(MAGOVR)
      IF(LTRNOW.EQ.LTRSPA)GO TO 9
      IF(MRKMAG.LE.0)GO TO 6
      IF(LTRNOW.NE.LTRMAG)GO TO 6
      MSKBIT=MSKBGN(MAGOVR)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 15
    6 MATCH=INIFNT
      KNTKAS=0
    7 MATCH=MATCH+1
      IF(MATCH.GT.MAXFNT)GO TO 8
      IF(LTRNOW.NE.LTRFNT(MATCH))GO TO 7
      KNTKAS=KNTKAS+1
      IF(KNTKAS.GE.IFCASE)GO TO 29
      LSTKAS=MATCH
      GO TO 7
    8 IF(KNTKAS.GT.0)GO TO 28
      GO TO 10
C
C     REPRESENT SPACE OR UNKNOWN CHARACTER
    9 IF(KASATO.GE.0)GO TO 10
      KASATO=-KASATO
      IFCASE=KASATO-IFCASE
   10 IF(ISPACE.LE.0)GO TO 11
      IF(LAST.EQ.0)GO TO 4
   11 KSPACE=KSPACE+LWIDE
      IF(ISPACE.GE.0)GO TO 14
      I=KSPACE
      IF(IWHITE.LE.0)GO TO 12
      IF(LAST.NE.0)I=I-JSPACE
   12 IF((IUSED+I).GT.MAXKNT)GO TO 60
   13 IF(I.LE.0)GO TO 14
      I=I-1
      KSPACE=KSPACE-1
      IUSED=IUSED+1
      LTRMID(IUSED)=LTRSPA
      GO TO 13
   14 IF(IWHITE.LE.0)KSPACE=KSPACE+JSPACE
      GO TO 4
C
C     DOLLAR CONTROL CHARACTER FOUND
   15 MAGOVR=MAGOVR+1
      IF(MAGOVR.GT.LNGBGN)GO TO 60
      LTRNOW=LTRBGN(MAGOVR)
      IF(LTRNOW.EQ.LTRMAG)GO TO 6
      DO 16 I=1,10
      IF(LTRNOW.NE.LTRMOD(I))GO TO 16
      GO TO(22,25,21,20,27,23,26,19,24,18),I
   16 CONTINUE
      DO 17 I=2,10
      IF(LTRNOW.NE.LTRDGT(I))GO TO 17
      IFCASE=I-1
      KASATO=0
      GO TO 4
   17 CONTINUE
      GO TO 4
   18 NOWVRT=1
      NOWHRZ=1
      IFCASE=1
      KASATO=0
      LWIDE=KWIDE
      IWHITE=MOVE
      GO TO 4
   19 NOWVRT=-1
      GO TO 4
   20 NOWHRZ=-1
      GO TO 4
   21 IF(IWHITE.GT.0)IWHITE=0
      GO TO 4
   22 IF(IWHITE.EQ.0)IWHITE=1
      GO TO 4
   23 LWIDE=KWIDE/2
      GO TO 4
   24 LWIDE=(3*KWIDE)/2
      GO TO 4
   25 IF(KASATO.LT.0)IFCASE=-KASATO-IFCASE
      KASATO=0
      GO TO 4
   26 IF(KASATO.EQ.0)KASATO=(4*((IFCASE+1)/2))-1
      IF(KASATO.GT.0)GO TO 4
      KASATO=-KASATO
      IFCASE=KASATO-IFCASE
      GO TO 4
   27 IF(KASATO.LT.0)GO TO 4
      IF(KASATO.EQ.0)KASATO=(4*((IFCASE+1)/2))-1
      IFCASE=KASATO-IFCASE
      KASATO=-KASATO
      GO TO 4
C
C     PREPARE TO PLOT CHARACTER
   28 MATCH=LSTKAS
   29 IF(KASATO.LE.0)GO TO 30
      IFCASE=KASATO-IFCASE
      KASATO=-KASATO
   30 NOWLNG=ICLMNS(MATCH)
C
C     DETERMINE OPTIMUM SPACING
C
C     SKIP AROUND THIS CODE IF NORMAL
C     INTER-CHARACTER SPACING IS ACCEPTABLE
C     WITHOUT WHITE AREA ADJUSTMENT.
C     THE CALCULATIONS ARE DESIGNED TO PRODUCE
C     DISTANCES OF THE SORT
C
C                  4
C                  34
C                  234
C                  1234
C                  01234
C                 X01234
C                  01234
C                  1234
C                  234
C                  34
C                  4
C
C     THE FIRST LOOP CATCHES THE MOST COMMON CASE OF
C     2 CHARACTERS TOUCHING ON THE SAME LINE.  THE
C     SECOND LONGER LOOP CATCHES THIS CASE AND ALL
C     OTHERS AND COULD BE USED BY ITSELF.
      IF(IWHITE.LT.0)GO TO 49
      IF(JSPACE.EQ.0)GO TO 50
      LSTTST=NOWTST
      NOWTST=2**(NOWLNG-1)
      IF(LAST.EQ.0)GO TO 50
      IF(IWHITE.EQ.0)GO TO 50
      MIN=JSPACE
      ISTART=(IHIGH*(LAST-1-INIFNT))+IBELOW
      JSTART=(IHIGH*(MATCH-1-INIFNT))+IBELOW
      IF(LSTVRT.EQ.NOWVRT)GO TO 31
      LSTVRT=-1
      ISTART=ISTART+IHIGH+1
      GO TO 32
   31 LSTVRT=1
   32 IINDEX=ISTART
      JINDEX=JSTART
      DO 36 I=1,IHIGH
      IINDEX=IINDEX+LSTVRT
      JINDEX=JINDEX+1
      K=IPACKD(IINDEX)
      IF(LSTHRZ.LT.0)GO TO 33
      IF(K.EQ.(2*(K/2)))GO TO 36
      GO TO 34
   33 IF(K.LT.LSTTST)GO TO 36
   34 K=IPACKD(JINDEX)
      IF(NOWHRZ.GT.0)GO TO 35
      IF(K.EQ.(2*(K/2)))GO TO 36
      GO TO 50
   35 IF(K.GE.NOWTST)GO TO 50
   36 CONTINUE
      DO 48 I=1,IHIGH
      ISTART=ISTART+LSTVRT
      K=IPACKD(ISTART)
      IF(K.EQ.0)GO TO 48
      IF(LSTHRZ.GT.0)GO TO 38
      IDIST=LSTLNG
   37 K=K/2
      IDIST=IDIST-1
      IF(K.NE.0)GO TO 37
      GO TO 40
   38 IDIST=0
   39 L=K/2
      IF((L+L).NE.K)GO TO 40
      K=L
      IDIST=IDIST+1
      GO TO 39
   40 N=JSTART
      DO 47 J=1,IHIGH
      N=N+1
      K=IPACKD(N)
      IF(K.EQ.0)GO TO 47
      IF(NOWHRZ.GT.0)GO TO 42
      JDIST=IDIST
   41 L=K/2
      IF((L+L).NE.K)GO TO 44
      K=L
      JDIST=JDIST+1
      GO TO 41
   42 JDIST=IDIST+NOWLNG
   43 K=K/2
      JDIST=JDIST-1
      IF(K.NE.0)GO TO 43
   44 IF(I.GT.J)GO TO 45
      IF(I.EQ.J)GO TO 46
      JDIST=JDIST+J-I-1
      GO TO 46
   45 JDIST=JDIST+I-J-1
   46 IF(MIN.LE.JDIST)GO TO 47
      IF(JDIST.LE.0)GO TO 50
      MIN=JDIST
   47 CONTINUE
   48 CONTINUE
      KSPACE=KSPACE-MIN
      GO TO 50
C
C     ADJUST CENTERING OF NARROW CHARACTERS IF NEEDED
   49 IF(NOWLNG.GE.KWIDE)GO TO 50
      IF((IUSED+KSPACE+KWIDE).GT.MAXKNT)GO TO 60
      NEED=(KWIDE-NOWLNG)/2
      KSPACE=KSPACE+NEED
      NEED=KWIDE-NEED-NOWLNG
C
C     CONSTRUCT LETTER
   50 IF((IUSED+KSPACE+NOWLNG).GT.MAXKNT)GO TO 60
   51 IF(KSPACE.LE.0)GO TO 52
      KSPACE=KSPACE-1
      IUSED=IUSED+1
      LTRMID(IUSED)=LTRSPA
      GO TO 51
   52 I=(IHIGH*(MATCH-1-INIFNT))+NOWLIN+IBELOW
      IF(NOWVRT.LT.0)I=I+IHIGH-NOWLIN-NOWLIN+1
      I=IPACKD(I)
      LIMIT=NOWLNG
      IF(NOWHRZ.LT.0)GO TO 56
      IUSED=IUSED+NOWLNG
      J=IUSED
   53 IF(LIMIT.LE.0)GO TO 59
      LIMIT=LIMIT-1
      K=I/2
      IF((K+K).EQ.I)GO TO 54
      LTRMID(J)=LTRNOW
      GO TO 55
   54 LTRMID(J)=LTRSPA
   55 J=J-1
      I=K
      GO TO 53
   56 IF(LIMIT.LE.0)GO TO 59
      LIMIT=LIMIT-1
      IUSED=IUSED+1
      K=I/2
      IF((K+K).EQ.I)GO TO 57
      LTRMID(IUSED)=LTRNOW
      GO TO 58
   57 LTRMID(IUSED)=LTRSPA
   58 I=K
      GO TO 56
   59 IF(NEED.LE.0)GO TO 3
      NEED=NEED-1
      IUSED=IUSED+1
      LTRMID(IUSED)=LTRSPA
      GO TO 59
C
C     ALL LETTERS REPRESENTED, JUSTIFY AND FILL
   60 NEED=0
      IF(JSTIFY.GE.0)NEED=MAXKNT-IUSED
      IF(JSTIFY.EQ.0)NEED=NEED/2
      NEED=IUSED+NEED
      INIKNT=LNGMID
      LNGMID=NEED
      IF(IFILL.GT.0)LNGMID=MAXKNT
      I=LNGMID
   61 IF(I.LE.NEED)GO TO 62
      LTRMID(I)=LTRSPA
      I=I-1
      GO TO 61
   62 IF(IUSED.LE.INIKNT)GO TO 63
      LTRMID(I)=LTRMID(IUSED)
      I=I-1
      IUSED=IUSED-1
      GO TO 62
   63 IF(I.LE.INIKNT)GO TO 65
      LTRMID(I)=LTRSPA
      I=I-1
      GO TO 63
C
C     RETURN TO CALLING PROGRAM
   64 MAGHIH=0
   65 RETURN
      END
      SUBROUTINE RNOALL
C     RENBR(/ALL FROFF FEATURES EXCEPT INDEX CONSTRUCTION)
C
C     DONALD E. BARTH, YALE SCHOOL OF MANAGEMENT
C
      COMMON/RNOONE/I     ,IAPNDX,IBRFTN,IBYTE ,ICENTR,
     1ICHAPT,IDEBUG,IDEFER,IDFILE,IDFRFG,IDFRPG,IDISK ,
     2IFABAR,IFAUTO,IFENCE,IFFILL,IFFLAG,IFHEAD,IFLIST,
     3IFLOOP,IFLSUB,IFNATO,IFNBGN,IFNFIL,IFNGAP,
     4IFNGSP,IFNHAV,IFNIBR,IFNICN,IFNIDF,IFNIFA,IFNIIN,
     5IFNILF,IFNIND,IFNIRT,IFNISP,IFNJCN,IFNJDF,IFNJFL,
     6IFNJST,IFNKCN,IFNKDF,IFNKLM,IFNLBR,IFNLBS,IFNLOF,
     7IFNLSP,IFNMBR,IFNMFR,IFNMLF,IFNMNS,IFNMRT,
     8IFNNBR,IFNNIN,IFNNLF,IFNNOF,IFNNOT,IFNNRT,IFNNSK,
     9IFNNTF,IFNNTL,IFNNTR,IFNNTS,IFNNTT,IFNNT1,IFNNT2
      COMMON/RNOTWO/IFNNT3,IFNOFF,IFNOPN,IFNOTE,IFNPIN,
     1IFNPRD,IFNPSK,IFNPTS,IFNRBS,IFNRDY,IFNRED,IFNRIT,
     2IFNROF,IFNTTL,IFNULS,IFNUMB,IFPAGE,IFRSUB,IFSPLC,
     3IGAPHI,IGAPLO,IGROUP,IMINUS,INDENT,INDFTN,INIALL,
     4INIAPP,INIBAR,INICHA,INIFRM,INILIN,ININDX,ININXT,
     5INISPA,INITAL,INNOTE,INTIND,INTLFT,INTRIT,INTRVL,
     6IOFFST,IPEROD,IPGSHO,IQUOTE,IRANGE,IREVRS,IRTBAS,
     7IRTFTN,IRTOFF,IRUNIN,ISECTN,ISKFTN,ISKIP ,ISPACE,
     8ISTART,ISUBPG,ITLALL,ITLLIN,ITLNXT,ITLSPA,ITRMNL,
     9ITTY  ,IULSPC,IVALUE,IWIZRD,J     ,JCENTR,JDFRFG
      COMMON/RNOTHR/JDFRPG,JDISK ,JFILL ,JFNBGN,JFNGAP,
     1JFNOPN,JFNRED,JFNRIT,JGROUP,JMINUS,JOFFST,JRANGE,
     2JSECTN,JSKIP ,JSTIFY,JTTY  ,JVALUE,K     ,KAPITL,
     3KASALL,KASFLG,KASLCL,KCENTR,KDFRFG,KDISK ,KFNGAP,
     4KLMFIL,KLMMNS,KMINUS,KNDAPP,KNDCHA,KNDFIL,KNDLFT,
     5KNDLIN,KNDPAG,KNDRIT,KNDSPL,KNDSUB,KNDTRN,KNTARG,
     6KNTCOD,KNTFTN,KNTFXD,KNTLIN,KNTLOP,KNTLVL,KNTPAG,
     7KNTPNT,KNTRST,KNTSHO,KNTSPC,KNTSPL,KNTTOP,KNTXTR,
     8KOMAND,KOMENT,KONECT,KPYBGN,KPYKAS,KPYMID,KPYPRT,
     9KRANGE,KSKIP ,KVALUE,LCLBAR,LCLNDX,LCLSUP,KAPNDX
      COMMON/RNOFOU/LDISK ,LENGTH,LEVEL0,LEVEL1,LEVEL3,
     1LEVEL4,LFNGAP,LFTBAS,ILFFTN,LFTOFF,LFTRIT,LINFIG,
     2LINSPL,LITERL,LMTBGN,LMTCHA,LMTCOD,LMTFNR,LMTKAS,
     3LMTLST,LMTLVL,LMTMID,LMTNDX,LMTTAB,LMTTTL,LMTUNT,
     4LMTWRK,LNGBGN,LNGBOT,LNGCHA,LNGFNR,LNGFTN,LNGMID,
     5NXTFTN,LNGPAG,LNGSPL,LNGSRC,LNGTRN,LNGTTL,KNDNDX,
     6LOCABC,LOCATE,LOCPAG,LOCPNT,LOKSUP,LOWBFR,NSKIP ,
     7LRADJS,LRFORC,LSNSPL,LSNSRC,LSTAPP,LSTCHA,LSTELM,
     8LSTFRM,LSTSPL,LSTTRN,MAJOR ,MASTER,MAXBGN,MAXLIN,
     9MAXLOP,MAXSPL,MAXTAB,MAXWRD,MDISK ,MIDAPP,MIDCHA
      COMMON/RNOFIV/MINLVL,MINTOP,MOVBAC,MRGFAR,MRGLFT,
     1MRGRIT,MRGTOP,MRKAMP,MRKBAC,MRKBAR,MRKCAR,MRKDOL,
     2MRKDOT,MRKEFN,MRKEXC,MRKFTN,MRKLES,MRKNDX,MRKNUM,
     3MRKREF,MRKSBX,MRKSEM,MRKSUB,MRKSUP,MRKTTL,MRKTXT,
     4MRKUND,MSTLST,NDISK ,NDXDSK,NDXFOU,NDXHOW,NDXKNT,
     5NDXMAK,NDXONE,NDXOPN,NDXTHR,NDXTWO,NEEDED,NEWCHA,
     6NEWPAG,NOTFIL,NOTIND,NOTKLM,NOTLFT,NOTMNS,NOTONE,
     7NOTRIT,NOTSEM,NOTSKP,NOTSPC,NOTTHR,NOTTST,NOTTWO,
     8NOWBAR,NOWFTN,NOWIND,NOWLFT,NOWLST,NOWOFF,NOWPAG,
     9NOWPHW,NOWRIT,NOWSEC,NOWSHW,NOWSKP,NOWSPH,NOWSUB
      COMMON/RNOSIX/NOWTST,NULTTL,NUMFTN,NXTFIG,NXTHDR,
     1NXTLST,NXTLVL,NXTONE,NXTPAG,NXTSUB,KNDOUT,LNGWRK,
     2KAPFTN,KOFFST,IRECRD,KNTNDX,INIPAG,INIHIA,MAGNFY,
     3INIHIB,IFHALF,KTRMNL,ITTLLO,ISUBLO,LNGTOP,MAGFNT,
     4ITTLHI,ISUBHI,IFINDX,IXTRSS,JXTRSS,KXTRSS,MAGSPC,
     5MXTRSS,NXTRSS,IFORMR,JTRMNL,IFNREF,IFNNUM,KMPPAG,
     6KMPLIN,KMPCLM,KMPVAL,INICLM,MFNGAP,NFNGAP,MAGSAV,
     7MAGSHD,MAGHIH,MRKMAG,LMTSHD,LNGSHD,LFTSHD,IRISHD,
     8IHISHD,ILOSHD,KNTSHD,LFTSGN,IRISGN,NGLSHD,NETNGL,
     9NETSEP,NETWID,NETOFF,NETKNT,KNTEDT,LMTEDT,LMTBIG,
     1LNGBIG,NGLBIG,KNTBIG,NXTSKP,JBORDR,INIMAG,INIOBJ,
     2IBORDR
      COMMON/RNOEIG/INDLST(10)  ,KMDARG(250) ,KMDBRK(250) ,
     1 KNDLVL(6)   ,KNDTTL(16)  ,LOCTAB(32)  ,LSTMRG(10)  ,
     2 LSTRIT(10)  ,LSTSKP(10)  ,LSTSPC(10)  ,LSTTTL(80)  ,
     3 LSTTYP(10)  ,LSTVAL(10)  ,MCHPNT(1300),MSKBGN(300) ,
     4 MSKCHA(200) ,MSKFNR(200) ,MSKFTN(200) ,MSKMID(200) ,
     5 MSKTTL(450) ,NARGMT(44)  ,NBEGIN(19)  ,NMINUS(32)  ,
     6 NOTPNT(1300),NUMLVL(6)   ,NUMNDX(300) ,NUMTTL(11)  ,
     7 NVALUE(32)  ,NXTCMD(81)  ,NXTPNT(12)  ,NXTUNT(4)   ,
     8 MSKWRK(200) ,MTYSTR(4)   ,MAGEDT(50)
      COMMON/RNONIN/LTRAMP,LTRBAC,LTRBAR,LTRCAR,LTRCOM,
     1LTRDOL,LTRDOT,LTREFN,LTREXC,LTRFNC,LTRLES,
     2LTRMNS,LTRNDX,LTRNOW,LTRNUM,LTRPLS,LTRQUO,LTRRUL,
     3LTRSBX,LTRSEM,LTRSPA,LTRSUB,LTRSUP,LTRTAB,
     4LTRPUT,LTRTXT,LTRUND,LTR1ST,LTRMAG
      COMMON/RNOTEN/LTRABC(26)  ,LTRAPP(9)   ,LTRBGN(300) ,
     1 LTRCPT(8)   ,LTRCLS(10)  ,LTRCOD(70)  ,LTRDGT(10)  ,
     2 LTRFLG(18)  ,LTRFTN(200) ,LTRIND(5)   ,LTRLST(10,6),
     3 LTRMID(200) ,LTRONL(26)  ,LTRONU(26)  ,LTROPN(10)  ,
     4 LTRPAG(5)   ,LTRREF(4)   ,LTRSPL(200) ,LTRTWO(4)   ,
     5 LTRTYP(8)   ,LTRWRK(200) ,LWRABC(26)  ,LWRAPP(9)   ,
     6 LWRCHA(8)   ,LWRIND(5)   ,LWRONL(26)  ,LWRONU(26)  ,
     7 LWRTYP(8)   ,LTRTTL(450) ,LTRCHA(200) ,LTRFNR(200) ,
     8 LTRSHD(50)  ,LTRBIG(50)
C
C     CHECK IF JUST COMPLETED AN INDEX
      IF(LEVEL0.EQ.3)GO TO 16
      IF(LEVEL0.EQ.7)GO TO 2
      IF(LEVEL0.NE.6)GO TO 1
      IF(MASTER.EQ.3)GO TO 8
C
C     GET NEXT COMMAND OR NEXT LINE OF TEXT
C     MASTER = LT.7, GET NEXT COMMAND OR NEW LINE OF TEXT
C            = 7 THROUGH 9, GET REST OF TEXTUAL ARGUMENT OF
C              COMMAND
C            = 7, GET REST OF AN UNQUOTED STRING INCLUDING
C              PERIODS BUT NOT SEMICOLONS
C            = 8, GET REST OF AN UNQUOTED STRING INCLUDING
C              ALL CHARACTERS
C            = 9, GET REST OF A QUOTED TEXT STRING FOR
C              WHICH THE FINAL DELIMITER CHARACTER HAS NOT
C              BEEN FOUND.  CHARACTERS ARE PROCESSED UP TO
C              THE NEXT PERIOD OR SEMICOLON AT A ZERO
C              DELIMITER COUNT.
    1 MASTER=0
    2 CALL RNOGET
C     MASTER = 0, TEXT RETURNED
C            = 1, END OF FILE READ
C            = 2, DOT COMMAND FOUND OR REST OF TEXTUAL
C              ARGUMENT OF SUCH A COMMAND FOUND
      IF(MASTER.LE.0)GO TO 13
      IF(MASTER.EQ.11)GO TO 12
      IF(MASTER.EQ.12)GO TO 22
      IF(MASTER.GE.6)GO TO 7
      GO TO(3,7,4,5,6),MASTER
    3 KOMAND=5
      GO TO 23
    4 KOMAND=46
      GO TO 8
    5 KOMAND=36
      IVALUE=0
      IMINUS=0
      KNTARG=0
      GO TO 8
    6 KOMAND=503
      MAJOR=0
      GO TO 15
C
C     IDENTIFY DOT COMMAND AND EVALUATE ITS ARGUMENTS
C     MASTER = INPUT VALUE IS IGNORED
    7 CALL RNOHOW
C     MASTER = 0, TREAT COMAND AS LITERAL LINE OF TEXT
C            = 1, LEGAL COMMAND
C            = 7 THRU 9, NEED REST OF TEXTUAL ARGUMENT OF
C              COMMAND
C            = 6, ILLEGAL COMMAND OR ILLEGAL ARGUMENT
      IF(MASTER.GE.6)GO TO 2
      IF(MASTER.EQ.0)GO TO 2
      IF(KOMAND.EQ.5)GO TO 23
C
C     SIMULATE COMMANDS REQUIRED BY OTHERS
    8 MAJOR=KMDBRK(KOMAND)
      IF(MAJOR.EQ.0)GO TO 11
      MAJOR=NXTPNT(MAJOR)
      NXTONE=KOMAND
      IF(KOMAND.NE.5)GO TO 9
      IF(KNDFIL.GT.0)GO TO 11
    9 KOMAND=NXTCMD(MAJOR)
      MAJOR=MAJOR+1
      IF(KOMAND.EQ.0)GO TO 10
      IF(KOMAND.GT.0)GO TO 15
      MASTER=-KOMAND
      GO TO 13
   10 KOMAND=NXTONE
      MAJOR=0
      GO TO 15
   11 MAJOR=0
      GO TO 15
   12 MASTER=1
   13 CALL RNOPUT
C     MASTER = RETURNED UNCHANGED
      IF(MASTER.EQ.0)GO TO 2
      IF(MASTER.LT.0)GO TO 14
      IF(MASTER.NE.1)GO TO 9
      IF(NSKIP.NE.0)GO TO 14
      IF(MAGNFY.GT.0)GO TO 14
      IF(LSTTRN.NE.0)GO TO 14
      GO TO 9
   14 MASTER=11
      GO TO 2
C
C     APPLY DOT COMMAND
C     MASTER = NOT USED, AND RETURNED UNCHANGED
C     KOMAND = 55, DO INDEX COMMAND
C            = 132 PRINT INDEX COMMAND
C            = 504, SIMULATE DO INDEX COMMAND
   15 IF(KOMAND.EQ.55)GO TO 20
      IF(KOMAND.EQ.132)GO TO 20
      IF(KOMAND.EQ.504)GO TO 20
      CALL RNOSET
C     KOMAND = 5, END OF FILE COMMAND OR REAL END OF FILE
C            = 39, RESET COMMAND
C            = 65, SPLICE COMMAND
C            = 87, RESET ALL COMMAND
      IF(KOMAND.EQ.65)GO TO 21
   16 IF(MAJOR.GT.0)GO TO 9
      IF(KOMAND.EQ.39)GO TO 18
      IF(KOMAND.EQ.87)GO TO 17
      IF(KOMAND.EQ.503)GO TO 2
      IF(KOMAND.NE.5)GO TO 1
C
C     CLOSE OUTPUT FILES WHEN DONE
      LEVEL0=1
      GO TO 24
C
C     CALL RNONEW TO INITIALIZE OR RESET VARIABLES
   17 MASTER=1
      GO TO 19
   18 MASTER=2
   19 LEVEL0=4
      GO TO 24
C
C     CONSTRUCT INDEX
   20 LEVEL0=3
      GO TO 24
C
C     OPEN SPLICE FILE
   21 LEVEL0=2
      GO TO 24
C
C     CONSTRUCT LINE OF LARGE LETTERING
   22 LEVEL0=7
      GO TO 24
C
C     TEST IF NEED ANOTHER FILE ON END OF FILE
   23 IF(KNDFIL.GT.0)GO TO 8
      LEVEL0=6
C
C     RETURN TO MAIN PROGRAM
   24 RETURN
      END
      SUBROUTINE RNOGET
C     RENBR(/READ INPUT AND CONSTRUCT LINE OF OUTPUT TEXT)
C
C     DONALD E. BARTH, YALE SCHOOL OF MANAGEMENT
C
      COMMON/RNOONE/I     ,IAPNDX,IBRFTN,IBYTE ,ICENTR,
     1ICHAPT,IDEBUG,IDEFER,IDFILE,IDFRFG,IDFRPG,IDISK ,
     2IFABAR,IFAUTO,IFENCE,IFFILL,IFFLAG,IFHEAD,IFLIST,
     3IFLOOP,IFLSUB,IFNATO,IFNBGN,IFNFIL,IFNGAP,
     4IFNGSP,IFNHAV,IFNIBR,IFNICN,IFNIDF,IFNIFA,IFNIIN,
     5IFNILF,IFNIND,IFNIRT,IFNISP,IFNJCN,IFNJDF,IFNJFL,
     6IFNJST,IFNKCN,IFNKDF,IFNKLM,IFNLBR,IFNLBS,IFNLOF,
     7IFNLSP,IFNMBR,IFNMFR,IFNMLF,IFNMNS,IFNMRT,
     8IFNNBR,IFNNIN,IFNNLF,IFNNOF,IFNNOT,IFNNRT,IFNNSK,
     9IFNNTF,IFNNTL,IFNNTR,IFNNTS,IFNNTT,IFNNT1,IFNNT2
      COMMON/RNOTWO/IFNNT3,IFNOFF,IFNOPN,IFNOTE,IFNPIN,
     1IFNPRD,IFNPSK,IFNPTS,IFNRBS,IFNRDY,IFNRED,IFNRIT,
     2IFNROF,IFNTTL,IFNULS,IFNUMB,IFPAGE,IFRSUB,IFSPLC,
     3IGAPHI,IGAPLO,IGROUP,IMINUS,INDENT,INDFTN,INIALL,
     4INIAPP,INIBAR,INICHA,INIFRM,INILIN,ININDX,ININXT,
     5INISPA,INITAL,INNOTE,INTIND,INTLFT,INTRIT,INTRVL,
     6IOFFST,IPEROD,IPGSHO,IQUOTE,IRANGE,IREVRS,IRTBAS,
     7IRTFTN,IRTOFF,IRUNIN,ISECTN,ISKFTN,ISKIP ,ISPACE,
     8ISTART,ISUBPG,ITLALL,ITLLIN,ITLNXT,ITLSPA,ITRMNL,
     9ITTY  ,IULSPC,IVALUE,IWIZRD,J     ,JCENTR,JDFRFG
      COMMON/RNOTHR/JDFRPG,JDISK ,JFILL ,JFNBGN,JFNGAP,
     1JFNOPN,JFNRED,JFNRIT,JGROUP,JMINUS,JOFFST,JRANGE,
     2JSECTN,JSKIP ,JSTIFY,JTTY  ,JVALUE,K     ,KAPITL,
     3KASALL,KASFLG,KASLCL,KCENTR,KDFRFG,KDISK ,KFNGAP,
     4KLMFIL,KLMMNS,KMINUS,KNDAPP,KNDCHA,KNDFIL,KNDLFT,
     5KNDLIN,KNDPAG,KNDRIT,KNDSPL,KNDSUB,KNDTRN,KNTARG,
     6KNTCOD,KNTFTN,KNTFXD,KNTLIN,KNTLOP,KNTLVL,KNTPAG,
     7KNTPNT,KNTRST,KNTSHO,KNTSPC,KNTSPL,KNTTOP,KNTXTR,
     8KOMAND,KOMENT,KONECT,KPYBGN,KPYKAS,KPYMID,KPYPRT,
     9KRANGE,KSKIP ,KVALUE,LCLBAR,LCLNDX,LCLSUP,KAPNDX
      COMMON/RNOFOU/LDISK ,LENGTH,LEVEL0,LEVEL1,LEVEL3,
     1LEVEL4,LFNGAP,LFTBAS,ILFFTN,LFTOFF,LFTRIT,LINFIG,
     2LINSPL,LITERL,LMTBGN,LMTCHA,LMTCOD,LMTFNR,LMTKAS,
     3LMTLST,LMTLVL,LMTMID,LMTNDX,LMTTAB,LMTTTL,LMTUNT,
     4LMTWRK,LNGBGN,LNGBOT,LNGCHA,LNGFNR,LNGFTN,LNGMID,
     5NXTFTN,LNGPAG,LNGSPL,LNGSRC,LNGTRN,LNGTTL,KNDNDX,
     6LOCABC,LOCATE,LOCPAG,LOCPNT,LOKSUP,LOWBFR,NSKIP ,
     7LRADJS,LRFORC,LSNSPL,LSNSRC,LSTAPP,LSTCHA,LSTELM,
     8LSTFRM,LSTSPL,LSTTRN,MAJOR ,MASTER,MAXBGN,MAXLIN,
     9MAXLOP,MAXSPL,MAXTAB,MAXWRD,MDISK ,MIDAPP,MIDCHA
      COMMON/RNOFIV/MINLVL,MINTOP,MOVBAC,MRGFAR,MRGLFT,
     1MRGRIT,MRGTOP,MRKAMP,MRKBAC,MRKBAR,MRKCAR,MRKDOL,
     2MRKDOT,MRKEFN,MRKEXC,MRKFTN,MRKLES,MRKNDX,MRKNUM,
     3MRKREF,MRKSBX,MRKSEM,MRKSUB,MRKSUP,MRKTTL,MRKTXT,
     4MRKUND,MSTLST,NDISK ,NDXDSK,NDXFOU,NDXHOW,NDXKNT,
     5NDXMAK,NDXONE,NDXOPN,NDXTHR,NDXTWO,NEEDED,NEWCHA,
     6NEWPAG,NOTFIL,NOTIND,NOTKLM,NOTLFT,NOTMNS,NOTONE,
     7NOTRIT,NOTSEM,NOTSKP,NOTSPC,NOTTHR,NOTTST,NOTTWO,
     8NOWBAR,NOWFTN,NOWIND,NOWLFT,NOWLST,NOWOFF,NOWPAG,
     9NOWPHW,NOWRIT,NOWSEC,NOWSHW,NOWSKP,NOWSPH,NOWSUB
      COMMON/RNOSIX/NOWTST,NULTTL,NUMFTN,NXTFIG,NXTHDR,
     1NXTLST,NXTLVL,NXTONE,NXTPAG,NXTSUB,KNDOUT,LNGWRK,
     2KAPFTN,KOFFST,IRECRD,KNTNDX,INIPAG,INIHIA,MAGNFY,
     3INIHIB,IFHALF,KTRMNL,ITTLLO,ISUBLO,LNGTOP,MAGFNT,
     4ITTLHI,ISUBHI,IFINDX,IXTRSS,JXTRSS,KXTRSS,MAGSPC,
     5MXTRSS,NXTRSS,IFORMR,JTRMNL,IFNREF,IFNNUM,KMPPAG,
     6KMPLIN,KMPCLM,KMPVAL,INICLM,MFNGAP,NFNGAP,MAGSAV,
     7MAGSHD,MAGHIH,MRKMAG,LMTSHD,LNGSHD,LFTSHD,IRISHD,
     8IHISHD,ILOSHD,KNTSHD,LFTSGN,IRISGN,NGLSHD,NETNGL,
     9NETSEP,NETWID,NETOFF,NETKNT,KNTEDT,LMTEDT,LMTBIG,
     1LNGBIG,NGLBIG,KNTBIG,NXTSKP,JBORDR,INIMAG,INIOBJ,
     2IBORDR
      COMMON/RNOEIG/INDLST(10)  ,KMDARG(250) ,KMDBRK(250) ,
     1 KNDLVL(6)   ,KNDTTL(16)  ,LOCTAB(32)  ,LSTMRG(10)  ,
     2 LSTRIT(10)  ,LSTSKP(10)  ,LSTSPC(10)  ,LSTTTL(80)  ,
     3 LSTTYP(10)  ,LSTVAL(10)  ,MCHPNT(1300),MSKBGN(300) ,
     4 MSKCHA(200) ,MSKFNR(200) ,MSKFTN(200) ,MSKMID(200) ,
     5 MSKTTL(450) ,NARGMT(44)  ,NBEGIN(19)  ,NMINUS(32)  ,
     6 NOTPNT(1300),NUMLVL(6)   ,NUMNDX(300) ,NUMTTL(11)  ,
     7 NVALUE(32)  ,NXTCMD(81)  ,NXTPNT(12)  ,NXTUNT(4)   ,
     8 MSKWRK(200) ,MTYSTR(4)   ,MAGEDT(50)
      COMMON/RNONIN/LTRAMP,LTRBAC,LTRBAR,LTRCAR,LTRCOM,
     1LTRDOL,LTRDOT,LTREFN,LTREXC,LTRFNC,LTRLES,
     2LTRMNS,LTRNDX,LTRNOW,LTRNUM,LTRPLS,LTRQUO,LTRRUL,
     3LTRSBX,LTRSEM,LTRSPA,LTRSUB,LTRSUP,LTRTAB,
     4LTRPUT,LTRTXT,LTRUND,LTR1ST,LTRMAG
      COMMON/RNOTEN/LTRABC(26)  ,LTRAPP(9)   ,LTRBGN(300) ,
     1 LTRCPT(8)   ,LTRCLS(10)  ,LTRCOD(70)  ,LTRDGT(10)  ,
     2 LTRFLG(18)  ,LTRFTN(200) ,LTRIND(5)   ,LTRLST(10,6),
     3 LTRMID(200) ,LTRONL(26)  ,LTRONU(26)  ,LTROPN(10)  ,
     4 LTRPAG(5)   ,LTRREF(4)   ,LTRSPL(200) ,LTRTWO(4)   ,
     5 LTRTYP(8)   ,LTRWRK(200) ,LWRABC(26)  ,LWRAPP(9)   ,
     6 LWRCHA(8)   ,LWRIND(5)   ,LWRONL(26)  ,LWRONU(26)  ,
     7 LWRTYP(8)   ,LTRTTL(450) ,LTRCHA(200) ,LTRFNR(200) ,
     8 LTRSHD(50)  ,LTRBIG(50)
C
C     GET WORD WHICH OVERFLOWED LINE WHEN .NO SPACE GIVEN
      IF(KONECT.GE.0)GO TO 5
      IF(LNGMID.GT.0)GO TO 5
      IF(ISKIP.LE.0)GO TO 1
      IF(IFPAGE.LE.0)GO TO 430
      IF((LOCPAG+ISKIP).LT.LNGPAG)GO TO 430
      IF(NEWPAG.EQ.0)NEWPAG=1
      ISKIP=-1
    1 KONECT=1
    2 IF(LNGFTN.GT.LMTMID)LNGFTN=LMTMID
      IF(NOWBAR.NE.0)IFABAR=NOWBAR
      LNGMID=0
      KNTSPC=0
      NEEDED=MRGLFT
      IF(NEEDED.GT.(LMTMID-LNGFTN))NEEDED=LMTMID-LNGFTN
      IF(NEEDED.LE.0)GO TO 4
      DO 3 I=1,NEEDED
      LNGMID=LNGMID+1
      MSKMID(LNGMID)=0
      LTRMID(LNGMID)=LTRSPA
    3 CONTINUE
    4 LNGMID=LNGMID+1
      LTRMID(LNGMID)=LTRFTN(LNGFTN)
      MSKMID(LNGMID)=MSKFTN(LNGFTN)
      LNGFTN=LNGFTN-1
      IF(LNGFTN.GT.0)GO TO 4
C
    5 IF(MASTER.GT.6)GO TO 46
      MASTER=0
      KASFLG=0
      IF(LINFIG.EQ.0)GO TO 8
      IF(JFILL.EQ.0)GO TO 6
      IF(KNDTRN.EQ.0)GO TO 6
      GO TO(340,8,8,229,8,8,263,8,8),KNDTRN
    6 IF(ISKIP.GT.0)GO TO 430
      IF(IFNOTE.NE.0)GO TO 7
      INIBAR=NOWBAR
      GO TO 430
    7 IF(NOWBAR.NE.0)IFABAR=NOWBAR
      GO TO 430
    8 IF(JSKIP.EQ.0)GO TO 13
      GO TO(140,393,414,142,10,415,421,173,141),JSKIP
    9 IF(JSKIP.EQ.0)GO TO 13
      IF(KPYBGN.LT.LNGBGN)GO TO 142
      LNGBGN=KPYKAS
      ISTART=KPYKAS
      KPYBGN=LNGBGN
      IF(KNTLVL.LT.IRUNIN)GO TO 413
      JSKIP=0
      KSKIP=1
      IF((LNGMID+2).LE.MRGRIT)GO TO 12
      JSKIP=5
      GO TO 185
   10 JSKIP=0
      NEEDED=MRGLFT+1
      IF(NEEDED.GT.LMTMID)NEEDED=LMTMID
      DO 11 I=1,NEEDED
      LNGMID=LNGMID+1
      LTRMID(LNGMID)=LTRSPA
      MSKMID(LNGMID)=0
   11 CONTINUE
      LTRMID(LNGMID)='-'
      KNTSPC=0
      GO TO 13
   12 LNGMID=LNGMID+1
      LTRMID(LNGMID)=' '
      MSKBIT=0
      CALL RNOPAK(1,MSKBIT)
      MSKMID(LNGMID)=MSKBIT
      LNGMID=LNGMID+1
      LTRMID(LNGMID)='-'
      MSKMID(LNGMID)=0
      KNTSPC=KNTSPC+1
   13 IF(KPYBGN.LT.LNGBGN)GO TO 142
      IF(LMTKAS.LT.MAXBGN)GO TO 45
      IF(IFSPLC.LE.0)GO TO 18
C
C     READ LINE OF INPUT FROM SPLICE FILE
      KNDFIL=1
      MAXBGN=LNGSPL
      IF(KRANGE.LT.0)GO TO 426
      IF(IWIZRD.EQ.0)READ(NDISK,20,END=426)(LTRBGN(I),I=1,MAXBGN)
      IF(IWIZRD.NE.0)READ(IDISK,20,END=426)(LTRBGN(I),I=1,MAXBGN)
      IF(LINSPL.GT.0)GO TO 17
      LSNSPL=0
      DO 15 I=1,5
      LTRNOW=LTRBGN(I)
      DO 14 J=1,10
      IF(LTRNOW.EQ.LTRDGT(J))GO TO 15
   14 CONTINUE
      GO TO 17
   15 CONTINUE
      LTRNOW=LTRBGN(6)
      IF(LTRNOW.EQ.LTRSPA)GO TO 17
      IF(LTRNOW.NE.LTRTAB)GO TO 17
D     WRITE(ITTY,16)
D  16 FORMAT(' Splice file is line sequence numbered')
      LSNSPL=6
      LNGSPL=LNGSPL+LSNSPL
      IF(LNGSPL.GT.LMTBGN)LNGSPL=LMTBGN
   17 LINSPL=LINSPL+1
      KNTSPL=KNTSPL+1
      IF(KNTSPL.EQ.MAXSPL)IFSPLC=-1
      LNGBGN=LSNSPL
      GO TO 29
C
C     READ LINE OF INPUT FROM SCRATCH FILE USED FOR LOOP
   18 IF(IFLOOP.GE.0)GO TO 21
      KNDFIL=-1
      IF(KNDSPL.NE.0)GO TO 26
      IF(IFLOOP.EQ.-1)CALL RNOFIL(3,4,MDISK,NXTUNT,LMTUNT,
     1ITTY,JTTY,IDFILE)
      IFLOOP=-2
      READ(MDISK,19)MAXBGN
   19 FORMAT(1I3)
      IF(MAXBGN.GT.0)READ(MDISK,20)(LTRBGN(I),I=1,MAXBGN)
   20 FORMAT(300A1)
      LNGBGN=0
      GO TO 44
C
C     READ LINE OF INPUT FROM PRIMARY SOURCE FILE
   21 KNDFIL=0
      IF(KNDSPL.NE.0)GO TO 26
      MAXBGN=LNGSRC
      IF(KRANGE.LT.0)GO TO 426
      READ(IDISK,20,END=426)(LTRBGN(I),I=1,MAXBGN)
      IF(KNTLIN.GT.0)GO TO 25
      LSNSRC=0
      DO 23 I=1,5
      LTRNOW=LTRBGN(I)
      DO 22 J=1,10
      IF(LTRNOW.EQ.LTRDGT(J))GO TO 23
   22 CONTINUE
      GO TO 25
   23 CONTINUE
      LTRNOW=LTRBGN(6)
      IF(LTRNOW.EQ.LTRSPA)GO TO 25
      IF(LTRNOW.NE.LTRTAB)GO TO 25
D     WRITE(ITTY,24)
D  24 FORMAT(' Input file is line sequence numbered')
      LSNSRC=6
      LNGSRC=LNGSRC+LSNSRC
      IF(LNGSRC.GT.LMTBGN)LNGSRC=LMTBGN
   25 KNTLIN=KNTLIN+1
      LNGBGN=LSNSRC
      GO TO 29
C
C     RESTORE REST OF LINE RIGHT OF .SPLICE FROM PRIMARY INPUT
   26 DO 27 I=1,LSTSPL
      LTRBGN(I)=LTRSPL(I)
   27 CONTINUE
      MAXBGN=LSTSPL
      LNGBGN=LSNSRC
      IF(KNDSPL.GE.0)GO TO 28
      KNDSPL=0
      KPYBGN=LSNSRC
      KPYKAS=LSNSRC
      LMTKAS=LSNSRC+1
      GO TO 140
   28 KNDSPL=0
      GO TO 44
C
C     FIND RIGHTMOST PRINTING CHARACTER READ FROM INPUT FILE
   29 J=MAXBGN
   30 IF(LTRBGN(MAXBGN).EQ.LTRSPA)GO TO 31
      IF(LTRBGN(MAXBGN).NE.LTRTAB)GO TO 32
   31 MAXBGN=MAXBGN-1
      IF(MAXBGN.GT.LNGBGN)GO TO 30
   32 IF(MAXBGN.LE.(J-5))GO TO 43
      IF(MAXBGN.LE.LNGBGN)GO TO 43
      IF(KNDFIL.GT.0)GO TO 36
      IF(IDEBUG.NE.0)GO TO 35
      IF(LSNSRC.EQ.0)WRITE(ITTY,33)KNTLIN
      IF(LSNSRC.GT.0)WRITE(ITTY,34)(LTRBGN(I),I=1,5)
   33 FORMAT(6H Line ,1I5,18H probably too long)
   34 FORMAT(6H Line ,5A1,18H probably too long)
      GO TO 39
   35 IF(LSNSRC.EQ.0)WRITE(JDISK,33)KNTLIN
      IF(LSNSRC.GT.0)WRITE(JDISK,34)(LTRBGN(I),I=1,5)
      GO TO 42
   36 IF(IDEBUG.NE.0)GO TO 41
      IF(LSNSPL.EQ.0)WRITE(ITTY,37)LINSPL
      IF(LSNSPL.GT.0)WRITE(ITTY,38)(LTRBGN(I),I=1,5)
   37 FORMAT(13H Splice line ,1I5,18H probably too long)
   38 FORMAT(13H Splice line ,5A1,18H probably too long)
   39 J=LNGBGN+1
      WRITE(ITTY,40)(LTRBGN(I),I=J,MAXBGN)
   40 FORMAT(3X,300A1)
      GO TO 43
   41 IF(LSNSPL.EQ.0)WRITE(JDISK,37)LINSPL
      IF(LSNSPL.GT.0)WRITE(JDISK,38)(LTRBGN(I),I=1,5)
   42 J=LNGBGN+1
      WRITE(JDISK,40)(LTRBGN(I),I=J,MAXBGN)
C
C     COPY LINE TO SCRATCH FILE IF IN RANGE OF LOOP COMMAND
   43 IF(KNDFIL.NE.0)GO TO 44
      IF(IFLOOP.LE.0)GO TO 44
      IF(IFLOOP.EQ.1)CALL RNOFIL(3,1,MDISK,NXTUNT,LMTUNT,
     1ITTY,JTTY,IDFILE)
      IFLOOP=2
      J=MAXBGN-LNGBGN
      WRITE(MDISK,19)J
      J=LNGBGN+1
      IF(MAXBGN.GT.LNGBGN)WRITE(MDISK,20)(LTRBGN(I),I=J,MAXBGN)
C
C     SET POINTERS TO START OF LINE JUST READ IN
   44 LMTKAS=LNGBGN
      KPYKAS=LNGBGN
      NOTSEM=LNGBGN
      KPYPRT=LNGBGN
      KPYBGN=LNGBGN
   45 ISTART=KPYKAS+1
      KOMENT=0
      GO TO 47
C
C     GET REST OF TEXTUAL ARGUMENT OF DOT COMMAND
   46 IF(MASTER.EQ.11)GO TO 217
      IF(MASTER.EQ.12)GO TO 214
      IF(MASTER.EQ.10)MASTER=0
      I=ITLALL
      ITLALL=INIALL
      INIALL=I
      I=ITLLIN
      ITLLIN=INILIN
      INILIN=I
      I=ITLNXT
      ITLNXT=ININXT
      ININXT=I
      I=ITLSPA
      ITLSPA=INISPA
      INISPA=I
      I=LOKSUP
      LOKSUP=INIHIA
      INIHIA=I
      I=LCLSUP
      LCLSUP=INIHIB
      INIHIB=I
C
C     GET NEXT CHARACTER FROM LINE READ FROM INPUT FILE
C     KOMENT = -1, IN COMMAND
C            = 0, NOT IN COMMAND, OR EXTENDING REST OF TEXTUAL
C              OF PREVIOUSLY FOUND COMMAND
C            = 1, IN COMMENT FOLLOWING COMMAND
   47 LMTKAS=LMTKAS+1
      IF(LMTKAS.GT.MAXBGN)GO TO 137
      LTRNOW=LTRBGN(LMTKAS)
      IF(KOMENT.EQ.0)GO TO 54
      IF(IQUOTE.NE.0)GO TO 53
      IF(MRKSEM.LE.0)GO TO 48
      IF(LTRNOW.EQ.LTRSEM)GO TO 131
   48 IF(KOMENT.GT.0)GO TO 54
      IF(LTRNOW.EQ.LTRDOT)GO TO 130
   49 IF(MRKEXC.LE.0)GO TO 50
      IF(LTRNOW.EQ.LTREXC)GO TO 51
   50 IF(IFENCE.EQ.0)GO TO 54
      IF(LTRNOW.EQ.LTRFNC)GO TO 52
      GO TO 54
   51 KOMENT=1
      GO TO 86
   52 IQUOTE=1
      GO TO 86
   53 IF(LTRNOW.NE.LTRTXT)GO TO 54
      IQUOTE=0
      GO TO 86
   54 IF(JFILL.EQ.6)GO TO 86
   55 IF(LTRNOW.EQ.LTRSPA)GO TO 100
      IF(LTRNOW.EQ.LTRTAB)GO TO 98
      IF(MRKNUM.LE.0)GO TO 56
      IF(LTRNOW.EQ.LTRNUM)GO TO 106
   56 IF(MRKUND.LE.0)GO TO 57
      IF(LTRNOW.EQ.LTRUND)GO TO 107
   57 IF(MRKCAR.LE.0)GO TO 58
      IF(LTRNOW.EQ.LTRCAR)GO TO 115
   58 IF(MRKBAC.LE.0)GO TO 59
      IF(LTRNOW.EQ.LTRBAC)GO TO 123
   59 IF(MRKLES.LE.0)GO TO 60
      IF(LTRNOW.EQ.LTRLES)GO TO 94
   60 IF(MRKAMP.LE.0)GO TO 61
      IF(LTRNOW.EQ.LTRAMP)GO TO 95
   61 IF(MRKSUP.LE.0)GO TO 62
      IF(LTRNOW.EQ.LTRSUP)GO TO 96
   62 IF(MRKSUB.LE.0)GO TO 63
      IF(LTRNOW.EQ.LTRSUB)GO TO 97
   63 IF(KASLCL.LT.0)GO TO 64
      IF(KASLCL.GT.0)GO TO 75
C     KASFLG = 0, NOT IN LESS THAN WORD CAPITALIZATION
C            = 1, IN RANGE OF LESS THAN WORD CAPITALIZATION
      IF(KASFLG.NE.0)GO TO 75
      IF(KASALL.EQ.0)GO TO 86
C
C     ATTEMPT TO CONVERT TO LOWER CASE
C     THIS IS A TERNARY SEARCH TAKING ADVANTAGE OF THE SIZE
C     OF  ALPHABET BEING NEARLY 3**3.  THE 3RD OF THE ARRAY
C     CONTAINING THE DESIRED LETTER  IS  FIRST FOUND,  THEN
C     THE  3RD  OF  THIS  3RD,  AND  FINALLY  EACH  OF  THE
C     REMAINING 3  LETTERS  ARE  TESTED  INDIVIDUALLY.   TO
C     PREVENT  TESTING  AGAINST  THE 27TH LETTER WHICH DOES
C     NOT EXIST, UPPER 3RD  IS  TAKEN  AS  UPPER  9  SORTED
C     LETTERS,  RATHER THAN FROM 19TH THROUGH 27TH LETTERS,
C     SO  LTRONU(18)  IS  TESTED  AGAINST IN UPPER 3RD EVEN
C     THOUGH LETTER BEING MATCHED HAS ALREADY BEEN FOUND TO
C     BE LARGER THAN THIS.
   64 IF(LTRNOW.GT.LTRONU(18))GO TO 66
      IF(LTRNOW.GT.LTRONU(9))GO TO 65
      IF(LTRNOW.LT.LTRONU(1))GO TO 86
      NXTLST=3
      GO TO 67
   65 NXTLST=12
      GO TO 67
   66 IF(LTRNOW.GT.LTRONU(26))GO TO 86
      NXTLST=20
   67 IF(LTRNOW.LE.LTRONU(NXTLST))GO TO 68
      NXTLST=NXTLST+3
      IF(LTRNOW.GT.LTRONU(NXTLST))NXTLST=NXTLST+3
   68 IF(LTRNOW.EQ.LTRONU(NXTLST))GO TO 69
      NXTLST=NXTLST-1
      IF(LTRNOW.EQ.LTRONU(NXTLST))GO TO 69
      NXTLST=NXTLST-1
      IF(LTRNOW.NE.LTRONU(NXTLST))GO TO 86
   69 KPYKAS=KPYKAS+1
      NOTSEM=KPYKAS
      IF(KOMENT.LE.0)LNGBGN=KPYKAS
      KPYPRT=KPYKAS
      LTRBGN(KPYKAS)=LWRONU(NXTLST)
      MSKBIT=0
      IF(ITLNXT.NE.ITLALL)CALL RNOPAK(2,MSKBIT)
      IF(KASLCL.NE.0)CALL RNOPAK(3,MSKBIT)
      IF(LCLSUP.NE.0)GO TO 70
      IF(LOKSUP.EQ.0)GO TO 74
      IF(LOKSUP.LT.0)GO TO 73
      GO TO 71
   70 IF(LCLSUP.LT.0)GO TO 72
      LCLSUP=LCLSUP-1
   71 CALL RNOPAK(4,MSKBIT)
      GO TO 74
   72 LCLSUP=LCLSUP+1
   73 CALL RNOPAK(5,MSKBIT)
   74 MSKBGN(KPYKAS)=MSKBIT
      IF(ITLNXT.GT.0)ITLNXT=ITLNXT-1
      KASLCL=0
      GO TO 47
C
C     ATTEMPT TO CONVERT TO UPPER CASE
   75 IF(LTRNOW.GT.LWRONL(18))GO TO 77
      IF(LTRNOW.GT.LWRONL(9))GO TO 76
      IF(LTRNOW.LT.LWRONL(1))GO TO 86
      NXTLST=3
      GO TO 78
   76 NXTLST=12
      GO TO 78
   77 IF(LTRNOW.GT.LWRONL(26))GO TO 86
      NXTLST=20
   78 IF(LTRNOW.LE.LWRONL(NXTLST))GO TO 79
      NXTLST=NXTLST+3
      IF(LTRNOW.GT.LWRONL(NXTLST))NXTLST=NXTLST+3
   79 IF(LTRNOW.EQ.LWRONL(NXTLST))GO TO 80
      NXTLST=NXTLST-1
      IF(LTRNOW.EQ.LWRONL(NXTLST))GO TO 80
      NXTLST=NXTLST-1
      IF(LTRNOW.NE.LWRONL(NXTLST))GO TO 86
   80 KPYKAS=KPYKAS+1
      NOTSEM=KPYKAS
      IF(KOMENT.LE.0)LNGBGN=KPYKAS
      KPYPRT=KPYKAS
      LTRBGN(KPYKAS)=LTRONL(NXTLST)
      MSKBIT=0
      IF(ITLNXT.NE.ITLALL)CALL RNOPAK(2,MSKBIT)
      IF(KASLCL.NE.0)CALL RNOPAK(3,MSKBIT)
      IF(LCLSUP.NE.0)GO TO 81
      IF(LOKSUP.EQ.0)GO TO 85
      IF(LOKSUP.LT.0)GO TO 84
      GO TO 82
   81 IF(LCLSUP.LT.0)GO TO 83
      LCLSUP=LCLSUP-1
   82 CALL RNOPAK(4,MSKBIT)
      GO TO 85
   83 LCLSUP=LCLSUP+1
   84 CALL RNOPAK(5,MSKBIT)
   85 MSKBGN(KPYKAS)=MSKBIT
      IF(ITLNXT.GT.0)ITLNXT=ITLNXT-1
      KASLCL=0
      GO TO 47
C
C     MAINTAIN CASE OF PRINTING CHARACTER
   86 IF(KPYKAS.GE.ISTART)GO TO 88
      IF(LTRNOW.NE.LTRDOT)GO TO 87
      KOMENT=-1
      IQUOTE=0
      IFENCE=0
      ININXT=ITLNXT
      INIALL=ITLALL
      INILIN=ITLLIN
      INISPA=ITLSPA
      INIHIA=LOKSUP
      INIHIB=LCLSUP
      IF(MRKDOT.LE.0)GO TO 88
      IF(JFILL.EQ.6)GO TO 88
      ITLNXT=0
      ITLALL=0
      ITLSPA=0
      LOKSUP=0
      LCLSUP=0
      GO TO 88
   87 IF(IFNOTE.EQ.0)GO TO 88
      IF(MRKEFN.LE.0)GO TO 88
      IF(LTRNOW.NE.LTREFN)GO TO 88
      IF(JFILL.EQ.6)GO TO 88
      MASTER=3
      GO TO 139
   88 KPYKAS=KPYKAS+1
      NOTSEM=KPYKAS
      IF(KOMENT.LE.0)LNGBGN=KPYKAS
      KPYPRT=KPYKAS
      LTRBGN(KPYKAS)=LTRNOW
      MSKBIT=0
      IF(ITLNXT.NE.ITLALL)CALL RNOPAK(2,MSKBIT)
      IF(KASLCL.NE.0)CALL RNOPAK(3,MSKBIT)
      IF(LCLSUP.NE.0)GO TO 89
      IF(LOKSUP.EQ.0)GO TO 93
      IF(LOKSUP.LT.0)GO TO 92
      GO TO 90
   89 IF(LCLSUP.LT.0)GO TO 91
      LCLSUP=LCLSUP-1
   90 CALL RNOPAK(4,MSKBIT)
      GO TO 93
   91 LCLSUP=LCLSUP+1
   92 CALL RNOPAK(5,MSKBIT)
   93 MSKBGN(KPYKAS)=MSKBIT
      IF(ITLNXT.GT.0)ITLNXT=ITLNXT-1
      KASLCL=0
      GO TO 47
C
C     LESS THAN SIGN MAY INDICATE FLAGGED UPPER CASE
   94 KASFLG=1-KASFLG
      GO TO 47
C
C     AMPERSAND INDICATES NEXT CHARACTER TO BE UNDERLINED
   95 ITLNXT=ITLNXT+1
      IF(LMTKAS.GE.MAXBGN)GO TO 100
      GO TO 47
C
C     VERTICAL BAR INDICATES NEXT CHARACTER IS SUPERSCRIPT
   96 LCLSUP=LCLSUP+1
      IF(LMTKAS.GE.MAXBGN)GO TO 100
      GO TO 47
C
C     SLASH INDICATES NEXT CHARACTER IS SUBSCRIPT
   97 LCLSUP=LCLSUP-1
      IF(LMTKAS.GE.MAXBGN)GO TO 100
      GO TO 47
C
C     SPACE, OR CONVERT TAB TO SPACE
   98 IF(MASTER.GT.0)GO TO 100
      IF(KOMENT.NE.0)GO TO 100
      IF(MAGNFY.NE.0)GO TO 100
      IF(JFILL.EQ.0)GO TO 99
      IF(JFILL.NE.3)GO TO 100
   99 KASFLG=0
      KASLCL=0
      IF(JFILL.NE.0)GO TO 88
  100 IF(KPYKAS.GE.ISTART)GO TO 102
      IF(IFNOTE.NE.0)GO TO 101
      IF(KONECT.EQ.0)GO TO 101
C     KONECT=0
      GO TO 102
  101 IF(IFAUTO.EQ.1)IFAUTO=-1
  102 KASFLG=0
      KASLCL=0
      IF(ITLNXT.LE.0)GO TO 103
      IF(KPYBGN.GE.KPYKAS)GO TO 103
      MSKBIT=MSKBGN(KPYKAS)
      CALL RNOUNP(1,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 103
      IF(MASTER.GT.0)GO TO 103
      IF(KOMENT.NE.0)GO TO 103
      IF(MAGNFY.NE.0)GO TO 103
      IF(JFILL.NE.0)GO TO 103
      MSKBIT=MSKBGN(KPYKAS)
      CALL RNOUNP(2,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 104
      IF(LMTKAS.GT.MAXBGN)GO TO 138
      GO TO 47
  103 KPYKAS=KPYKAS+1
      LTRBGN(KPYKAS)=LTRSPA
      IF(ITLNXT.GT.0)GO TO 104
      IF(ITLALL.EQ.IULSPC)GO TO 105
      MSKBIT=0
      CALL RNOPAK(1,MSKBIT)
      MSKBGN(KPYKAS)=MSKBIT
      GO TO 47
  104 ITLNXT=ITLNXT-1
  105 MSKBIT=0
      CALL RNOPAK(1,MSKBIT)
      CALL RNOPAK(2,MSKBIT)
      MSKBGN(KPYKAS)=MSKBIT
      IF(KOMENT.LE.0)LNGBGN=KPYKAS
      KPYPRT=KPYKAS
      GO TO 47
C
C     TREAT NUMBER SIGN LIKE UNDERSCORE AND SPACE
  106 LTRBGN(LMTKAS)=LTRSPA
      GO TO 108
C
C     MAINTAIN CHARACTER FOLLOWING UNDERSCORE
  107 LMTKAS=LMTKAS+1
  108 KASLCL=0
      KPYKAS=KPYKAS+1
      NOTSEM=KPYKAS
      IF(KOMENT.LE.0)LNGBGN=KPYKAS
      KPYPRT=KPYKAS
      MSKBIT=0
      CALL RNOPAK(3,MSKBIT)
      IF(ITLNXT.NE.ITLALL)CALL RNOPAK(2,MSKBIT)
      IF(LCLSUP.NE.0)GO TO 109
      IF(LOKSUP.EQ.0)GO TO 113
      IF(LOKSUP.LT.0)GO TO 112
      GO TO 110
  109 IF(LCLSUP.LT.0)GO TO 111
      LCLSUP=LCLSUP-1
  110 CALL RNOPAK(4,MSKBIT)
      GO TO 113
  111 LCLSUP=LCLSUP+1
  112 CALL RNOPAK(5,MSKBIT)
  113 MSKBGN(KPYKAS)=MSKBIT
      IF(ITLNXT.GT.0)ITLNXT=ITLNXT-1
      IF(LMTKAS.GT.MAXBGN)GO TO 114
      LTRBGN(KPYKAS)=LTRBGN(LMTKAS)
      GO TO 47
  114 LTRBGN(KPYKAS)=LTRSPA
      GO TO 137
C
C     NEXT CHARACTER IS TO BE UPPER CASE
  115 IF(LMTKAS.GE.MAXBGN)GO TO 122
      IF(MRKAMP.LE.0)GO TO 116
      IF(LTRBGN(LMTKAS+1).EQ.LTRAMP)GO TO 119
  116 IF(MRKSUP.LE.0)GO TO 117
      IF(LTRBGN(LMTKAS+1).EQ.LTRSUP)GO TO 120
  117 IF(MRKSUB.LE.0)GO TO 118
      IF(LTRBGN(LMTKAS+1).EQ.LTRSUB)GO TO 121
  118 IF(LTRBGN(LMTKAS+1).NE.LTRCAR)GO TO 122
      LMTKAS=LMTKAS+1
      KASALL=0
      KASLCL=0
      GO TO 47
  119 ITLALL=-1
      LMTKAS=LMTKAS+1
      GO TO 47
  120 LOKSUP=1
      LMTKAS=LMTKAS+1
      GO TO 47
  121 LOKSUP=-1
      LMTKAS=LMTKAS+1
      GO TO 47
  122 KASLCL=1
      GO TO 47
C
C     NEXT CHARACTER IS TO BE LOWER CASE
  123 IF(LMTKAS.GE.MAXBGN)GO TO 129
      IF(MRKAMP.LE.0)GO TO 124
      IF(LTRBGN(LMTKAS+1).EQ.LTRAMP)GO TO 127
  124 IF(MRKSUP.LE.0)GO TO 125
      IF(LTRBGN(LMTKAS+1).EQ.LTRSUP)GO TO 128
  125 IF(MRKSUB.LE.0)GO TO 126
      IF(LTRBGN(LMTKAS+1).EQ.LTRSUB)GO TO 128
  126 IF(LTRBGN(LMTKAS+1).NE.LTRBAC)GO TO 129
      LMTKAS=LMTKAS+1
      KASALL=1
      KASLCL=0
      GO TO 47
  127 ITLALL=0
      LMTKAS=LMTKAS+1
      GO TO 47
  128 LOKSUP=0
      LMTKAS=LMTKAS+1
      GO TO 47
  129 KASLCL=-1
      GO TO 47
C
C     DOT FOLLOWING DOT COMMAND
  130 LMTKAS=LMTKAS-1
      GO TO 139
C
C     SEMICOLON FOLLOWING DOT COMMAND
  131 KPYKAS=KPYKAS+1
      KPYPRT=KPYKAS
      LTRBGN(KPYKAS)=LTRNOW
      MSKBIT=0
      IF(ITLNXT.NE.ITLALL)CALL RNOPAK(2,MSKBIT)
      IF(LCLSUP.NE.0)GO TO 132
      IF(LOKSUP.EQ.0)GO TO 136
      IF(LOKSUP.LT.0)GO TO 135
      GO TO 133
  132 IF(LCLSUP.LT.0)GO TO 134
      LCLSUP=LCLSUP-1
  133 CALL RNOPAK(4,MSKBIT)
      GO TO 136
  134 LCLSUP=LCLSUP+1
  135 CALL RNOPAK(5,MSKBIT)
  136 MSKBGN(KPYKAS)=MSKBIT
      IF(ITLNXT.GT.0)ITLNXT=ITLNXT-1
      IF(LMTKAS.EQ.MAXBGN)JSKIP=1
      GO TO 139
C
C     ALL CHARACTERS ON LINE HAVE BEEN CONVERTED
  137 IF(ITLNXT.GT.0)GO TO 100
  138 KASFLG=0
  139 KASLCL=0
      GO TO 141
C
C     ***************************************************
C     *                                                 *
C     *  2ND PASS, WRAP AND JUSTIFY LTRBGN INTO LTRMID  *
C     *                                                 *
C     ***************************************************
C
C     CONTINUE WITH TEXT AFTER SEMICOLON AFTER COMMAND
  140 JSKIP=0
      KOMENT=0
      ISTART=KPYKAS+1
C
C     BRANCH IF COMMAND OR IF IN NOFILL MODE
  141 IF(ITLLIN.EQ.0)GO TO 142
      ITLLIN=0
      ITLALL=0
  142 IF(MASTER.GT.0)GO TO 427
      IF(KOMENT.NE.0)GO TO 425
      IF(IFNOTE.NE.0)GO TO 146
      IF(KNDTRN.EQ.0)GO TO 144
      IF(LINFIG.GT.0)GO TO 143
      IF(ISKIP.LE.0)GO TO 146
  143 IF(LSTTRN.NE.0)GO TO 220
      IF(MAGNFY.NE.0)GO TO 220
      IF(JFILL.NE.0)GO TO 220
  144 IF(ISKIP.LE.0)GO TO 146
  145 IF(IFPAGE.LE.0)GO TO 422
      IF((LOCPAG+ISKIP).LT.LNGPAG)GO TO 422
      IF(NEWPAG.EQ.0)NEWPAG=1
      ISKIP=-1
  146 IF(NXTHDR.NE.0)GO TO 392
      IF(MAGNFY.NE.0)GO TO 213
      IF(JFILL.NE.0)GO TO 191
      IF(KPYBGN.LT.LNGBGN)GO TO 148
      IF(IFNOTE.NE.0)GO TO 147
      IF(KONECT.EQ.0)GO TO 147
      KONECT=0
      GO TO 150
  147 IF(IFAUTO.EQ.1)IFAUTO=-1
      GO TO 150
  148 IF(IFAUTO.EQ.0)GO TO 150
      IF(IFAUTO.GT.0)GO TO 149
      MASTER=4
      GO TO 430
  149 IFAUTO=1
C
C     INSERT NEXT WORD INTO LTRMID ARRAY
  150 KPYBGN=KPYBGN+1
      IF(KPYBGN.GT.LNGBGN)GO TO 184
      MSKBIT=MSKBGN(KPYBGN)
      CALL RNOUNP(1,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 151
      MSKBIT=MSKBGN(KPYBGN)
      CALL RNOUNP(2,MSKBIT)
      IF(MSKBIT.NE.0)ITLSPA=1
      GO TO 150
  151 KPYBGN=KPYBGN-1
      MAXWRD=KPYBGN
      LENGTH=0
      LCLNDX=0
  152 MAXWRD=MAXWRD+1
      IF(MAXWRD.GT.LNGBGN)GO TO 154
      MSKBIT=MSKBGN(MAXWRD)
      CALL RNOUNP(1,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 154
      IF(MRKNDX.LE.0)GO TO 153
      IF(LTRBGN(MAXWRD).NE.LTRNDX)GO TO 153
      MSKBIT=MSKBGN(MAXWRD)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 153
      LCLNDX=LCLNDX+1
      GO TO 152
  153 LENGTH=LENGTH+1
      GO TO 152
  154 IF(LENGTH.GT.0)GO TO 155
      KPYBGN=KPYBGN+LCLNDX
      GO TO 9
  155 IF(LNGMID.LE.0)GO TO 166
      IF(IFNOTE.NE.0)GO TO 156
      IF(KONECT.GT.0)GO TO 160
  156 NEEDED=1
      IF(IPEROD.EQ.0)GO TO 158
      MSKBIT=MSKMID(LNGMID)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 158
      LTRNOW=LTRMID(LNGMID)
      DO 157 I=1,4
      IF(LTRNOW.NE.LTRTWO(I))GO TO 157
      NEEDED=2
      GO TO 158
  157 CONTINUE
  158 IF((LNGMID+NEEDED+LENGTH).GT.MRGRIT)GO TO 185
      DO 159 I=1,NEEDED
      LNGMID=LNGMID+1
      LTRMID(LNGMID)=LTRSPA
      MSKBIT=0
      CALL RNOPAK(1,MSKBIT)
      IF(ITLSPA.GT.0)CALL RNOPAK(2,MSKBIT)
      MSKMID(LNGMID)=MSKBIT
  159 CONTINUE
      ITLSPA=0
      KNTSPC=KNTSPC+1
      GO TO 169
  160 IF(KNTSPC.LE.0)GO TO 165
      IF((LNGMID+LENGTH).LE.MRGRIT)GO TO 165
      LNGFTN=0
  161 IF(LNGMID.LE.0)GO TO 164
      MSKBIT=MSKMID(LNGMID)
      CALL RNOUNP(1,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 162
      LNGFTN=LNGFTN+1
      LTRFTN(LNGFTN)=LTRMID(LNGMID)
      MSKFTN(LNGFTN)=MSKMID(LNGMID)
      LNGMID=LNGMID-1
      GO TO 161
  162 LNGMID=LNGMID-1
      IF(LNGMID.LE.0)GO TO 163
      MSKBIT=MSKMID(LNGMID)
      CALL RNOUNP(1,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 162
  163 KONECT=-1
      KNTSPC=KNTSPC-1
      GO TO 185
  164 LNGMID=LNGFTN
  165 KONECT=0
      ITLSPA=0
      GO TO 169
  166 IF(LENGTH.GT.LMTMID)LENGTH=LMTMID
      KNTSPC=0
      IF(IFNOTE.LT.0)GO TO 369
      IF(IFLIST.LE.0)GO TO 167
      IF(LSTELM.GT.0)GO TO 369
  167 NEEDED=MRGLFT+INDENT
      INDENT=0
      IF(NEEDED.GT.(LMTMID-LENGTH))NEEDED=LMTMID-LENGTH
      IF(NEEDED.LE.0)GO TO 169
      DO 168 I=1,NEEDED
      LNGMID=LNGMID+1
      MSKMID(LNGMID)=0
      LTRMID(LNGMID)=LTRSPA
  168 CONTINUE
  169 IF(NOWBAR.NE.0)IFABAR=NOWBAR
      LCLNDX=0
      DO 172 I=1,LENGTH
  170 KPYBGN=KPYBGN+1
      IF(MRKNDX.LE.0)GO TO 171
      IF(LTRBGN(KPYBGN).NE.LTRNDX)GO TO 171
      MSKBIT=MSKBGN(KPYBGN)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 171
      LCLNDX=LCLNDX+1
      GO TO 170
  171 LNGMID=LNGMID+1
      LTRMID(LNGMID)=LTRBGN(KPYBGN)
      MSKMID(LNGMID)=MSKBGN(KPYBGN)
  172 CONTINUE
      KSKIP=1
      ININDX=JSKIP
  173 IF(LCLNDX.EQ.0)GO TO 182
      IVALUE=KPYBGN-LENGTH-LCLNDX+1
      IMINUS=0
  174 IF(LTRBGN(IVALUE).NE.LTRNDX)GO TO 175
      MSKBIT=MSKBGN(IVALUE)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 175
      LCLNDX=LCLNDX-1
      GO TO 176
  175 IVALUE=IVALUE+1
      LENGTH=LENGTH-1
      GO TO 174
  176 IVALUE=IVALUE+1
      KVALUE=IVALUE
      IF(LENGTH.LE.0)GO TO 182
  177 MSKBIT=MSKBGN(KVALUE)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 179
      MSKBIT=MSKBGN(KVALUE)
      CALL RNOUNP(1,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 178
      IF(LTRBGN(KVALUE).NE.LTRNDX)GO TO 179
      LCLNDX=LCLNDX-1
  178 IF(IMINUS.EQ.0)GO TO 173
      GO TO 181
  179 IMINUS=IMINUS+1
      LENGTH=LENGTH-1
  180 KVALUE=KVALUE+1
      IF(LENGTH.GT.0)GO TO 177
  181 NVALUE(1)=IVALUE
      NMINUS(1)=IMINUS
      MASTER=5
      JSKIP=8
      GO TO 430
  182 JSKIP=ININDX
      IF(KPYBGN.LT.LNGBGN)GO TO 183
      IF(ITLALL.EQ.IULSPC)ITLSPA=1
  183 GO TO 9
  184 IF(ITLALL.EQ.IULSPC)ITLSPA=1
      GO TO 9
C
C     JUSTIFY TEXT WHEN LINE OVERFLOWS
  185 IREVRS=-IREVRS
      IF(LNGMID.GE.MRGRIT)GO TO 429
      IF(KNTSPC.LE.0)GO TO 429
      IF(JSTIFY.EQ.0)GO TO 429
      IGROUP=(MRGRIT-LNGMID)/KNTSPC
      JGROUP=MRGRIT-LNGMID-(KNTSPC*IGROUP)
      IF(IREVRS.GT.0)JGROUP=JGROUP-KNTSPC-1
      J=MRGRIT
  186 MSKBIT=MSKMID(LNGMID)
      CALL RNOUNP(1,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 189
      JGROUP=JGROUP+IREVRS
      NEEDED=IGROUP
      IF(JGROUP.GE.0)NEEDED=IGROUP+1
      IF(NEEDED.LE.0)GO TO 188
      DO 187 I=1,NEEDED
      LTRMID(J)=LTRSPA
      MSKMID(J)=MSKMID(LNGMID)
      J=J-1
  187 CONTINUE
      IF(J.LE.LNGMID)GO TO 190
  188 LTRMID(J)=LTRMID(LNGMID)
      MSKMID(J)=MSKMID(LNGMID)
      J=J-1
      LNGMID=LNGMID-1
      MSKBIT=MSKMID(LNGMID)
      CALL RNOUNP(1,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 188
  189 LTRMID(J)=LTRMID(LNGMID)
      MSKMID(J)=MSKMID(LNGMID)
      J=J-1
      LNGMID=LNGMID-1
      GO TO 186
  190 LNGMID=MRGRIT
      GO TO 429
C
C     DIRECT COPY OF CHARACTERS IN NOFILL MODE
  191 JSKIP=0
      IF(IFAUTO.NE.0)IFAUTO=1
      IF(KONECT.NE.0)GO TO 201
      IF(LNGMID.GT.0)GO TO 428
      IF(NOWBAR.NE.0)IFABAR=NOWBAR
      IF(LNGBGN.LT.ISTART)GO TO 209
      KPYMID=0
      IF(IFNOTE.LT.0)GO TO 368
      IF(IFLIST.LE.0)GO TO 192
      IF(LSTELM.GT.0)GO TO 368
  192 NEEDED=MRGLFT
      IF(JFILL.EQ.0)GO TO 199
      GO TO(193,194,195,196,197,195),JFILL
C     CENTER COMMAND
  193 IF(KCENTR.LE.0)NEEDED=((MRGFAR+ICENTR-LNGBGN+ISTART-1)/2)
      IF(KCENTR.GT.0)NEEDED=((ICENTR-LNGBGN+ISTART-1)/2)
      GO TO 198
C     RIGHT COMMAND
  194 NEEDED=MRGRIT-LNGBGN+ISTART-1-ICENTR
      GO TO 198
C     FLUSH LEFT COMMAND
  195 IF(KCENTR.LE.0)NEEDED=MRGLFT+ICENTR
      IF(KCENTR.GT.0)NEEDED=ICENTR
      GO TO 198
C     MIDDLE COMMAND
  196 IF(KCENTR.LE.0)NEEDED=MRGLFT+
     1((MRGRIT-MRGLFT-LNGBGN+ISTART-1)/2)+ICENTR
      IF(KCENTR.GT.0)NEEDED=ICENTR
     1-((LNGBGN-ISTART+1)/2)
      GO TO 198
C     FLUSH RIGHT COMMAND
  197 IF(KCENTR.LE.0)NEEDED=MRGRIT-LNGBGN+ISTART-1+ICENTR
      IF(KCENTR.GT.0)NEEDED=ICENTR-LNGBGN+ISTART-1
  198 CONTINUE
  199 NEEDED=NEEDED+INDENT
      INDENT=0
      IF(NEEDED.LE.0)GO TO 202
      DO 200 I=1,NEEDED
      IF(KPYMID.GE.LMTMID)GO TO 202
      KPYMID=KPYMID+1
      MSKMID(KPYMID)=0
      LTRMID(KPYMID)=LTRSPA
  200 CONTINUE
      GO TO 202
  201 KONECT=0
      IF(LNGBGN.LT.ISTART)GO TO 209
      KPYMID=LNGMID
  202 LCLNDX=0
      LENGTH=LNGBGN-KPYBGN
  203 IF(KPYBGN.GE.LNGBGN)GO TO 209
      IF(KPYMID.GE.LMTMID)GO TO 209
      KPYBGN=KPYBGN+1
      MSKBIT=MSKBGN(KPYBGN)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 204
      IF(LTRBGN(KPYBGN).EQ.LTRSPA)GO TO 204
      IF(LTRBGN(KPYBGN).EQ.LTRTAB)GO TO 206
      IF(MRKNDX.LE.0)GO TO 204
      IF(JFILL.EQ.6)GO TO 204
      IF(LTRBGN(KPYBGN).NE.LTRNDX)GO TO 204
      LCLNDX=LCLNDX+1
      GO TO 203
  204 KPYMID=KPYMID+1
      LTRMID(KPYMID)=LTRBGN(KPYBGN)
      MSKMID(KPYMID)=MSKBGN(KPYBGN)
      MSKBIT=MSKBGN(KPYBGN)
      CALL RNOUNP(1,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 205
      MSKBIT=MSKBGN(KPYBGN)
      CALL RNOUNP(2,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 203
  205 LNGMID=KPYMID
      GO TO 203
  206 KPYMID=KPYMID+1
      J=KPYMID
      DO 207 I=1,MAXTAB
      IF(LOCTAB(I).LT.J)GO TO 207
      J=LOCTAB(I)-J
      GO TO 208
  207 CONTINUE
      J=0
  208 LTRMID(KPYMID)=LTRSPA
      MSKBIT=0
      CALL RNOPAK(1,MSKBIT)
      MSKMID(KPYMID)=MSKBIT
      J=J-1
      IF(J.LT.0)GO TO 202
      IF(KPYMID.GE.LMTMID)GO TO 209
      KPYMID=KPYMID+1
      GO TO 208
  209 IF(JFILL.EQ.0)GO TO 210
      JCENTR=JCENTR-1
      IF(JCENTR.LT.0)GO TO 210
      IF(JCENTR.GT.0)GO TO 210
      JFILL=IFFILL
      ICENTR=KLMFIL
      KCENTR=KLMMNS
      IF(JFILL.NE.0)GO TO 210
      IF(KNDTRN.NE.0)GO TO 219
  210 IF(LNGMID.LE.0)GO TO 212
      IF(LCLNDX.NE.0)GO TO 211
      IF(KNDTRN.NE.0)GO TO 222
      IF(JFILL.EQ.6)GO TO 430
      IF(JFILL.EQ.0)GO TO 430
      GO TO 9
  211 IF(JFILL.NE.0)GO TO 173
      JSKIP=8
      GO TO 430
  212 IF(KNDTRN.NE.0)GO TO 222
      GO TO 423
C
C     PREPARE TO CONSTRUCT MAGNIFIED LETTERS
  213 MASTER=12
      GO TO 430
C
C     RETURN AFTER HAVING CONSTRUCTED MAGNIFIED LETTERS
  214 MASTER=0
      IF(NOWBAR.NE.0)IFABAR=NOWBAR
      IF(MAGNFY.NE.0)GO TO 216
      ISPACE=MAGSAV
      IF(JFILL.EQ.0)GO TO 215
      JCENTR=JCENTR-1
      IF(JCENTR.LT.0)GO TO 216
      IF(JCENTR.GT.0)GO TO 216
      JFILL=IFFILL
      ICENTR=KLMFIL
      KCENTR=KLMMNS
      IF(JFILL.NE.0)GO TO 216
  215 IF(KNDTRN.NE.0)GO TO 219
  216 IF(KNDTRN.NE.0)GO TO 222
      GO TO 430
C
C     CONSTRUCT REST OF BACKGROUND OR EDGE BEFORE END COVER
  217 LNGMID=0
      IF(NSKIP.EQ.0)GO TO 219
      NSKIP=NSKIP-1
      ISKIP=NSKIP
      IF(NSKIP.GT.0)GO TO 221
      MASTER=0
      NSKIP=0
      GO TO 223
  218 KNDTRN=0
      LSTTRN=0
      ISKIP=NXTSKP
      IF(KOMAND.GE.0)GO TO 142
      MASTER=11
      GO TO 430
  219 GO TO(335,335,335,224,224,224,258,258,258),KNDTRN
  220 GO TO(337,338,145,226,227,145,260,261,145),KNDTRN
  221 GO TO(339,339,339,228,228,228,262,262,262),KNDTRN
  222 GO TO(340,340,340,229,229,229,263,263,263),KNDTRN
  223 GO TO(346,142,218,233,142,218,267,142,218),KNDTRN
C
C     *********************************************
C     *                                           *
C     *  CONSTRUCT LEFT OR RIGHT EDGES OF OBJECT  *
C     *                                           *
C     *********************************************
C
C     CONSTRUCT REST OF EDGE IF CHANGING FILL CONDITIONS
  224 IF(KNDTRN.NE.5)GO TO 225
      NSKIP=LNGTRN
      IF(NSKIP.LT.0)NSKIP=-NSKIP
      I=ISKIP
      IF(MASTER.NE.11)I=ISPACE
      NXTSKP=0
      IF(I.GT.NSKIP)NXTSKP=I-NSKIP
      IF(MASTER.NE.11)NSKIP=NSKIP+1
      NSKIP=NSKIP+LINFIG
      LINFIG=0
      ISKIP=0
      MASTER=-1
      KNDTRN=6
      IF(NSKIP.GT.0)GO TO 236
      ISKIP=NXTSKP
  225 MASTER=11
      KNDTRN=0
      GO TO 430
C
C     SKIP LINES ABOVE CONSTRUCTED EDGE
  226 IF(ISKIP.GT.0)GO TO 422
      ISKIP=0
      IF(LINFIG.LE.0)GO TO 146
      LNGMID=0
      GO TO 229
C
C     SKIP LINES WHILE MAKING EDGE
  227 LNGMID=0
      NSKIP=ISKIP
      ISKIP=0
      IF(LINFIG.GT.0)NSKIP=NSKIP+LINFIG
      LINFIG=0
      MASTER=-1
      GO TO 236
C
C     NSKIP IS ALREADY GREATER THAN ZERO
  228 LNGMID=0
      MASTER=-1
      GO TO 236
C
C     PREPARE FOR TOP OF CONSTRUCTION
  229 IF(KNDTRN.NE.4)GO TO 236
      IF(LINFIG.LT.0)LINFIG=-LINFIG
      IF(ISKIP.LE.0)GO TO 230
      LINFIG=-LINFIG
      GO TO 422
  230 ISKIP=0
      LSTTRN=-1
      IF(LINFIG.LE.0)GO TO 235
      NSKIP=LINFIG-1
      LINFIG=0
      IF(NSKIP.LE.0)GO TO 235
      MASTER=-1
      IF(LNGMID.LE.0)GO TO 232
      LSTTRN=LNGMID
      LNGMID=0
      DO 231 I=1,LSTTRN
      LTRFTN(I)=LTRMID(I)
      MSKFTN(I)=MSKMID(I)
  231 CONTINUE
  232 GO TO 422
C
C     NSKIP INITIAL LINES COMPLETED
  233 NSKIP=0
      LNGMID=0
      IF(LSTTRN.LE.0)GO TO 235
      LNGMID=LSTTRN
      DO 234 I=1,LNGMID
      LTRMID(I)=LTRFTN(I)
      MSKMID(I)=MSKFTN(I)
  234 CONTINUE
  235 KNDTRN=5
      LSTTRN=-1
      MASTER=0
C
C     FILL IN GAPS IN LEFT EDGE OF DIAGONAL LINE
  236 IF(LNGTRN.GT.0)GO TO 242
      I=2
  237 I=I+1
      IF((I-2).GT.LSTTRN)GO TO 240
      IF(I.GT.LNGMID)GO TO 240
      MSKBIT=MSKMID(I)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 238
      IF(LTRMID(I).EQ.LTRSPA)GO TO 237
  238 IF((I-1).GT.LSTTRN)GO TO 239
      IF(MSKFTN(I-1).EQ.(-LNGTRN))GO TO 237
  239 IF(MSKFTN(I-2).NE.(-LNGTRN))GO TO 237
      MSKFTN(I-1)=-1
      LTRFTN(I-1)=LTRFTN(I-2)
      IF((I-1).GT.LSTTRN)LSTTRN=I-1
      GO TO 237
  240 CONTINUE
      I=0
  241 I=I+1
      IF(I.GT.LSTTRN)GO TO 247
      IF(MSKFTN(I).LT.0)MSKFTN(I)=-LNGTRN
      GO TO 241
C
C     FILL IN GAPS IN RIGHT EDGE OF DIAGONAL LINE
  242 I=LSTTRN-1
      IF(I.GT.LNGMID)I=LNGMID+1
  243 I=I-1
      IF(I.LE.0)GO TO 245
      MSKBIT=MSKMID(I)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 244
      IF(LTRMID(I).EQ.LTRSPA)GO TO 243
  244 IF(MSKFTN(I+1).EQ.LNGTRN)GO TO 243
      IF(MSKFTN(I+2).NE.LNGTRN)GO TO 243
      MSKFTN(I+1)=-1
      LTRFTN(I+1)=LTRFTN(I+2)
      GO TO 243
  245 CONTINUE
      I=0
  246 I=I+1
      IF(I.GT.LSTTRN)GO TO 247
      IF(MSKFTN(I).LT.0)MSKFTN(I)=LNGTRN
      GO TO 246
  247 CONTINUE
C
C     NEW PRINTING CHARACTERS CANCEL EDGE OF HIGHER LINE
      I=0
      J=0
  248 I=I+1
      J=J+1
      IF(J.GT.LNGMID)GO TO 251
      IF(I.LE.LSTTRN)GO TO 249
      LSTTRN=I
      MSKFTN(LSTTRN)=0
  249 MSKBIT=MSKMID(J)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 250
      IF(LTRMID(J).EQ.LTRSPA)GO TO 248
  250 LTRFTN(I)=LTRMID(J)
      MSKFTN(I)=-1
      GO TO 248
  251 CONTINUE
C
C     COPY REMAINING SHADOW FROM HIGHER LINE
  252 I=0
      J=0
      LNGMID=0
  253 I=I+1
      J=J+1
      IF(J.GT.LMTMID)GO TO 254
      IF(I.GT.LSTTRN)GO TO 254
      LTRMID(J)=LTRSPA
      MSKMID(J)=0
      IF(MSKFTN(I).LE.0)GO TO 253
      MSKFTN(I)=MSKFTN(I)-1
      LTRMID(J)=LTRFTN(I)
      LNGMID=J
      GO TO 253
C
C     STORE SHADOW CAST BY CURRENT LINE TOWARD LOWER LEFT
  254 CONTINUE
      IF(LNGTRN.GT.0)GO TO 256
      I=1
      J=LSTTRN
      LSTTRN=0
  255 I=I+1
      IF(I.GT.J)GO TO 328
      IF(MSKFTN(I).EQ.0)GO TO 255
      IF(MSKFTN(I).LT.0)MSKFTN(I)=-LNGTRN
      LSTTRN=I-1
      MSKFTN(I-1)=MSKFTN(I)
      LTRFTN(I-1)=LTRFTN(I)
      MSKFTN(I)=0
      LTRFTN(I)=LTRSPA
      GO TO 255
C
C     STORE SHADOW CAST BY CURRENT LINE TOWARD LOWER RIGHT
  256 I=LSTTRN+1
      IF(I.GT.LMTMID)I=LMTMID
      LSTTRN=0
  257 I=I-1
      IF(I.LE.0)GO TO 328
      IF(MSKFTN(I).EQ.0)GO TO 257
      IF(MSKFTN(I).LT.0)MSKFTN(I)=LNGTRN
      IF(LSTTRN.EQ.0)LSTTRN=I+1
      MSKFTN(I+1)=MSKFTN(I)
      LTRFTN(I+1)=LTRFTN(I)
      MSKFTN(I)=0
      LTRFTN(I)=LTRSPA
      GO TO 257
C
C     ************************************
C     *                                  *
C     *  CONSTRUCT BORDER AROUND OBJECT  *
C     *                                  *
C     ************************************
C
C     CONSTRUCT REST OF BORDER IF CHANGING FILL CONDITIONS
  258 IF(KNDTRN.NE.8)GO TO 259
      NSKIP=IBORDR
      I=ISKIP
      IF(MASTER.NE.11)I=ISPACE
      NXTSKP=0
      IF(I.GT.NSKIP)NXTSKP=I-NSKIP
      NSKIP=NSKIP+NSKIP
      IF(MASTER.NE.11)NSKIP=NSKIP+1
      NSKIP=NSKIP+LINFIG
      LINFIG=0
      ISKIP=0
      MASTER=-1
      KNDTRN=9
      IF(NSKIP.GT.0)GO TO 270
      ISKIP=NXTSKP
  259 MASTER=11
      KNDTRN=0
      GO TO 430
C
C     SKIP LINES ABOVE CONSTRUCTED BORDER
  260 IF(ISKIP.GT.IBORDR)GO TO 422
      ISKIP=0
      IF(LINFIG.LE.0)GO TO 146
      LNGMID=0
      GO TO 263
C
C     SKIP LINES WHILE DOING BORDER
  261 LNGMID=0
      NSKIP=ISKIP
      IF(LINFIG.GT.0)NSKIP=NSKIP+LINFIG
      LINFIG=0
      ISKIP=0
      MASTER=-1
      GO TO 270
C
C     NSKIP IS ALREADY GREATER THAN ZERO
  262 LNGMID=0
      MASTER=-1
      GO TO 270
C
C     TOP OF BORDER
  263 IF(KNDTRN.NE.7)GO TO 270
      IF(LINFIG.LT.0)LINFIG=-LINFIG
      IF(ISKIP.LE.0)GO TO 264
      LINFIG=-LINFIG
      GO TO 422
  264 ISKIP=0
      LSTTRN=-1
      IF(LINFIG.LE.0)GO TO 269
      NSKIP=LINFIG-1
      LINFIG=0
      IF(NSKIP.LE.0)GO TO 269
      MASTER=-1
      IF(LNGMID.LE.0)GO TO 266
      LSTTRN=LNGMID
      LNGMID=0
      DO 265 I=1,LSTTRN
      LTRFTN(I)=LTRMID(I)
      MSKFTN(I)=MSKMID(I)
  265 CONTINUE
  266 GO TO 422
C
C     NSKIP INITIAL LINES COMPLETED
  267 NSKIP=0
      LNGMID=0
      IF(LSTTRN.LE.0)GO TO 269
      LNGMID=LSTTRN
      DO 268 I=1,LNGMID
      LTRMID(I)=LTRFTN(I)
      MSKMID(I)=MSKFTN(I)
  268 CONTINUE
  269 KNDTRN=8
      LSTTRN=-1
      MASTER=0
C
C     TEMPORARILY STORE CURRENT LINE FOR BORDER CONSTRUCTION
  270 LNGWRK=0
      IF(LNGMID.GT.LMTWRK)LNGMID=LMTWRK
      IF(LNGMID.LE.0)GO TO 275
      DO 274 KOLUMN=1,LNGMID
      IF(LTRMID(KOLUMN).NE.LTRSPA)GO TO 271
      IF(MSKMID(KOLUMN).EQ.0)GO TO 273
      MSKBIT=MSKMID(KOLUMN)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 273
  271 LNGWRK=KOLUMN
      MSKWRK(KOLUMN)=IBORDR+IBORDR
      LTRWRK(KOLUMN)=LTRMID(KOLUMN)
      IF(KOLUMN.GT.LSTTRN)GO TO 274
      IF(MSKFTN(KOLUMN).LE.-3)GO TO 274
      IF(MSKFTN(KOLUMN).LT.0)GO TO 272
      IF(MSKFTN(KOLUMN).LE.(IBORDR+1))GO TO 274
      MSKWRK(KOLUMN)=IBORDR+1-MSKFTN(KOLUMN)
      GO TO 274
  272 MSKWRK(KOLUMN)=MSKFTN(KOLUMN)
      GO TO 274
  273 MSKWRK(KOLUMN)=0
  274 CONTINUE
      LNGMID=0
  275 CONTINUE
C
C     CONSTRUCT THE NEW BORDER LINE
      LIMIT=LNGWRK+LNGTRN
      IF(LIMIT.LT.(LSTTRN+LNGTRN))LIMIT=LSTTRN+LNGTRN
      IF(LIMIT.GT.LMTMID)LIMIT=LMTMID
      IF(LIMIT.LE.0)GO TO 303
      DO 302 KOLUMN=1,LIMIT
      IF(KOLUMN.GT.LSTTRN)GO TO 277
      IF(MSKFTN(KOLUMN).LE.-3)GO TO 276
      IF(MSKFTN(KOLUMN).LT.0)GO TO 288
  276 IF(MSKFTN(KOLUMN).EQ.(1+IBORDR))GO TO 288
  277 CONTINUE
C
C     CHECK IF POINT IS ON EDGE OF OBJECT
      N=1+LNGTRN
      L=1+LNGTRN
      IF(JBORDR.GE.2)GO TO 279
      IF(IBORDR.GT.1)GO TO 278
      IF(LNGTRN.LE.1)GO TO 279
  278 L=L-1
  279 INNER=KOLUMN
      K=0
      KBORDR=0
      DO 286 M=1,N
  280 INNER=KOLUMN+K
      IF(INNER.LE.0)GO TO 285
      IF(INNER.GT.LSTTRN)GO TO 283
      IF(MSKFTN(INNER).LE.-3)GO TO 283
      IF(MSKFTN(INNER).EQ.0)GO TO 283
      I=0
      IF(MSKFTN(INNER).LT.0)GO TO 281
      I=MSKFTN(INNER)-IBORDR-1
      IF(I.LT.0)I=-I
      IF(JBORDR.GE.2)GO TO 281
      IF(I.NE.IBORDR)GO TO 281
      IF(M.GT.L)GO TO 283
  281 IF(KBORDR.EQ.0)GO TO 282
      IF(KBORDR.LE.(I+M))GO TO 283
  282 KBORDR=I+M
      LTRNOW=LTRFTN(INNER)
  283 IF(M.GT.L)GO TO 285
      IF(KBORDR.EQ.0)GO TO 284
      IF(M.GE.(KBORDR-IBORDR))GO TO 285
  284 CONTINUE
      IF(INNER.GT.LNGWRK)GO TO 285
      IF(MSKWRK(INNER).EQ.0)GO TO 285
      LTRNOW=LTRWRK(INNER)
      KBORDR=IBORDR+M
  285 K=-K
      IF(K.LT.0)GO TO 280
      K=K+1
  286 CONTINUE
      IF(KBORDR.NE.0)GO TO 289
C
C     INDICATE THAT POINT IS NOT NOW IN EDGE OF OBJECT
  287 IF(KOLUMN.GT.LSTTRN)GO TO 288
      IF(MSKFTN(KOLUMN).EQ.-3)MSKFTN(KOLUMN)=-4
  288 LTRMID(KOLUMN)=LTRSPA
      MSKMID(KOLUMN)=0
      GO TO 302
C
C     CHECK TO SEE IF ARE WITHIN AN INVERTED CUP
  289 MSKMID(KOLUMN)=0
      LTRMID(KOLUMN)=LTRNOW
      LTRFTN(KOLUMN)=LTRNOW
      IF(LNGMID.LE.0)GO TO 297
      IF(JBORDR.EQ.0)GO TO 297
      IF(JBORDR.EQ.2)GO TO 297
      IF((LNGMID+1).GE.KOLUMN)GO TO 297
      INDEX=LNGMID
  290 LNGMID=LNGMID+1
      IF(LNGMID.GE.KOLUMN)GO TO 291
      IF(LNGMID.GT.LSTTRN)GO TO 297
      IF(MSKFTN(LNGMID).LE.-3)GO TO 290
      GO TO 297
C
C     FILL IN WIDTH OF INVERTED CUP
  291 J=INDEX
  292 J=J+1
      IF(J.GE.KOLUMN)GO TO 293
      MSKFTN(J)=-3
      LTRMID(J)=LTRFTN(J)
      GO TO 292
C
C     SQUEEZE OUT SHADOW OF TOP OF INVERTED CUP
  293 J=(INDEX+KOLUMN)/2
  294 J=J+1
      IF(J.GE.KOLUMN)GO TO 295
      LTRFTN(J)=LTRFTN(J+1)
      GO TO 294
  295 J=(INDEX+KOLUMN)/2
  296 IF(J.LE.INDEX)GO TO 297
      LTRFTN(J)=LTRFTN(J-1)
      J=J-1
      GO TO 296
  297 LNGMID=KOLUMN
C
C     EXTEND THE OLD OBJECT ACROSS TO CURRENT COLUMN
  298 IF(LNGMID.LE.LSTTRN)GO TO 299
      LSTTRN=LSTTRN+1
      MSKFTN(LSTTRN)=0
      GO TO 298
C
C     FILL IN THE COLUMN IF IT WAS NOT IN OBJECT
  299 IF(MSKFTN(LNGMID).EQ.0)GO TO 300
      IF(MSKFTN(LNGMID).LE.-3)GO TO 300
      GO TO 302
  300 MSKFTN(LNGMID)=-3
  301 LTRFTN(LNGMID)=LTRMID(LNGMID)
  302 CONTINUE
  303 CONTINUE
C
C     DECREMENT THE LINE COUNTS IN STORAGE
      LIMIT=LSTTRN
      LSTTRN=0
      IF(LIMIT.LE.0)GO TO 307
      DO 306 KOLUMN=1,LIMIT
      IF(MSKFTN(KOLUMN).LE.-3)GO TO 305
      IF(MSKFTN(KOLUMN).EQ.0)GO TO 306
      IF(MSKFTN(KOLUMN).GT.0)GO TO 304
      MSKFTN(KOLUMN)=MSKFTN(KOLUMN)+1
      IF(MSKFTN(KOLUMN).EQ.0)MSKFTN(KOLUMN)=1+IBORDR
      LSTTRN=KOLUMN
      GO TO 306
  304 MSKFTN(KOLUMN)=MSKFTN(KOLUMN)-1
      IF(MSKFTN(KOLUMN).EQ.0)MSKFTN(KOLUMN)=-3
      IF(MSKFTN(KOLUMN).GT.0)LSTTRN=KOLUMN
  305 IF(KNDTRN.NE.9)LSTTRN=KOLUMN
  306 CONTINUE
C
C     TRANSFER THE CURRENT ORIGINAL LINE INTO STORAGE
  307 LIMIT=LNGWRK
      IF(LIMIT.GT.LMTMID)LIMIT=LMTMID
      IF(LIMIT.LE.0)GO TO 311
      DO 310 KOLUMN=1,LIMIT
      IF(MSKWRK(KOLUMN).EQ.0)GO TO 310
  308 IF(LSTTRN.GE.KOLUMN)GO TO 309
      LSTTRN=LSTTRN+1
      MSKFTN(LSTTRN)=0
      GO TO 308
  309 IF(MSKFTN(KOLUMN).GE.0)MSKFTN(KOLUMN)=MSKWRK(KOLUMN)
      IF(MSKFTN(KOLUMN).LE.-3)MSKFTN(KOLUMN)=MSKWRK(KOLUMN)
      LTRFTN(KOLUMN)=LTRWRK(KOLUMN)
  310 CONTINUE
  311 LNGWRK=0
C
C     REMOVE AIR SPACE ENTRIES IF OPEN FROM SIDE
      IF(LSTTRN.LE.0)GO TO 327
      DO 312 KOLUMN=1,LSTTRN
      IF(MSKFTN(KOLUMN).EQ.-4)MSKFTN(KOLUMN)=0
  312 CONTINUE
      KOLUMN=1
      GO TO 318
  313 IF(MSKFTN(KOLUMN).EQ.0)GO TO 314
      GO TO 326
  314 INDEX=KOLUMN
      LIMIT=0
  315 INDEX=INDEX+1
      LIMIT=LIMIT+1
      IF(INDEX.GT.LSTTRN)GO TO 318
      IF(MSKFTN(INDEX).EQ.0)GO TO 315
      IF(MSKFTN(INDEX).LE.-3)GO TO 315
      INDEX=KOLUMN
  316 INDEX=INDEX-1
      LIMIT=LIMIT+1
      IF(INDEX.LT.1)GO TO 318
      IF(MSKFTN(INDEX).EQ.0)GO TO 316
      IF(MSKFTN(INDEX).LE.-3)GO TO 316
  317 IF(LIMIT.LT.(LNGTRN+LNGTRN+2))GO TO 326
  318 INDEX=KOLUMN
      GO TO 322
  319 MSKFTN(KOLUMN)=-4
      GO TO 321
  320 MSKFTN(KOLUMN)=0
  321 KOLUMN=KOLUMN+1
  322 IF(KOLUMN.GT.LSTTRN)GO TO 325
      IF(MSKFTN(KOLUMN).EQ.0)GO TO 321
      IF(MSKFTN(KOLUMN).EQ.-3)GO TO 319
      IF(MSKFTN(KOLUMN).EQ.-4)GO TO 320
      GO TO 325
  323 MSKFTN(INDEX)=-4
      GO TO 325
  324 MSKFTN(INDEX)=0
  325 INDEX=INDEX-1
      IF(INDEX.LE.0)GO TO 326
      IF(MSKFTN(INDEX).EQ.0)GO TO 325
      IF(MSKFTN(INDEX).EQ.-3)GO TO 323
      IF(MSKFTN(INDEX).EQ.-4)GO TO 324
  326 KOLUMN=KOLUMN+1
      IF(KOLUMN.LT.LSTTRN)GO TO 313
  327 CONTINUE
C
C     SUPERIMPOSE PHRASE UPON EDGE OR BORDER
  328 IF(LNGSHD.LE.0)GO TO 334
      IF(LNGMID.LE.0)GO TO 334
      KOLUMN=KNTSHD
      KNTSHD=KNTSHD-NGLSHD
      IF(NGLSHD.GT.0)GO TO 329
      IF(KNTSHD.GE.LNGSHD)KNTSHD=KNTSHD-LNGSHD
      GO TO 330
  329 IF(KNTSHD.LT.0)KNTSHD=KNTSHD+LNGSHD
  330 DO 333 I=1,LNGMID
      KOLUMN=KOLUMN+1
      IF(KOLUMN.GT.LNGSHD)KOLUMN=1
      IF(LTRMID(I).NE.LTRSPA)GO TO 331
      IF(MSKMID(I).EQ.0)GO TO 333
      MSKBIT=MSKMID(I)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 333
  331 IF(INIOBJ.EQ.0)GO TO 332
      INIOBJ=0
      KNTSHD=KNTSHD-KOLUMN+1
      IF(KNTSHD.LT.0)KNTSHD=KNTSHD+LNGSHD
      KOLUMN=1
  332 LTRMID(I)=LTRSHD(KOLUMN)
  333 CONTINUE
  334 CONTINUE
      GO TO 366
C
C     ***********************************
C     *                                 *
C     *  CONSTRUCT NEGATIVE BACKGROUND  *
C     *                                 *
C     ***********************************
C
C     PREPARE TO COMPLETE NEGATIVE BACKGROUND IF CHANGING CONDITIONS
  335 IF(KNDTRN.NE.2)GO TO 336
      NSKIP=ILOSHD
      I=ISKIP
      IF(MASTER.NE.11)I=ISPACE
      NXTSKP=0
      IF(I.GT.NSKIP)NXTSKP=I-NSKIP
      IF(MASTER.NE.11)NSKIP=ILOSHD+1
      NSKIP=NSKIP+LINFIG
      LINFIG=0
      ISKIP=0
      MASTER=-1
      LSTTRN=0
      KNDTRN=3
      IF(NSKIP.GT.0)GO TO 349
      ISKIP=NXTSKP
  336 MASTER=11
      KNDTRN=0
      GO TO 430
C
C     SKIP LINES ABOVE CONSTRUCTED NEGATIVE BACKGROUND
  337 IF(ISKIP.GT.IHISHD)GO TO 422
      ISKIP=0
      IF(LINFIG.LE.0)GO TO 146
      LNGMID=0
      GO TO 340
C
C     SKIP LINES WHILE DOING NEGATIVE BACKGROUND
  338 LNGMID=0
      NSKIP=ISKIP
      ISKIP=0
      IF(LINFIG.GT.0)NSKIP=NSKIP+LINFIG
      LINFIG=0
      MASTER=-1
      GO TO 349
C
C     NSKIP IS ALREADY GREATER THAN ZERO
  339 LNGMID=0
      MASTER=-1
      GO TO 349
C
C     CONSTRUCT BORDER ABOVE NEGATIVE BACKGROUND
  340 IF(KNDTRN.NE.1)GO TO 349
      IF(LINFIG.LT.0)LINFIG=-LINFIG
      IF(ISKIP.LE.IHISHD)GO TO 341
      LINFIG=-LINFIG
      GO TO 422
  341 KNTSHD=0
      IF(LNGSHD.LE.1)GO TO 343
      IFIRST=MRGLFT
      IF(LFTSGN.GT.0)IFIRST=LFTSHD
      IF(LFTSGN.LT.0)IFIRST=MRGLFT+LFTSHD
      IF(IFIRST.LE.0)GO TO 343
      DO 342 I=1,IFIRST
      KNTSHD=KNTSHD+1
      IF(KNTSHD.GE.LNGSHD)KNTSHD=0
  342 CONTINUE
  343 ISKIP=0
      NETKNT=0
      LSTTRN=-1
      IF(LINFIG.GT.0)GO TO 344
      IF(IHISHD.LE.0)GO TO 348
  344 NSKIP=IHISHD
      IF(LINFIG.GT.0)NSKIP=NSKIP+LINFIG-1
      LINFIG=0
      IF(NSKIP.LE.0)GO TO 348
      MASTER=-1
      IF(LNGMID.LE.0)GO TO 349
      LSTTRN=LNGMID
      LNGMID=0
      DO 345 I=1,LSTTRN
      LTRFTN(I)=LTRMID(I)
      MSKFTN(I)=MSKMID(I)
  345 CONTINUE
      GO TO 349
C
C     NSKIP INITIAL LINES COMPLETED
  346 NSKIP=0
      LNGMID=0
      IF(LSTTRN.LE.0)GO TO 348
      LNGMID=LSTTRN
      DO 347 I=1,LNGMID
      LTRMID(I)=LTRFTN(I)
      MSKMID(I)=MSKFTN(I)
  347 CONTINUE
  348 KNDTRN=2
      LSTTRN=-1
      MASTER=0
C
C     CONSTRUCT NEGATIVE BACKGROUND
  349 KOLUMN=KNTSHD
      KNTSHD=KNTSHD-NGLSHD
      IF(NGLSHD.GT.0)GO TO 350
      IF(KNTSHD.GE.LNGSHD)KNTSHD=KNTSHD-LNGSHD
      GO TO 351
  350 IF(KNTSHD.LT.0)KNTSHD=KNTSHD+LNGSHD
  351 IF(NOWBAR.NE.0)IFABAR=NOWBAR
      IFIRST=MRGLFT
      IF(LFTSGN.GT.0)IFIRST=LFTSHD
      IF(LFTSGN.LT.0)IFIRST=MRGLFT+LFTSHD
      IF(IFIRST.LT.0)IFIRST=0
      IFIRST=IFIRST+1
      IFINAL=MRGRIT
      IF(IRISGN.GT.0)IFINAL=IRISHD
      IF(IRISGN.LT.0)IFINAL=MRGRIT+IRISHD
      IF(IFINAL.GT.LMTMID)IFINAL=LMTMID
      IF(IFIRST.GT.IFINAL)GO TO 365
      IF(NETNGL.EQ.0)GO TO 352
      IF(NETNGL.GT.0)GO TO 353
      JFIRST=NETWID+NETSEP+NETKNT+NETOFF
      NETKNT=NETKNT+NETNGL
      IF(NETKNT.LE.(-NETWID-NETSEP))NETKNT=NETKNT+NETWID+NETSEP
      GO TO 354
  352 JFIRST=NETOFF
      GO TO 354
  353 JFIRST=NETKNT+NETOFF
      NETKNT=NETKNT+NETNGL
      IF(NETKNT.GE.(NETWID+NETSEP))NETKNT=NETKNT-NETWID-NETSEP
  354 IF(JFIRST.LE.NETSEP)GO TO 355
      JFIRST=JFIRST-NETWID-NETSEP
      GO TO 354
  355 JFIRST=JFIRST+IFIRST
  356 JFINAL=JFIRST+NETWID-1
      DO 364 I=IFIRST,IFINAL
      KOLUMN=KOLUMN+1
      IF(KOLUMN.GT.LNGSHD)KOLUMN=1
      IF(I.LT.JFIRST)GO TO 364
      IF(I.LE.JFINAL)GO TO 357
      JFIRST=JFINAL+NETSEP+1
      JFINAL=JFIRST+NETWID-1
      IF(I.LT.JFIRST)GO TO 364
  357 IF(I.GT.LMTMID)GO TO 365
      IF(I.GT.LNGMID)GO TO 358
      IF(LTRMID(I).NE.LTRSPA)GO TO 362
      MSKBIT=MSKMID(I)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 362
      GO TO 359
  358 IF(LNGMID.GE.I)GO TO 359
      LNGMID=LNGMID+1
      LTRMID(LNGMID)=LTRSPA
      MSKMID(LNGMID)=0
      GO TO 358
  359 IF(LNGSHD.EQ.0)GO TO 361
      IF(INIOBJ.EQ.0)GO TO 360
      INIOBJ=0
      KNTSHD=KNTSHD-KOLUMN+1
      IF(KNTSHD.LT.0)KNTSHD=KNTSHD+LNGSHD
      KOLUMN=1
  360 LTRMID(I)=LTRSHD(KOLUMN)
      GO TO 363
  361 LTRMID(I)=LTRABC(24)
      GO TO 363
  362 LTRMID(I)=LTRSPA
  363 MSKMID(I)=0
  364 CONTINUE
  365 GO TO 366
C
C     EDGE OR BACKGROUND COMPLETED
  366 IF(NOWBAR.NE.0)IFABAR=NOWBAR
      IF(NSKIP.GT.0)GO TO 430
      IF(LSTTRN.NE.0)GO TO 430
      IF(KNDTRN.EQ.2)GO TO 367
      IF(KNDTRN.EQ.5)GO TO 367
      IF(KNDTRN.EQ.8)GO TO 367
      GO TO 430
  367 LSTTRN=-1
      GO TO 430
C
C     *************************************************
C     *                                               *
C     *  INSERT ITEMS INTO TEXT READ FROM INPUT FILE  *
C     *                                               *
C     *************************************************
C
C     INSERT FOOTNOTE NUMBER INTO START OF FOOTNOTE
  368 LENGTH=0
  369 LNGMID=0
      LNGWRK=0
      INDENT=0
      IF(IFNOTE.GE.0)GO TO 374
      INDENT=INDENT+INDFTN
      IF(LNGWRK.GE.LMTWRK)GO TO 374
      IF(LTRREF(3).EQ.LTRSPA)GO TO 370
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRREF(3)
  370 CALL RNONUM(MRKFTN,NOWFTN,LTRWRK,LNGWRK,LMTWRK)
      IF(LNGWRK.GE.LMTWRK)GO TO 371
      IF(LTRREF(4).EQ.LTRSPA)GO TO 371
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRREF(4)
  371 IF(LNGWRK.LE.0)GO TO 374
      IF(IFNNUM.EQ.1)GO TO 372
      IF(IFNNUM.NE.3)GO TO 374
  372 MSKBIT=0
      CALL RNOPAK(4,MSKBIT)
      DO 373 I=1,LNGWRK
      MSKWRK(I)=MSKBIT
  373 CONTINUE
      LNGMID=LNGWRK
C
C     CONSTRUCT LIST IDENTIFIERS FOR EITHER FILL OR NO FILL
  374 IF(IFLIST.LE.0)GO TO 382
      IF(LSTELM.LE.0)GO TO 382
      INDENT=INDENT+INDLST(IFLIST)
      LSTELM=0
      IF(IFNOTE.GE.0)GO TO 376
      IFNOTE=1
      IF(IFNNUM.GE.2)GO TO 376
      DO 375 I=1,2
      IF(LNGWRK.GE.LMTWRK)GO TO 382
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRSPA
  375 CONTINUE
  376 IF(LTROPN(IFLIST).EQ.LTRSPA)GO TO 377
      IF(LNGWRK.GE.LMTWRK)GO TO 381
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTROPN(IFLIST)
  377 IF(LSTTYP(IFLIST).GE.0)GO TO 379
      I=-LSTTYP(IFLIST)
      DO 378 J=1,I
      IF(LNGWRK.GE.LMTWRK)GO TO 381
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRLST(IFLIST,J)
  378 CONTINUE
      GO TO 380
  379 CALL RNONUM(LSTTYP(IFLIST),LSTVAL(IFLIST),LTRWRK,LNGWRK,LMTWRK)
  380 IF(LTRCLS(IFLIST).EQ.LTRSPA)GO TO 381
      IF(LNGWRK.GE.LMTWRK)GO TO 381
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRCLS(IFLIST)
  381 LSTVAL(IFLIST)=LSTVAL(IFLIST)+1
C
C     JUSTIFY FOOTNOTE NUMBER AND/OR LIST ELEMENT NUMBER
  382 IF(LNGMID.GE.LNGWRK)GO TO 383
      LNGMID=LNGMID+1
      MSKWRK(LNGMID)=0
      GO TO 382
  383 IF(IFNOTE.GE.0)GO TO 384
      IF(IFNNUM.LT.2)GO TO 384
      NEEDED=MRGLFT+INDENT
      GO TO 385
  384 NEEDED=MRGLFT+INDENT-2
  385 IF(NEEDED.LT.LNGWRK)NEEDED=LNGWRK
      IF(NEEDED.GT.(LMTMID-LENGTH))NEEDED=LMTMID-LENGTH
      IF(NOWBAR.NE.0)IFABAR=NOWBAR
      LNGMID=NEEDED
  386 IF(LNGWRK.LE.0)GO TO 387
      LTRMID(NEEDED)=LTRWRK(LNGWRK)
      MSKMID(NEEDED)=MSKWRK(LNGWRK)
      LNGWRK=LNGWRK-1
      GO TO 388
  387 LTRMID(NEEDED)=LTRSPA
      MSKMID(NEEDED)=0
  388 NEEDED=NEEDED-1
      IF(NEEDED.GT.0)GO TO 386
      IF(IFNOTE.GE.0)GO TO 389
      IFNOTE=1
      IF(IFNNUM.GE.2)GO TO 391
  389 NEEDED=2
      IF(NEEDED.GT.(LMTMID-LNGMID-LENGTH))NEEDED=LMTMID-LNGMID-LENGTH
      IF(NEEDED.LE.0)GO TO 391
      DO 390 I=1,NEEDED
      LNGMID=LNGMID+1
      LTRMID(LNGMID)=LTRSPA
      MSKMID(LNGMID)=0
  390 CONTINUE
  391 INDENT=0
      IF(LENGTH.GT.0)GO TO 169
      KPYMID=LNGMID
      LNGMID=LNGMID-2
      IF(LNGMID.LT.0)LNGMID=0
      GO TO 202
C
C     INSERT TEXT SPECIFIED BY .HEADER LEVEL COMMAND
  392 NVALUE(1)=NXTHDR
      NMINUS(1)=1
      NVALUE(2)=ISTART
      NMINUS(2)=LNGBGN-ISTART+1
      KNTARG=2
  393 IF(IFNOTE.NE.0)GO TO 394
      IF(ISKIP.LE.0)GO TO 394
      IF(IFPAGE.LE.0)GO TO 424
      IF((LOCPAG+ISKIP).LT.LNGPAG)GO TO 424
      IF(NEWPAG.EQ.0)NEWPAG=1
      ISKIP=-1
  394 JSKIP=0
      NXTHDR=0
      IVALUE=NVALUE(1)
      IMINUS=NMINUS(1)
      IF(IMINUS.LE.0)IVALUE=KNTLVL+IVALUE
      IF(IVALUE.LE.0)IVALUE=1
      IF(IVALUE.GT.LMTLVL)IVALUE=LMTLVL
      KNTSPC=-1
      IF(IVALUE.LE.NXTLVL)GO TO 396
      IF(IVALUE.GT.KNTLVL)GO TO 395
      KNTLVL=IVALUE
      NUMLVL(KNTLVL)=NUMLVL(KNTLVL)+1
      GO TO 396
  395 KNTLVL=KNTLVL+1
      NUMLVL(KNTLVL)=0
      IF(KNTLVL.LT.IVALUE)GO TO 395
      NUMLVL(KNTLVL)=1
  396 NXTLVL=0
      LNGMID=0
      NEEDED=MRGLFT+INDENT+LEVEL4
      INDENT=0
      IF(NOWBAR.NE.0)IFABAR=NOWBAR
  397 IF(LNGMID.GE.NEEDED)GO TO 398
      IF(LNGMID.GE.LMTMID)GO TO 411
      LNGMID=LNGMID+1
      MSKMID(LNGMID)=0
      LTRMID(LNGMID)=LTRSPA
      GO TO 397
  398 NEEDED=0
      IF(NEWCHA.EQ.0)GO TO 400
      JSECTN=ISECTN
      IF(JSECTN.GT.0)GO TO 399
      NOWSEC=IAPNDX
      NOWSHW=KNDAPP
      GO TO 400
  399 NOWSEC=ICHAPT
      NOWSHW=KNDCHA
  400 IF(JSECTN.EQ.0)GO TO 401
      LNGWRK=0
      CALL RNONUM(NOWSHW,NOWSEC,LTRWRK,LNGWRK,LMTWRK)
      GO TO 402
  401 NEEDED=NEEDED+1
      LNGWRK=0
      IF(NEEDED.GT.KNTLVL)NUMLVL(NEEDED)=0
      CALL RNONUM(KNDLVL(NEEDED),NUMLVL(NEEDED),
     1LTRWRK,LNGWRK,LMTWRK)
  402 IF(LNGWRK.LE.0)GO TO 404
      DO 403 I=1,LNGWRK
      IF(LNGMID.GE.LMTMID)GO TO 411
      LNGMID=LNGMID+1
      MSKMID(LNGMID)=0
      LTRMID(LNGMID)=LTRWRK(I)
  403 CONTINUE
  404 IF(JSECTN.NE.0)GO TO 405
      IF(NEEDED.LT.MINLVL)GO TO 407
      GO TO 406
  405 IF(NEEDED.LT.(MINLVL-1))GO TO 407
  406 IF(NEEDED.GE.KNTLVL)GO TO 408
  407 IF(LNGMID.GE.LMTMID)GO TO 411
      LNGMID=LNGMID+1
      MSKMID(LNGMID)=0
      LTRMID(LNGMID)=1H.
      GO TO 401
  408 IF(KNTARG.LT.2)GO TO 411
      IF(NMINUS(2).LE.0)GO TO 411
      IF(LNGMID.GE.LMTMID)GO TO 411
      I=NVALUE(2)
      J=I+NMINUS(2)-1
      DO 409 K=I,J
      MSKBIT=MSKBGN(K)
      CALL RNOUNP(1,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 409
      IF(MRKNDX.LE.0)GO TO 410
      MSKBIT=MSKBGN(K)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 410
      IF(LTRBGN(K).NE.LTRNDX)GO TO 410
  409 CONTINUE
      GO TO 411
  410 LNGMID=LNGMID+1
      MSKMID(LNGMID)=0
      LTRMID(LNGMID)=LTRSPA
      KPYBGN=NVALUE(2)-1
      LNGBGN=NMINUS(2)+KPYBGN
      GO TO 412
  411 KPYBGN=LNGBGN
  412 ISTART=LNGBGN
      KOMENT=0
      JSKIP=4
      JFILL=0
      GO TO 142
  413 JSKIP=3
      KSKIP=0
      GO TO 430
  414 ISKIP=ISKIP+LEVEL3
      JSKIP=0
      GO TO 9
C
C     INSERT TEXT SPECIFIED BY .NOTE COMMAND
  415 IF(IFNOTE.NE.0)GO TO 416
      IF(ISKIP.LE.0)GO TO 416
      IF(IFPAGE.LE.0)GO TO 424
      IF((LOCPAG+ISKIP).LT.LNGPAG)GO TO 424
      IF(NEWPAG.EQ.0)NEWPAG=1
      ISKIP=-1
  416 JSKIP=0
      NEEDED=MRGLFT+((MRGRIT-MRGLFT-NMINUS(KNTARG))/2)
      KPYMID=0
      LNGMID=1
      IF(NEEDED.LE.0)GO TO 418
      DO 417 I=1,NEEDED
      IF(KPYMID.GE.LMTMID)GO TO 418
      KPYMID=KPYMID+1
      MSKMID(KPYMID)=0
      LTRMID(KPYMID)=LTRSPA
  417 CONTINUE
  418 J=NVALUE(KNTARG)
      IF(NMINUS(KNTARG).LE.0)GO TO 420
      K=J+NMINUS(KNTARG)-1
      DO 419 I=J,K
      IF(KPYMID.GE.LMTMID)GO TO 420
      KPYMID=KPYMID+1
      LTRMID(KPYMID)=LTRBGN(I)
      MSKMID(KPYMID)=MSKBGN(I)
      MSKBIT=MSKMID(KPYMID)
      CALL RNOUNP(1,MSKBIT)
      IF(MSKBIT.EQ.0)LNGMID=KPYMID
  419 CONTINUE
  420 JSKIP=7
      INDENT=INTIND
      GO TO 430
  421 ISKIP=ISKIP+NOTTWO
      JSKIP=0
      GO TO 9
C
C     SIMULATE LINES IN RANGE OF SKIP COMMAND
  422 IF(LNGBGN.LT.ISTART)JSKIP=1
      GO TO 424
  423 INDENT=0
  424 LNGMID=0
      GO TO 430
  425 MASTER=2
      I=ITLALL
      ITLALL=INIALL
      INIALL=I
      I=ITLLIN
      ITLLIN=INILIN
      INILIN=I
      I=ITLNXT
      ITLNXT=ININXT
      ININXT=I
      I=ITLSPA
      ITLSPA=INISPA
      INISPA=I
      I=LOKSUP
      LOKSUP=INIHIA
      INIHIA=I
      I=LCLSUP
      LCLSUP=INIHIB
      INIHIB=I
      GO TO 430
  426 MASTER=1
      MAXBGN=0
      LNGBGN=0
      GO TO 430
  427 ITLALL=INIALL
      ITLLIN=INILIN
      ITLNXT=ININXT
      ITLSPA=INISPA
      LOKSUP=INIHIA
      LCLSUP=INIHIB
      GO TO 430
  428 JSKIP=9
      GO TO 430
  429 ITLSPA=0
  430 RETURN
      END
      SUBROUTINE RNOHOW
C     RENBR(/EVALUATE ALL COMMANDS)
C
C     DONALD E. BARTH, YALE SCHOOL OF MANAGEMENT
C
      COMMON/RNOONE/I     ,IAPNDX,IBRFTN,IBYTE ,ICENTR,
     1ICHAPT,IDEBUG,IDEFER,IDFILE,IDFRFG,IDFRPG,IDISK ,
     2IFABAR,IFAUTO,IFENCE,IFFILL,IFFLAG,IFHEAD,IFLIST,
     3IFLOOP,IFLSUB,IFNATO,IFNBGN,IFNFIL,IFNGAP,
     4IFNGSP,IFNHAV,IFNIBR,IFNICN,IFNIDF,IFNIFA,IFNIIN,
     5IFNILF,IFNIND,IFNIRT,IFNISP,IFNJCN,IFNJDF,IFNJFL,
     6IFNJST,IFNKCN,IFNKDF,IFNKLM,IFNLBR,IFNLBS,IFNLOF,
     7IFNLSP,IFNMBR,IFNMFR,IFNMLF,IFNMNS,IFNMRT,
     8IFNNBR,IFNNIN,IFNNLF,IFNNOF,IFNNOT,IFNNRT,IFNNSK,
     9IFNNTF,IFNNTL,IFNNTR,IFNNTS,IFNNTT,IFNNT1,IFNNT2
      COMMON/RNOTWO/IFNNT3,IFNOFF,IFNOPN,IFNOTE,IFNPIN,
     1IFNPRD,IFNPSK,IFNPTS,IFNRBS,IFNRDY,IFNRED,IFNRIT,
     2IFNROF,IFNTTL,IFNULS,IFNUMB,IFPAGE,IFRSUB,IFSPLC,
     3IGAPHI,IGAPLO,IGROUP,IMINUS,INDENT,INDFTN,INIALL,
     4INIAPP,INIBAR,INICHA,INIFRM,INILIN,ININDX,ININXT,
     5INISPA,INITAL,INNOTE,INTIND,INTLFT,INTRIT,INTRVL,
     6IOFFST,IPEROD,IPGSHO,IQUOTE,IRANGE,IREVRS,IRTBAS,
     7IRTFTN,IRTOFF,IRUNIN,ISECTN,ISKFTN,ISKIP ,ISPACE,
     8ISTART,ISUBPG,ITLALL,ITLLIN,ITLNXT,ITLSPA,ITRMNL,
     9ITTY  ,IULSPC,IVALUE,IWIZRD,J     ,JCENTR,JDFRFG
      COMMON/RNOTHR/JDFRPG,JDISK ,JFILL ,JFNBGN,JFNGAP,
     1JFNOPN,JFNRED,JFNRIT,JGROUP,JMINUS,JOFFST,JRANGE,
     2JSECTN,JSKIP ,JSTIFY,JTTY  ,JVALUE,K     ,KAPITL,
     3KASALL,KASFLG,KASLCL,KCENTR,KDFRFG,KDISK ,KFNGAP,
     4KLMFIL,KLMMNS,KMINUS,KNDAPP,KNDCHA,KNDFIL,KNDLFT,
     5KNDLIN,KNDPAG,KNDRIT,KNDSPL,KNDSUB,KNDTRN,KNTARG,
     6KNTCOD,KNTFTN,KNTFXD,KNTLIN,KNTLOP,KNTLVL,KNTPAG,
     7KNTPNT,KNTRST,KNTSHO,KNTSPC,KNTSPL,KNTTOP,KNTXTR,
     8KOMAND,KOMENT,KONECT,KPYBGN,KPYKAS,KPYMID,KPYPRT,
     9KRANGE,KSKIP ,KVALUE,LCLBAR,LCLNDX,LCLSUP,KAPNDX
      COMMON/RNOFOU/LDISK ,LENGTH,LEVEL0,LEVEL1,LEVEL3,
     1LEVEL4,LFNGAP,LFTBAS,ILFFTN,LFTOFF,LFTRIT,LINFIG,
     2LINSPL,LITERL,LMTBGN,LMTCHA,LMTCOD,LMTFNR,LMTKAS,
     3LMTLST,LMTLVL,LMTMID,LMTNDX,LMTTAB,LMTTTL,LMTUNT,
     4LMTWRK,LNGBGN,LNGBOT,LNGCHA,LNGFNR,LNGFTN,LNGMID,
     5NXTFTN,LNGPAG,LNGSPL,LNGSRC,LNGTRN,LNGTTL,KNDNDX,
     6LOCABC,LOCATE,LOCPAG,LOCPNT,LOKSUP,LOWBFR,NSKIP ,
     7LRADJS,LRFORC,LSNSPL,LSNSRC,LSTAPP,LSTCHA,LSTELM,
     8LSTFRM,LSTSPL,LSTTRN,MAJOR ,MASTER,MAXBGN,MAXLIN,
     9MAXLOP,MAXSPL,MAXTAB,MAXWRD,MDISK ,MIDAPP,MIDCHA
      COMMON/RNOFIV/MINLVL,MINTOP,MOVBAC,MRGFAR,MRGLFT,
     1MRGRIT,MRGTOP,MRKAMP,MRKBAC,MRKBAR,MRKCAR,MRKDOL,
     2MRKDOT,MRKEFN,MRKEXC,MRKFTN,MRKLES,MRKNDX,MRKNUM,
     3MRKREF,MRKSBX,MRKSEM,MRKSUB,MRKSUP,MRKTTL,MRKTXT,
     4MRKUND,MSTLST,NDISK ,NDXDSK,NDXFOU,NDXHOW,NDXKNT,
     5NDXMAK,NDXONE,NDXOPN,NDXTHR,NDXTWO,NEEDED,NEWCHA,
     6NEWPAG,NOTFIL,NOTIND,NOTKLM,NOTLFT,NOTMNS,NOTONE,
     7NOTRIT,NOTSEM,NOTSKP,NOTSPC,NOTTHR,NOTTST,NOTTWO,
     8NOWBAR,NOWFTN,NOWIND,NOWLFT,NOWLST,NOWOFF,NOWPAG,
     9NOWPHW,NOWRIT,NOWSEC,NOWSHW,NOWSKP,NOWSPH,NOWSUB
      COMMON/RNOSIX/NOWTST,NULTTL,NUMFTN,NXTFIG,NXTHDR,
     1NXTLST,NXTLVL,NXTONE,NXTPAG,NXTSUB,KNDOUT,LNGWRK,
     2KAPFTN,KOFFST,IRECRD,KNTNDX,INIPAG,INIHIA,MAGNFY,
     3INIHIB,IFHALF,KTRMNL,ITTLLO,ISUBLO,LNGTOP,MAGFNT,
     4ITTLHI,ISUBHI,IFINDX,IXTRSS,JXTRSS,KXTRSS,MAGSPC,
     5MXTRSS,NXTRSS,IFORMR,JTRMNL,IFNREF,IFNNUM,KMPPAG,
     6KMPLIN,KMPCLM,KMPVAL,INICLM,MFNGAP,NFNGAP,MAGSAV,
     7MAGSHD,MAGHIH,MRKMAG,LMTSHD,LNGSHD,LFTSHD,IRISHD,
     8IHISHD,ILOSHD,KNTSHD,LFTSGN,IRISGN,NGLSHD,NETNGL,
     9NETSEP,NETWID,NETOFF,NETKNT,KNTEDT,LMTEDT,LMTBIG,
     1LNGBIG,NGLBIG,KNTBIG,NXTSKP,JBORDR,INIMAG,INIOBJ,
     2IBORDR
      COMMON/RNOEIG/INDLST(10)  ,KMDARG(250) ,KMDBRK(250) ,
     1 KNDLVL(6)   ,KNDTTL(16)  ,LOCTAB(32)  ,LSTMRG(10)  ,
     2 LSTRIT(10)  ,LSTSKP(10)  ,LSTSPC(10)  ,LSTTTL(80)  ,
     3 LSTTYP(10)  ,LSTVAL(10)  ,MCHPNT(1300),MSKBGN(300) ,
     4 MSKCHA(200) ,MSKFNR(200) ,MSKFTN(200) ,MSKMID(200) ,
     5 MSKTTL(450) ,NARGMT(44)  ,NBEGIN(19)  ,NMINUS(32)  ,
     6 NOTPNT(1300),NUMLVL(6)   ,NUMNDX(300) ,NUMTTL(11)  ,
     7 NVALUE(32)  ,NXTCMD(81)  ,NXTPNT(12)  ,NXTUNT(4)   ,
     8 MSKWRK(200) ,MTYSTR(4)   ,MAGEDT(50)
      COMMON/RNONIN/LTRAMP,LTRBAC,LTRBAR,LTRCAR,LTRCOM,
     1LTRDOL,LTRDOT,LTREFN,LTREXC,LTRFNC,LTRLES,
     2LTRMNS,LTRNDX,LTRNOW,LTRNUM,LTRPLS,LTRQUO,LTRRUL,
     3LTRSBX,LTRSEM,LTRSPA,LTRSUB,LTRSUP,LTRTAB,
     4LTRPUT,LTRTXT,LTRUND,LTR1ST,LTRMAG
      COMMON/RNOTEN/LTRABC(26)  ,LTRAPP(9)   ,LTRBGN(300) ,
     1 LTRCPT(8)   ,LTRCLS(10)  ,LTRCOD(70)  ,LTRDGT(10)  ,
     2 LTRFLG(18)  ,LTRFTN(200) ,LTRIND(5)   ,LTRLST(10,6),
     3 LTRMID(200) ,LTRONL(26)  ,LTRONU(26)  ,LTROPN(10)  ,
     4 LTRPAG(5)   ,LTRREF(4)   ,LTRSPL(200) ,LTRTWO(4)   ,
     5 LTRTYP(8)   ,LTRWRK(200) ,LWRABC(26)  ,LWRAPP(9)   ,
     6 LWRCHA(8)   ,LWRIND(5)   ,LWRONL(26)  ,LWRONU(26)  ,
     7 LWRTYP(8)   ,LTRTTL(450) ,LTRCHA(200) ,LTRFNR(200) ,
     8 LTRSHD(50)  ,LTRBIG(50)
C
      IF(MASTER.EQ.7)GO TO 34
      IF(MASTER.EQ.8)GO TO 55
      IF(MASTER.EQ.9)GO TO 28
C
C     GET NEXT LINE OF TEXT TO BE INTERPRETED
      KOMAND=0
      LOWBFR=ISTART
      LOCPNT=1
C
C     GET NEXT CHARACTER TO BE TESTED
    1 LOWBFR=LOWBFR+1
      IF(LOWBFR.GT.LNGBGN)GO TO 7
C
C     ATTEMPT TO IDENTIFY THE CHARACTER
    2 IF(LOCPNT.LE.0)GO TO 7
      KVALUE=NOTPNT(LOCPNT)
      LOCABC=KVALUE
      IF(KVALUE.LT.0)LOCABC=-LOCABC
      LOCABC=LOCABC/IBYTE
    3 IF(LTRBGN(LOWBFR).EQ.LTRABC(LOCABC))GO TO 6
      IF(LTRBGN(LOWBFR).EQ.LWRABC(LOCABC))GO TO 6
C
C     LETTERS DID NOT MATCH
      IF(KVALUE.GE.0)GO TO 5
      KVALUE=-KVALUE
C
C     CHECK FOR SPACES BEFORE NEXT WORD
    4 IF(LTRBGN(LOWBFR).NE.LTRSPA)GO TO 3
      LOWBFR=LOWBFR+1
      IF(LOWBFR.LE.LNGBGN)GO TO 4
      GO TO 7
C
C     GET NEXT LETTER TO BE TESTED IF FAILURE
    5 LOCPNT=KVALUE-(IBYTE*LOCABC)
      GO TO 2
C
C     LETTERS MATCHED
    6 KVALUE=MCHPNT(LOCPNT)
      KMDNEW=KVALUE/IBYTE
      LOCPNT=KVALUE-(IBYTE*KMDNEW)
      IF(KMDNEW.NE.0)KOMAND=KMDNEW
      LOCATE=LOWBFR
      GO TO 1
C
C     ENTIRE TREE SEARCHED
    7 IF(JFILL.NE.6)GO TO 8
      IF(KOMAND.NE.86)GO TO 70
    8 IF(MRKDOT.GT.0)GO TO 9
      IF(KOMAND.NE.10)GO TO 70
    9 IF(LOCPNT.EQ.1)GO TO 69
      IF(KOMAND.LE.1)GO TO 61
C
C     ****************************
C     *                          *
C     *  EVALUATE ARGUMENT LIST  *
C     *                          *
C     ****************************
C
C
C     INSURE ALPHABETIC LETTER DOES NOT FOLLOW COMMAND
      LOCATE=LOCATE+1
      IFCMMA=0
      NVALUE(1)=0
      NMINUS(1)=0
      IF(LOCATE.GT.LNGBGN)GO TO 11
      LTRNOW=LTRBGN(LOCATE)
      DO 10 I=1,26
      IF(LTRNOW.EQ.LTRABC(I))GO TO 61
      IF(LTRNOW.EQ.LWRABC(I))GO TO 61
   10 CONTINUE
   11 LOCARG=KMDARG(KOMAND)
      KNTARG=0
      KNDARG=0
      IF(LOCARG.LE.0)GO TO 14
      NXTARG=NBEGIN(LOCARG)
   12 KNDARG=NARGMT(NXTARG)
      MAXARG=KNDARG/100
      KNDARG=KNDARG-(100*MAXARG)
   13 IF(KNDARG.EQ.4)GO TO 22
      IF(KNDARG.EQ.5)GO TO 54
   14 IF(LOCATE.GT.LNGBGN)GO TO 53
      MSKBIT=MSKBGN(LOCATE)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 16
      LTRNOW=LTRBGN(LOCATE)
      IF(LTRNOW.NE.LTRSPA)GO TO 15
      LOCATE=LOCATE+1
      GO TO 14
   15 IF(LTRNOW.EQ.LTRCOM)GO TO 50
   16 IF(KNDARG.EQ.0)GO TO 61
      IFCMMA=1
      GO TO(17,24,42,22,54,24),KNDARG
C
C     EVALUATE NUMBER TO RIGHT OF SWITCH
   17 KVALUE=0
      KMINUS=0
   18 IF(LOCATE.GT.LNGBGN)GO TO 21
      LTRNOW=LTRBGN(LOCATE)
      IF(LTRNOW.EQ.LTRSPA)GO TO 21
      IF(LTRNOW.EQ.LTRCOM)GO TO 21
      DO 19 I=1,10
      IF(LTRNOW.NE.LTRDGT(I))GO TO 19
      IF(KMINUS.EQ.0)KMINUS=1
      IF(KVALUE.LT.10000)KVALUE=(10*KVALUE)+I-1
      GO TO 20
   19 CONTINUE
      IF(KMINUS.NE.0)GO TO 21
      IF(LTRNOW.EQ.LTRMNS)KMINUS=-2
      IF(LTRNOW.EQ.LTRPLS)KMINUS=-1
      IF(KMINUS.EQ.0)GO TO 61
   20 LOCATE=LOCATE+1
      GO TO 18
   21 IF(KMINUS.EQ.-2)KVALUE=-KVALUE
      KNTARG=KNTARG+1
      NVALUE(KNTARG)=KVALUE
      NMINUS(KNTARG)=KMINUS
      GO TO 49
C
C     CHECK IF TEXT STRING IS QUOTED
   22 IF(MRKTXT.LE.0)GO TO 54
      LNGBGN=NOTSEM
      IFCMMA=1
   23 MSKBIT=MSKBGN(LOCATE)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 33
      IF(LTRBGN(LOCATE).EQ.LTRTXT)GO TO 25
      IF(LTRBGN(LOCATE).NE.LTRSPA)GO TO 33
      LOCATE=LOCATE+1
      IF(LOCATE.LE.LNGBGN)GO TO 23
      GO TO 53
C
C     CHECK IF CHARACTER IS QUOTED
   24 MSKBIT=MSKBGN(LOCATE)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 33
      IF(LTRBGN(LOCATE).NE.LTRTXT)GO TO 29
C
C     GET REST OF QUOTED STRING IF UNPAIRED DELIMITER
   25 IVALUE=LOCATE
   26 IVALUE=IVALUE+1
      IF(IVALUE.GT.LNGBGN)GO TO 27
      MSKBIT=MSKBGN(IVALUE)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 26
      IF(LTRBGN(IVALUE).NE.LTRTXT)GO TO 26
      IVALUE=IVALUE+1
      IF(IVALUE.GT.LNGBGN)GO TO 37
      MSKBIT=MSKBGN(IVALUE)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 37
      IF(LTRBGN(IVALUE).NE.LTRTXT)GO TO 37
      GO TO 26
   27 IFENCE=1
      LTRFNC=LTRTXT
      LNGBGN=KPYPRT
      MASTER=9
      KOMENT=-1
      IQUOTE=1
      GO TO 72
   28 IFENCE=0
      GO TO 37
C
C     GET UNQUOTED MULTIPLE CHARACTERS
   29 IF(KNDARG.NE.6)GO TO 33
      KNTARG=KNTARG+1
      NVALUE(KNTARG)=LOCATE
      IVALUE=1
   30 LOCATE=LOCATE+1
      IF(LOCATE.GT.LNGBGN)GO TO 32
      LTRNOW=LTRBGN(LOCATE)
      MSKBIT=MSKBGN(LOCATE)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 31
      MSKBIT=MSKBGN(LOCATE)
      CALL RNOUNP(1,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 32
      IF(LTRBGN(LOCATE).EQ.LTRCOM)GO TO 32
   31 IVALUE=IVALUE+1
      GO TO 30
   32 NMINUS(KNTARG)=IVALUE
      GO TO 49
C
C     GET UNQUOTED TEXT OR UNQUOTED CHARACTER
   33 KNTARG=KNTARG+1
      NVALUE(KNTARG)=LOCATE
      NMINUS(KNTARG)=1
      IF(KNDARG.NE.4)GO TO 48
      IF(KPYPRT.GT.NOTSEM)GO TO 34
      LNGBGN=KPYPRT
      MASTER=7
      KOMENT=1
      GO TO 72
   34 IVALUE=NOTSEM
   35 MSKBIT=MSKBGN(IVALUE)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 36
      IF(LTRBGN(IVALUE).NE.LTRSPA)GO TO 36
      IVALUE=IVALUE-1
      GO TO 35
   36 NMINUS(KNTARG)=IVALUE-LOCATE+1
      LOCATE=LNGBGN
      GO TO 48
C
C     GET QUOTED TEXT OR QUOTED CHARACTER
   37 IVALUE=LOCATE
      KVALUE=LOCATE
      GO TO 39
   38 KVALUE=KVALUE+1
      IF(KVALUE.GE.LOCATE)GO TO 39
      LTRBGN(KVALUE)=LTRBGN(LOCATE)
      MSKBGN(KVALUE)=MSKBGN(LOCATE)
      LTRBGN(LOCATE)=LTRSPA
      MSKBIT=0
      CALL RNOPAK(1,MSKBIT)
      MSKBGN(LOCATE)=MSKBIT
   39 LOCATE=LOCATE+1
      IF(LOCATE.GT.LNGBGN)GO TO 41
      MSKBIT=MSKBGN(LOCATE)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 38
      IF(LTRBGN(IVALUE).NE.LTRBGN(LOCATE))GO TO 38
      LOCATE=LOCATE+1
      IF(LOCATE.GT.LNGBGN)GO TO 40
      MSKBIT=MSKBGN(LOCATE)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 40
      IF(LTRBGN(IVALUE).EQ.LTRBGN(LOCATE))GO TO 38
   40 IF(KVALUE.GE.(LOCATE-2))GO TO 41
      LTRBGN(KVALUE+1)=LTRBGN(LOCATE-1)
      MSKBGN(KVALUE+1)=MSKBGN(LOCATE-1)
      LTRBGN(LOCATE-1)=LTRSPA
      MSKBIT=0
      CALL RNOPAK(1,MSKBIT)
      MSKBGN(LOCATE-1)=MSKBIT
   41 KNTARG=KNTARG+1
      KVALUE=KVALUE-IVALUE
      IF(KVALUE.EQ.0)KVALUE=-1
      NMINUS(KNTARG)=KVALUE
      NVALUE(KNTARG)=IVALUE+1
      IF(KNDARG.EQ.4)GO TO 49
      IF(KNDARG.EQ.6)GO TO 49
      IF(KVALUE.GT.1)GO TO 61
      GO TO 49
C
C     EVALUATE TYPE OF NUMERIC DISPLAY
C     D,O,H,RU,RL,RM,LU,LL,LM
   42 IVALUE=0
      LTRNOW=LTRBGN(LOCATE)
      DO 43 I=1,26
      IF(LTRNOW.EQ.LWRABC(I))LTRNOW=LTRABC(I)
   43 CONTINUE
      IF(LTRNOW.EQ.1HD)IVALUE=1
      IF(LTRNOW.EQ.1HO)IVALUE=2
      IF(LTRNOW.EQ.1HH)IVALUE=3
      IF(LTRNOW.EQ.1HR)IVALUE=4
      IF(LTRNOW.EQ.1HL)IVALUE=7
      IF(IVALUE.EQ.0)GO TO 61
      LOCATE=LOCATE+1
      IF(LOCATE.GT.LNGBGN)GO TO 47
      IF(IVALUE.LT.4)GO TO 45
      KVALUE=-1
      LTRNOW=LTRBGN(LOCATE)
      DO 44 I=1,26
      IF(LTRNOW.EQ.LWRABC(I))LTRNOW=LTRABC(I)
   44 CONTINUE
      IF(LTRNOW.EQ.1HU)KVALUE=0
      IF(LTRNOW.EQ.1HL)KVALUE=1
      IF(LTRNOW.EQ.1HM)KVALUE=2
      IF(KVALUE.LT.0)GO TO 45
      IVALUE=IVALUE+KVALUE
      LOCATE=LOCATE+1
      IF(LOCATE.GT.LNGBGN)GO TO 47
   45 LTRNOW=LTRBGN(LOCATE)
      DO 46 I=1,26
      IF(LTRNOW.EQ.LTRABC(I))GO TO 61
      IF(LTRNOW.EQ.LWRABC(I))GO TO 61
   46 CONTINUE
   47 KNTARG=KNTARG+1
      NMINUS(KNTARG)=1
      NVALUE(KNTARG)=IVALUE
      GO TO 49
C
C     ALLOW A COMMA TO FOLLOW ARGUMENT
   48 LOCATE=LOCATE+1
   49 IF(LOCATE.GT.LNGBGN)GO TO 52
      LTRNOW=LTRBGN(LOCATE)
      IF(LTRNOW.EQ.LTRSPA)GO TO 48
      IF(LTRNOW.NE.LTRCOM)GO TO 52
   50 LOCATE=LOCATE+1
      IF(IFCMMA.GT.0)GO TO 51
      IF(KNDARG.EQ.0)GO TO 61
      KNTARG=KNTARG+1
      NMINUS(KNTARG)=0
      NVALUE(KNTARG)=0
   51 IFCMMA=-1
   52 MAXARG=MAXARG-1
      IF(MAXARG.GT.0)GO TO 13
      NXTARG=NXTARG+1
      GO TO 12
   53 IF(IFCMMA.GE.0)GO TO 71
      IF(KNDARG.EQ.0)GO TO 61
      KNTARG=KNTARG+1
      NMINUS(KNTARG)=0
      NVALUE(KNTARG)=0
      GO TO 71
C
C     CONVERT CASE OF LETTERS IN REST OF TEXTUAL ARGUMENT
   54 LNGBGN=KPYPRT
      MASTER=8
      KOMENT=0
      JSKIP=0
      KNTARG=KNTARG+1
      NVALUE(KNTARG)=LOCATE
      GO TO 72
C
C     INSURE SPACE FOLLOWS COMMAND WITH TEXTUAL ARGUMENT
   55 IF(NVALUE(KNTARG).GT.LNGBGN)GO TO 60
      IF(KNTARG.GT.1)GO TO 59
      I=NVALUE(KNTARG)
      MSKBIT=MSKBGN(I)
      CALL RNOUNP(1,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 56
      MSKBIT=MSKBGN(I)
      CALL RNOUNP(2,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 58
   56 LTRNOW=LTRBGN(I)
      DO 57 I=1,26
      IF(LTRNOW.EQ.LTRABC(I))GO TO 61
      IF(LTRNOW.EQ.LWRABC(I))GO TO 61
   57 CONTINUE
      GO TO 59
   58 NVALUE(KNTARG)=NVALUE(KNTARG)+1
   59 NMINUS(KNTARG)=LNGBGN-NVALUE(KNTARG)+1
      GO TO 71
   60 NVALUE(KNTARG)=LNGBGN
      NMINUS(KNTARG)=0
      IF(IFCMMA.GE.0)KNTARG=KNTARG-1
      GO TO 71
C
C     REPORT ILLEGAL COMMAND TO USER
   61 IF(JFILL.EQ.6)GO TO 70
      IF(MRKDOT.LE.0)GO TO 70
      IF(KNDFIL.LT.0)GO TO 69
      IF(KNDFIL.GT.0)GO TO 65
      IF(IDEBUG.NE.0)GO TO 64
      IF(LSNSRC.EQ.0)WRITE(ITTY,62)KNTLIN,
     1(LTRBGN(I),I=ISTART,LNGBGN)
      IF(LSNSRC.GT.0)WRITE(ITTY,63)(LTRBGN(I),I=1,5),
     1(LTRBGN(I),I=ISTART,LNGBGN)
   62 FORMAT(6H Line ,1I5,17H unknown command ,300A1)
   63 FORMAT(6H Line ,5A1,17H unknown command ,300A1)
      GO TO 69
   64 IF(LSNSRC.EQ.0)WRITE(JDISK,62)KNTLIN,
     1(LTRBGN(I),I=ISTART,LNGBGN)
      IF(LSNSRC.GT.0)WRITE(JDISK,63)(LTRBGN(I),I=1,5),
     1(LTRBGN(I),I=ISTART,LNGBGN)
      GO TO 69
   65 IF(IDEBUG.NE.0)GO TO 68
      IF(LSNSPL.EQ.0)WRITE(ITTY,66)LINSPL,
     1(LTRBGN(I),I=ISTART,LNGBGN)
      IF(LSNSPL.GT.0)WRITE(ITTY,67)(LTRBGN(I),I=1,5),
     1(LTRBGN(I),I=ISTART,LNGBGN)
   66 FORMAT(13H Splice line ,1I5,17H unknown command ,300A1)
   67 FORMAT(13H Splice line ,5A1,17H unknown command ,300A1)
      GO TO 69
   68 IF(LSNSPL.EQ.0)WRITE(JDISK,66)LINSPL,
     1(LTRBGN(I),I=ISTART,LNGBGN)
      IF(LSNSPL.GT.0)WRITE(JDISK,67)(LTRBGN(I),I=1,5),
     1(LTRBGN(I),I=ISTART,LNGBGN)
   69 KOMAND=0
      MASTER=6
      GO TO 72
C
C     AFTER .LITERAL, ALL BUT .END LITERAL IS TEXT
C     AFTER .NO FLAG CONTROL, ALL BUT .FLAG CONTROL IS TEXT
   70 MASTER=10
      JSKIP=0
      KOMENT=0
      IF(LNGBGN.LT.KPYPRT)LNGBGN=KPYPRT
      GO TO 73
C
C     GET THE 1ST ARGUMENT FOR EASIER ACCESS
   71 IVALUE=NVALUE(1)
      IMINUS=NMINUS(1)
C
C     DETERMINE WHETHER LEGAL COMMAND REQUIRES BREAK
      MASTER=1
C
C     RETURN TO CALLING PROGRAM
   72 KPYBGN=KPYKAS
   73 RETURN
      END
      SUBROUTINE RNOPUT
C     RENBR(/COPY LINE OF TEXT INTO OUTPUT FILE)
C
C     DONALD E. BARTH, YALE SCHOOL OF MANAGEMENT
C
      COMMON/RNOONE/I     ,IAPNDX,IBRFTN,IBYTE ,ICENTR,
     1ICHAPT,IDEBUG,IDEFER,IDFILE,IDFRFG,IDFRPG,IDISK ,
     2IFABAR,IFAUTO,IFENCE,IFFILL,IFFLAG,IFHEAD,IFLIST,
     3IFLOOP,IFLSUB,IFNATO,IFNBGN,IFNFIL,IFNGAP,
     4IFNGSP,IFNHAV,IFNIBR,IFNICN,IFNIDF,IFNIFA,IFNIIN,
     5IFNILF,IFNIND,IFNIRT,IFNISP,IFNJCN,IFNJDF,IFNJFL,
     6IFNJST,IFNKCN,IFNKDF,IFNKLM,IFNLBR,IFNLBS,IFNLOF,
     7IFNLSP,IFNMBR,IFNMFR,IFNMLF,IFNMNS,IFNMRT,
     8IFNNBR,IFNNIN,IFNNLF,IFNNOF,IFNNOT,IFNNRT,IFNNSK,
     9IFNNTF,IFNNTL,IFNNTR,IFNNTS,IFNNTT,IFNNT1,IFNNT2
      COMMON/RNOTWO/IFNNT3,IFNOFF,IFNOPN,IFNOTE,IFNPIN,
     1IFNPRD,IFNPSK,IFNPTS,IFNRBS,IFNRDY,IFNRED,IFNRIT,
     2IFNROF,IFNTTL,IFNULS,IFNUMB,IFPAGE,IFRSUB,IFSPLC,
     3IGAPHI,IGAPLO,IGROUP,IMINUS,INDENT,INDFTN,INIALL,
     4INIAPP,INIBAR,INICHA,INIFRM,INILIN,ININDX,ININXT,
     5INISPA,INITAL,INNOTE,INTIND,INTLFT,INTRIT,INTRVL,
     6IOFFST,IPEROD,IPGSHO,IQUOTE,IRANGE,IREVRS,IRTBAS,
     7IRTFTN,IRTOFF,IRUNIN,ISECTN,ISKFTN,ISKIP ,ISPACE,
     8ISTART,ISUBPG,ITLALL,ITLLIN,ITLNXT,ITLSPA,ITRMNL,
     9ITTY  ,IULSPC,IVALUE,IWIZRD,J     ,JCENTR,JDFRFG
      COMMON/RNOTHR/JDFRPG,JDISK ,JFILL ,JFNBGN,JFNGAP,
     1JFNOPN,JFNRED,JFNRIT,JGROUP,JMINUS,JOFFST,JRANGE,
     2JSECTN,JSKIP ,JSTIFY,JTTY  ,JVALUE,K     ,KAPITL,
     3KASALL,KASFLG,KASLCL,KCENTR,KDFRFG,KDISK ,KFNGAP,
     4KLMFIL,KLMMNS,KMINUS,KNDAPP,KNDCHA,KNDFIL,KNDLFT,
     5KNDLIN,KNDPAG,KNDRIT,KNDSPL,KNDSUB,KNDTRN,KNTARG,
     6KNTCOD,KNTFTN,KNTFXD,KNTLIN,KNTLOP,KNTLVL,KNTPAG,
     7KNTPNT,KNTRST,KNTSHO,KNTSPC,KNTSPL,KNTTOP,KNTXTR,
     8KOMAND,KOMENT,KONECT,KPYBGN,KPYKAS,KPYMID,KPYPRT,
     9KRANGE,KSKIP ,KVALUE,LCLBAR,LCLNDX,LCLSUP,KAPNDX
      COMMON/RNOFOU/LDISK ,LENGTH,LEVEL0,LEVEL1,LEVEL3,
     1LEVEL4,LFNGAP,LFTBAS,ILFFTN,LFTOFF,LFTRIT,LINFIG,
     2LINSPL,LITERL,LMTBGN,LMTCHA,LMTCOD,LMTFNR,LMTKAS,
     3LMTLST,LMTLVL,LMTMID,LMTNDX,LMTTAB,LMTTTL,LMTUNT,
     4LMTWRK,LNGBGN,LNGBOT,LNGCHA,LNGFNR,LNGFTN,LNGMID,
     5NXTFTN,LNGPAG,LNGSPL,LNGSRC,LNGTRN,LNGTTL,KNDNDX,
     6LOCABC,LOCATE,LOCPAG,LOCPNT,LOKSUP,LOWBFR,NSKIP ,
     7LRADJS,LRFORC,LSNSPL,LSNSRC,LSTAPP,LSTCHA,LSTELM,
     8LSTFRM,LSTSPL,LSTTRN,MAJOR ,MASTER,MAXBGN,MAXLIN,
     9MAXLOP,MAXSPL,MAXTAB,MAXWRD,MDISK ,MIDAPP,MIDCHA
      COMMON/RNOFIV/MINLVL,MINTOP,MOVBAC,MRGFAR,MRGLFT,
     1MRGRIT,MRGTOP,MRKAMP,MRKBAC,MRKBAR,MRKCAR,MRKDOL,
     2MRKDOT,MRKEFN,MRKEXC,MRKFTN,MRKLES,MRKNDX,MRKNUM,
     3MRKREF,MRKSBX,MRKSEM,MRKSUB,MRKSUP,MRKTTL,MRKTXT,
     4MRKUND,MSTLST,NDISK ,NDXDSK,NDXFOU,NDXHOW,NDXKNT,
     5NDXMAK,NDXONE,NDXOPN,NDXTHR,NDXTWO,NEEDED,NEWCHA,
     6NEWPAG,NOTFIL,NOTIND,NOTKLM,NOTLFT,NOTMNS,NOTONE,
     7NOTRIT,NOTSEM,NOTSKP,NOTSPC,NOTTHR,NOTTST,NOTTWO,
     8NOWBAR,NOWFTN,NOWIND,NOWLFT,NOWLST,NOWOFF,NOWPAG,
     9NOWPHW,NOWRIT,NOWSEC,NOWSHW,NOWSKP,NOWSPH,NOWSUB
      COMMON/RNOSIX/NOWTST,NULTTL,NUMFTN,NXTFIG,NXTHDR,
     1NXTLST,NXTLVL,NXTONE,NXTPAG,NXTSUB,KNDOUT,LNGWRK,
     2KAPFTN,KOFFST,IRECRD,KNTNDX,INIPAG,INIHIA,MAGNFY,
     3INIHIB,IFHALF,KTRMNL,ITTLLO,ISUBLO,LNGTOP,MAGFNT,
     4ITTLHI,ISUBHI,IFINDX,IXTRSS,JXTRSS,KXTRSS,MAGSPC,
     5MXTRSS,NXTRSS,IFORMR,JTRMNL,IFNREF,IFNNUM,KMPPAG,
     6KMPLIN,KMPCLM,KMPVAL,INICLM,MFNGAP,NFNGAP,MAGSAV,
     7MAGSHD,MAGHIH,MRKMAG,LMTSHD,LNGSHD,LFTSHD,IRISHD,
     8IHISHD,ILOSHD,KNTSHD,LFTSGN,IRISGN,NGLSHD,NETNGL,
     9NETSEP,NETWID,NETOFF,NETKNT,KNTEDT,LMTEDT,LMTBIG,
     1LNGBIG,NGLBIG,KNTBIG,NXTSKP,JBORDR,INIMAG,INIOBJ,
     2IBORDR
      COMMON/RNOEIG/INDLST(10)  ,KMDARG(250) ,KMDBRK(250) ,
     1 KNDLVL(6)   ,KNDTTL(16)  ,LOCTAB(32)  ,LSTMRG(10)  ,
     2 LSTRIT(10)  ,LSTSKP(10)  ,LSTSPC(10)  ,LSTTTL(80)  ,
     3 LSTTYP(10)  ,LSTVAL(10)  ,MCHPNT(1300),MSKBGN(300) ,
     4 MSKCHA(200) ,MSKFNR(200) ,MSKFTN(200) ,MSKMID(200) ,
     5 MSKTTL(450) ,NARGMT(44)  ,NBEGIN(19)  ,NMINUS(32)  ,
     6 NOTPNT(1300),NUMLVL(6)   ,NUMNDX(300) ,NUMTTL(11)  ,
     7 NVALUE(32)  ,NXTCMD(81)  ,NXTPNT(12)  ,NXTUNT(4)   ,
     8 MSKWRK(200) ,MTYSTR(4)   ,MAGEDT(50)
      COMMON/RNONIN/LTRAMP,LTRBAC,LTRBAR,LTRCAR,LTRCOM,
     1LTRDOL,LTRDOT,LTREFN,LTREXC,LTRFNC,LTRLES,
     2LTRMNS,LTRNDX,LTRNOW,LTRNUM,LTRPLS,LTRQUO,LTRRUL,
     3LTRSBX,LTRSEM,LTRSPA,LTRSUB,LTRSUP,LTRTAB,
     4LTRPUT,LTRTXT,LTRUND,LTR1ST,LTRMAG
      COMMON/RNOTEN/LTRABC(26)  ,LTRAPP(9)   ,LTRBGN(300) ,
     1 LTRCPT(8)   ,LTRCLS(10)  ,LTRCOD(70)  ,LTRDGT(10)  ,
     2 LTRFLG(18)  ,LTRFTN(200) ,LTRIND(5)   ,LTRLST(10,6),
     3 LTRMID(200) ,LTRONL(26)  ,LTRONU(26)  ,LTROPN(10)  ,
     4 LTRPAG(5)   ,LTRREF(4)   ,LTRSPL(200) ,LTRTWO(4)   ,
     5 LTRTYP(8)   ,LTRWRK(200) ,LWRABC(26)  ,LWRAPP(9)   ,
     6 LWRCHA(8)   ,LWRIND(5)   ,LWRONL(26)  ,LWRONU(26)  ,
     7 LWRTYP(8)   ,LTRTTL(450) ,LTRCHA(200) ,LTRFNR(200) ,
     8 LTRSHD(50)  ,LTRBIG(50)
C
C     DETERMINE EXTRA LINES FOR SUPER OR SUBSCRIPTS
      IXTRSS=0
      JXTRSS=0
      KXTRSS=0
      IF(KTRMNL.NE.0)GO TO 5
      IF(LNGMID.LE.0)GO TO 5
      DO 1 I=1,LNGMID
      MSKBIT=MSKMID(I)
      IF(MSKBIT.EQ.0)GO TO 1
      CALL RNOUNP(4,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 1
      IXTRSS=1
      GO TO 2
    1 CONTINUE
    2 DO 3 I=1,LNGMID
      MSKBIT=MSKMID(I)
      IF(MSKBIT.EQ.0)GO TO 3
      CALL RNOUNP(5,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 3
      JXTRSS=1
      GO TO 4
    3 CONTINUE
    4 KXTRSS=JXTRSS
      IF(IFHALF.LE.0)KXTRSS=IXTRSS+JXTRSS
    5 CONTINUE
C
C     DETERMINE WHAT TO DO THIS TIME.
      IF(MASTER.LE.0)GO TO 12
      IF(MASTER.EQ.5)GO TO 12
      IF(MASTER.NE.3)GO TO 6
      IF(KNTTOP.LT.0)GO TO 180
    6 ITLSPA=0
      ITLNXT=0
      IREVRS=1
      IF(LNGMID.GT.0)GO TO 12
    7 IF(MASTER.EQ.1)GO TO 180
      IF(MASTER.EQ.6)GO TO 180
      IF(MASTER.EQ.3)GO TO 11
      IF(JDFRFG.LE.0)GO TO 8
      IF(NXTFIG.GT.0)NXTFIG=NXTFIG+ISPACE
      NXTFIG=NXTFIG+JDFRFG
      JDFRFG=0
    8 IF(NXTFIG.GT.0)GO TO 9
      IDFRPG=IDFRPG+JDFRPG
      JDFRPG=0
      IF(IDFRPG.LE.0)GO TO 11
      IF(IFNRDY.LE.0)GO TO 10
      IF(IDEFER.GT.0)GO TO 128
      GO TO 28
    9 IF(IFNRDY.LE.0)GO TO 10
      IF(IDEFER.GT.0)GO TO 127
      GO TO 28
   10 IF(MASTER.NE.2)GO TO 128
      IF(NXTFIG.GT.0)GO TO 127
      GO TO 130
   11 IF(IFNRDY.LE.0)GO TO 180
      IF(IDEFER.GT.0)GO TO 180
      IF(IDEFER.LT.-4)GO TO 28
      IF(KNTTOP.LT.0)GO TO 28
      IF(NEWPAG.EQ.0)NEWPAG=1
      GO TO 28
C
C     STORE FOOTNOTE TEXT IN SCRATCH FILE
   12 IF(IFNOTE.EQ.0)GO TO 28
      IF(IFNTTL.EQ.0)IFORMR=0
      IF(ISKIP.LE.0)GO TO 13
      IF(IXTRSS.NE.0)ISKIP=ISKIP-1
      IF(IFORMR.NE.0)ISKIP=ISKIP-1
   13 IF(ISKIP.LT.0)ISKIP=0
      IF(ISKIP.GT.999)ISKIP=999
      IFORMR=JXTRSS
      IF(LNGMID.GT.0)GO TO 14
      LNGMID=0
   14 IF(IFNOPN.GT.0)GO TO 15
      IF(JFNOPN.GT.0)GO TO 23
      IF(IFNOPN.LT.0)GO TO 22
      IFNOPN=1
      IFNRIT=0
      IFNRED=0
      IFNBGN=0
      CALL RNOFIL(1,1,KDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
   15 IF(LINFIG.LE.0)GO TO 16
      IF(NOWBAR.NE.0)IFABAR=NOWBAR
   16 IF(ISKIP.LE.0)GO TO 18
      IF(ISKIP.GT.999)ISKIP=999
C     FIRST ITEM IN RECORD
C     = 1, INDEX LINE FOLLOWS
C     = 2, ORDINARY PRINTING LINE FOLLOWS
C     = 3, DESCRIPTION OF SKIPPED LINE
      I=3
      J=INIBAR
      IF(IFABAR.EQ.0)J=0
      WRITE(KDISK,17)I,ISKIP,LFTOFF,IRTOFF,J
   17 FORMAT(5I3,6H  0  0)
      IFNTTL=IFNTTL+ISKIP
      IFNRIT=IFNRIT+1
   18 IFNRIT=IFNRIT+1
      IFNTTL=IFNTTL+IXTRSS+JXTRSS+1
      IF(LNGFTN.LE.0)IFNRDY=IFNTTL
      IF(LNGFTN.LE.0)IFNBGN=IFNRIT
      I=2
      WRITE(KDISK,19)I,LNGMID,LFTOFF,IRTOFF,IFABAR,IXTRSS,JXTRSS
   19 FORMAT(7I3)
      IF(LNGMID.EQ.0)GO TO 26
      WRITE(KDISK,20)(LTRMID(I),I=1,LNGMID)
      WRITE(KDISK,21)(MSKMID(I),I=1,LNGMID)
   20 FORMAT(300A1)
   21 FORMAT(24I3)
      GO TO 26
   22 JFNOPN=1
      JFNRIT=0
      JFNRED=0
      JFNBGN=0
      CALL RNOFIL(2,1,LDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
   23 IF(LINFIG.LE.0)GO TO 24
      IF(NOWBAR.NE.0)IFABAR=NOWBAR
   24 IF(ISKIP.LE.0)GO TO 25
      IF(ISKIP.GT.999)ISKIP=999
      I=3
      J=INIBAR
      IF(IFABAR.EQ.0)J=0
      WRITE(LDISK,17)I,ISKIP,LFTOFF,IRTOFF,J
      IFNTTL=IFNTTL+ISKIP
      JFNRIT=JFNRIT+1
   25 JFNRIT=JFNRIT+1
      IFNTTL=IFNTTL+IXTRSS+JXTRSS+1
      IF(LNGFTN.LE.0)IFNRDY=IFNTTL
      IF(LNGFTN.LE.0)JFNBGN=JFNRIT
      I=2
      WRITE(LDISK,19)I,LNGMID,LFTOFF,IRTOFF,IFABAR,IXTRSS,JXTRSS
      IF(LNGMID.EQ.0)GO TO 26
      WRITE(LDISK,20)(LTRMID(I),I=1,LNGMID)
      WRITE(LDISK,21)(MSKMID(I),I=1,LNGMID)
   26 INIBAR=0
      IF(NOWBAR.NE.0)INIBAR=IFABAR
      IFABAR=0
      LNGMID=0
      IF(LINFIG.LE.0)GO TO 27
      LINFIG=LINFIG-1
      ISKIP=0
      IF(LINFIG.GT.0)GO TO 12
   27 ISKIP=ISPACE
      IF(KDFRFG.EQ.0)GO TO 178
      LINFIG=KDFRFG
      KDFRFG=0
      GO TO 12
C
C     DISCARD SKIPPED LINES AT START OF FOOTNOTE
   28 IF(IFNRDY.LE.0)GO TO 30
      IF(IDEFER.GT.0)GO TO 30
      IF(IFNHAV.EQ.0)GO TO 30
      IF(IRECRD.NE.3)GO TO 30
      IF(JFNOPN.LT.0)GO TO 29
      IF(IFNRED.GE.IFNBGN)GO TO 30
      IFNHAV=0
      IFNRED=IFNRED+1
      IFNTTL=IFNTTL-NXTFTN
      IFNRDY=IFNRDY-NXTFTN
      GO TO 30
   29 IF(JFNRED.GE.JFNBGN)GO TO 30
      IFNHAV=0
      JFNRED=JFNRED+1
      IFNTTL=IFNTTL-NXTFTN
      IFNRDY=IFNRDY-NXTFTN
C
C     DETERMINE IF FOOTNOTE SHOULD BE AT BOTTOM OF PAGE
   30 IF(MASTER.EQ.2)GO TO 36
      IF(NEWPAG.GT.0)GO TO 36
      IF(NEWPAG.NE.0)GO TO 39
      IF(IFPAGE.LE.0)GO TO 32
      IF(KTRMNL.NE.0)GO TO 31
      I=JXTRSS
      IF(IFHALF.LE.0)I=I+IXTRSS
      IF((LOCPAG+I).GE.LNGPAG)GO TO 36
      GO TO 32
   31 IF(LOCPAG.GE.LNGPAG)GO TO 36
   32 IF(IFNRDY.LE.0)GO TO 40
      IF(IDEFER.GT.0)GO TO 40
      IF(LINFIG.LE.0)GO TO 33
      I=KFNGAP
      GO TO 34
   33 I=ISPACE+KFNGAP
      IF(KTRMNL.NE.0)GO TO 34
      IF(IFHALF.LE.0)I=I+IXTRSS
      IF(ISPACE.EQ.0)I=I+JXTRSS
   34 IF(IFPAGE.EQ.0)GO TO 40
      IF((LOCPAG+IFNRDY+IFNGAP+I).LT.LNGPAG)GO TO 40
      IF(IFPAGE.LE.0)GO TO 41
      IF(KTRMNL.NE.0)GO TO 35
      IF(IFNHAV.EQ.0)GO TO 35
      IF((LOCPAG+IFNGAP+KNDLIN+MXTRSS+NXTRSS).GE.LNGPAG)GO TO 40
      GO TO 41
   35 IF((LOCPAG+IFNGAP+KNDLIN).GE.LNGPAG)GO TO 40
      GO TO 41
   36 IF(IFNRDY.LE.0)GO TO 126
      IF(IDEFER.GT.0)GO TO 126
      IF(NEWPAG.LT.0)GO TO 39
      IF(IFPAGE.LE.0)GO TO 41
      IF(KTRMNL.NE.0)GO TO 37
      IF(IFNHAV.EQ.0)GO TO 37
      IF((LOCPAG+IFNGAP+KNDLIN+MXTRSS+NXTRSS).LT.LNGPAG)GO TO 41
      GO TO 38
   37 IF((LOCPAG+IFNGAP+KNDLIN).LT.LNGPAG)GO TO 41
   38 IF(MASTER.EQ.3)GO TO 126
   39 IF(IDEFER.EQ.-2)IDEFER=-3
      IF(IDEFER.EQ.-6)IDEFER=-7
      GO TO 127
   40 IF(IDEFER.EQ.-4)GO TO 42
      IF(IDEFER.EQ.-8)GO TO 42
      IF(IDEFER.EQ.-3)GO TO 42
      IF(IDEFER.EQ.-7)GO TO 42
      IF(IDEFER.EQ.-2)IDEFER=-3
      IF(IDEFER.EQ.-6)IDEFER=-7
      IF(KNTTOP.LT.0)GO TO 127
      GO TO 167
   41 IF(IDEFER.EQ.-3)GO TO 42
      IF(IDEFER.EQ.-7)GO TO 42
      IF(IDEFER.EQ.-2)IDEFER=-3
      IF(IDEFER.EQ.-6)IDEFER=-7
      IF(KNTTOP.LT.0)GO TO 127
      IF(IDEFER.EQ.0)GO TO 42
      IF(NEWPAG.NE.0)GO TO 127
      GO TO 42
C
C     GENERATE BLANK LINES BEFORE FOOTNOTE
   42 IF(IDEFER.GE.0)GO TO 49
      I=-IDEFER
      GO TO(48,43,45,58,47,44,46,58),I
   43 IDEFER=-3
      IF(KNTTOP.LT.0)GO TO 42
      GO TO 127
   44 IDEFER=-7
      IF(KNTTOP.LT.0)GO TO 42
      GO TO 127
   45 IDEFER=-4
      KAPFTN=IFNGAP
      GO TO 51
   46 IDEFER=-8
      KAPFTN=IFNGAP
      GO TO 51
   47 IDEFER=-8
      KAPFTN=IFNGAP+KNDLIN
      GO TO 50
   48 IDEFER=-4
   49 KAPFTN=LNGPAG-LOCPAG-IFNRDY
      IF(KAPFTN.GE.(IFNGAP+KNDLIN))GO TO 51
      KAPFTN=IFNGAP+KNDLIN
   50 IF(KTRMNL.NE.0)GO TO 52
      IF(KNDLIN.LE.KFNGAP)GO TO 51
      IF(IFHALF.LT.0)KAPFTN=KAPFTN-1
   51 KNDOUT=6
      CALL RNOLIN
   52 IF(KAPFTN.LE.0)GO TO 57
      LNGWRK=0
      KAPFTN=KAPFTN-1
      IF(KAPFTN.NE.JFNGAP)GO TO 56
      IF(LNGFNR.EQ.0)GO TO 56
      IF(LNGFNR.GT.0)GO TO 54
      DO 53 I=1,MRGFAR
      IF(LNGWRK.GE.LMTWRK)GO TO 56
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRFNR(1)
      MSKWRK(LNGWRK)=MSKFNR(1)
   53 CONTINUE
      GO TO 56
   54 DO 55 I=1,LNGFNR
      IF(LNGWRK.GE.LMTWRK)GO TO 56
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRFNR(I)
      MSKWRK(LNGWRK)=MSKFNR(I)
   55 CONTINUE
   56 KNDOUT=4
      CALL RNOLIN
      GO TO 52
   57 IF(KTRMNL.NE.0)GO TO 58
      KNDOUT=6
      CALL RNOLIN
C
C     GENERATE FOOTNOTE
   58 KNDLIN=ISPACE+KFNGAP
      IF(JFNOPN.LT.0)GO TO 81
      IF(IFNOPN.GE.0)GO TO 123
   59 IF(IFNRED.GE.IFNBGN)GO TO 80
      IFNRED=IFNRED+1
      IF(IFNHAV.NE.0)GO TO 60
      READ(KDISK,19)IRECRD,NXTFTN,ILFFTN,IRTFTN,IBRFTN,
     1MXTRSS,NXTRSS
   60 GO TO(61,76,72),IRECRD
   61 IF(NDXKNT.NE.0)GO TO 62
      CALL RNOFIL(5,1,NDXDSK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
   62 NDXKNT=NDXKNT+1
      READ(KDISK,63)KNTNDX,NDXMID,NDXSKP
   63 FORMAT(10I5)
      IF(NDXMID.LE.0)GO TO 68
      NDXMID=LOCPAG+1
      IF(NDXSKP.GT.0)NDXMID=NDXMID+NDXSKP
      IF(IFPAGE.LE.0)GO TO 68
      IF(NDXMID.LE.LNGPAG)GO TO 68
      NDXLOC=KNTPAG+1
      IF(NEWCHA.EQ.0)GO TO 65
      IF(ISECTN.GT.0)GO TO 64
      NDXSEC=IAPNDX
      NDXSHW=KNDAPP
      GO TO 65
   64 NDXSEC=ICHAPT
      NDXSHW=KNDCHA
   65 IF(ISUBPG.EQ.0)GO TO 66
      NDXPAG=NXTPAG
      NDXPHW=KNDPAG
      IF(ISUBPG.GT.0)GO TO 66
      NDXSUB=0
      GO TO 67
   66 NDXSUB=NXTSUB
   67 NDXSPH=KNDSUB
      GO TO 69
   68 NDXLOC=KNTPAG
      NDXSEC=NOWSEC
      NDXSHW=NOWSHW
      NDXPAG=NOWPAG
      NDXPHW=NOWPHW
      NDXSUB=NOWSUB
      NDXSPH=NOWSPH
   69 WRITE(NDXDSK,70)NDXLOC,NDXSEC,NDXSHW,NDXPAG,NDXPHW,
     1NDXSUB,NDXSPH,KNTNDX
   70 FORMAT(10I5)
      READ(KDISK,71)(NUMNDX(I),I=1,KNTNDX)
      WRITE(NDXDSK,71)(NUMNDX(I),I=1,KNTNDX)
   71 FORMAT(24I3)
      IFNHAV=0
      GO TO 59
   72 IFNHAV=0
      IFNTTL=IFNTTL-NXTFTN
      IFNRDY=IFNRDY-NXTFTN
      IF(IFPAGE.LE.0)GO TO 73
      IF((LOCPAG+NXTFTN).GE.LNGPAG)GO TO 123
   73 J=ILFFTN
      IF(LFTRIT.NE.0)J=IRTFTN
      IF(IBRFTN.NE.0)IBRFTN=J-2
      KOFFST=IOFFST
      IOFFST=J
      J=IBRFTN
      IBRFTN=INIBAR
      INIBAR=J
      NEEDED=NXTFTN
   74 KNDOUT=2
      CALL RNOLIN
      NEEDED=NEEDED-1
      IF(NEEDED.GT.0)GO TO 74
      IF(KTRMNL.NE.0)GO TO 75
      KNDOUT=6
      CALL RNOLIN
   75 IOFFST=KOFFST
      J=IBRFTN
      IBRFTN=INIBAR
      INIBAR=J
      GO TO 79
   76 IFNHAV=0
      IFNTTL=IFNTTL-MXTRSS-NXTRSS-1
      IFNRDY=IFNRDY-MXTRSS-NXTRSS-1
      IF(NXTFTN.EQ.0)GO TO 77
      READ(KDISK,20)(LTRWRK(I),I=1,NXTFTN)
      READ(KDISK,21)(MSKWRK(I),I=1,NXTFTN)
   77 LNGWRK=NXTFTN
      J=ILFFTN
      IF(LFTRIT.NE.0)J=IRTFTN
      IF(IBRFTN.NE.0)IBRFTN=J-2
      KOFFST=IOFFST
      IOFFST=J
      J=IBRFTN
      IBRFTN=INIBAR
      INIBAR=J
      KNDOUT=5
      CALL RNOLIN
      IF(KTRMNL.NE.0)GO TO 78
      IF(IFHALF.GE.0)GO TO 78
      KNDOUT=6
      CALL RNOLIN
   78 IOFFST=KOFFST
      J=IBRFTN
      IBRFTN=INIBAR
      INIBAR=J
   79 IF(IFPAGE.LT.0)IFPAGE=1
   80 IF(IFNRED.LT.IFNRIT)GO TO 100
      IF(IFNHAV.NE.0)GO TO 123
      CALL RNOFIL(1,6,KDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      IFNOPN=0
      IFNRIT=0
      IFNBGN=0
      IFNRED=0
      GO TO 100
   81 IF(JFNRED.GE.JFNBGN)GO TO 99
      JFNRED=JFNRED+1
      IF(IFNHAV.NE.0)GO TO 82
      READ(LDISK,19)IRECRD,NXTFTN,ILFFTN,IRTFTN,IBRFTN,
     1MXTRSS,NXTRSS
   82 GO TO(83,95,91),IRECRD
   83 IF(NDXKNT.NE.0)GO TO 84
      CALL RNOFIL(5,1,NDXDSK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
   84 NDXKNT=NDXKNT+1
      READ(LDISK,63)KNTNDX,NDXMID,NDXSKP
      IF(NDXMID.LE.0)GO TO 89
      NDXMID=LOCPAG+1
      IF(NDXSKP.GT.0)NDXMID=NDXMID+NDXSKP
      IF(IFPAGE.LE.0)GO TO 89
      IF(NDXMID.LE.LNGPAG)GO TO 89
      NDXLOC=KNTPAG+1
      IF(NEWCHA.EQ.0)GO TO 86
      IF(ISECTN.GT.0)GO TO 85
      NDXSEC=IAPNDX
      NDXSHW=KNDAPP
      GO TO 86
   85 NDXSEC=ICHAPT
      NDXSHW=KNDCHA
   86 IF(ISUBPG.EQ.0)GO TO 87
      NDXPAG=NXTPAG
      NDXPHW=KNDPAG
      IF(ISUBPG.GT.0)GO TO 87
      NDXSUB=0
      GO TO 88
   87 NDXSUB=NXTSUB
   88 NDXSPH=KNDSUB
      GO TO 90
   89 NDXLOC=KNTPAG
      NDXSEC=NOWSEC
      NDXSHW=NOWSHW
      NDXPAG=NOWPAG
      NDXPHW=NOWPHW
      NDXSUB=NOWSUB
      NDXSPH=NOWSPH
   90 WRITE(NDXDSK,70)NDXLOC,NDXSEC,NDXSHW,NDXPAG,NDXPHW,
     1NDXSUB,NDXSPH,KNTNDX
      READ(LDISK,71)(NUMNDX(I),I=1,KNTNDX)
      WRITE(NDXDSK,71)(NUMNDX(I),I=1,KNTNDX)
      IFNHAV=0
      GO TO 81
   91 IFNHAV=0
      IFNTTL=IFNTTL-NXTFTN
      IFNRDY=IFNRDY-NXTFTN
      IF(IFPAGE.LE.0)GO TO 92
      IF((LOCPAG+NXTFTN).GE.LNGPAG)GO TO 123
   92 J=ILFFTN
      IF(LFTRIT.NE.0)J=IRTFTN
      IF(IBRFTN.NE.0)IBRFTN=J-2
      KOFFST=IOFFST
      IOFFST=J
      J=IBRFTN
      IBRFTN=INIBAR
      INIBAR=J
      NEEDED=NXTFTN
   93 KNDOUT=2
      CALL RNOLIN
      NEEDED=NEEDED-1
      IF(NEEDED.GT.0)GO TO 93
      IF(KTRMNL.NE.0)GO TO 94
      KNDOUT=6
      CALL RNOLIN
   94 IOFFST=KOFFST
      J=IBRFTN
      IBRFTN=INIBAR
      INIBAR=J
      GO TO 98
   95 IFNHAV=0
      IFNTTL=IFNTTL-MXTRSS-NXTRSS-1
      IFNRDY=IFNRDY-MXTRSS-NXTRSS-1
      IF(NXTFTN.EQ.0)GO TO 96
      READ(LDISK,20)(LTRWRK(I),I=1,NXTFTN)
      READ(LDISK,21)(MSKWRK(I),I=1,NXTFTN)
   96 LNGWRK=NXTFTN
      J=ILFFTN
      IF(LFTRIT.NE.0)J=IRTFTN
      IF(IBRFTN.NE.0)IBRFTN=J-2
      KOFFST=IOFFST
      IOFFST=J
      J=IBRFTN
      IBRFTN=INIBAR
      INIBAR=J
      KNDOUT=5
      CALL RNOLIN
      IF(KTRMNL.NE.0)GO TO 97
      IF(IFHALF.GE.0)GO TO 97
      KNDOUT=6
      CALL RNOLIN
   97 IOFFST=KOFFST
      J=IBRFTN
      IBRFTN=INIBAR
      INIBAR=J
   98 IF(IFPAGE.LT.0)IFPAGE=1
   99 IF(JFNRED.LT.JFNRIT)GO TO 100
      IF(IFNHAV.NE.0)GO TO 123
      CALL RNOFIL(2,6,LDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      JFNOPN=0
      JFNRIT=0
      JFNBGN=0
      JFNRED=0
  100 IF(IFNHAV.NE.0)GO TO 120
      IF(IFNOPN.LT.0)GO TO 101
      IF(JFNOPN.LT.0)GO TO 111
      IF(JFNOPN.GT.0)GO TO 110
      IF(IFNOPN.EQ.0)GO TO 120
      CALL RNOFIL(1,2,KDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      CALL RNOFIL(1,4,KDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      IFNOPN=-1
      IFNRED=0
  101 READ(KDISK,19)IRECRD,NXTFTN,ILFFTN,IRTFTN,IBRFTN,
     1MXTRSS,NXTRSS
      IF(IRECRD.NE.1)GO TO 109
      IFNRED=IFNRED+1
      IF(NDXKNT.NE.0)GO TO 102
      CALL RNOFIL(5,1,NDXDSK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
  102 NDXKNT=NDXKNT+1
      READ(KDISK,63)KNTNDX,NDXMID,NDXSKP
      IF(NDXMID.LE.0)GO TO 107
      NDXMID=LOCPAG+1
      IF(NDXSKP.GT.0)NDXMID=NDXMID+NDXSKP
      IF(IFPAGE.LE.0)GO TO 107
      IF(NDXMID.LE.LNGPAG)GO TO 107
      NDXLOC=KNTPAG+1
      IF(NEWCHA.EQ.0)GO TO 104
      IF(ISECTN.GT.0)GO TO 103
      NDXSEC=IAPNDX
      NDXSHW=KNDAPP
      GO TO 104
  103 NDXSEC=ICHAPT
      NDXSHW=KNDCHA
  104 IF(ISUBPG.EQ.0)GO TO 105
      NDXPAG=NXTPAG
      NDXPHW=KNDPAG
      IF(ISUBPG.GT.0)GO TO 105
      NDXSUB=0
      GO TO 106
  105 NDXSUB=NXTSUB
  106 NDXSPH=KNDSUB
      GO TO 108
  107 NDXLOC=KNTPAG
      NDXSEC=NOWSEC
      NDXSHW=NOWSHW
      NDXPAG=NOWPAG
      NDXPHW=NOWPHW
      NDXSUB=NOWSUB
      NDXSPH=NOWSPH
  108 WRITE(NDXDSK,70)NDXLOC,NDXSEC,NDXSHW,NDXPAG,NDXPHW,
     1NDXSUB,NDXSPH,KNTNDX
      READ(KDISK,71)(NUMNDX(I),I=1,KNTNDX)
      WRITE(NDXDSK,71)(NUMNDX(I),I=1,KNTNDX)
      IF(IFNRED.LT.IFNBGN)GO TO 101
      IFNHAV=0
      GO TO 80
  109 IFNHAV=1
      GO TO 120
  110 CALL RNOFIL(2,2,LDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      CALL RNOFIL(2,4,LDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      JFNOPN=-1
      JFNRED=0
  111 READ(LDISK,19)IRECRD,NXTFTN,ILFFTN,IRTFTN,IBRFTN,
     1MXTRSS,NXTRSS
      IF(IRECRD.NE.1)GO TO 119
      JFNRED=JFNRED+1
      IF(NDXKNT.NE.0)GO TO 112
      CALL RNOFIL(5,1,NDXDSK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
  112 NDXKNT=NDXKNT+1
      READ(LDISK,63)KNTNDX,NDXMID,NDXSKP
      IF(NDXMID.LE.0)GO TO 117
      NDXMID=LOCPAG+1
      IF(NDXSKP.GT.0)NDXMID=NDXMID+NDXSKP
      IF(IFPAGE.LE.0)GO TO 117
      IF(NDXMID.LE.LNGPAG)GO TO 117
      NDXLOC=KNTPAG+1
      IF(NEWCHA.EQ.0)GO TO 114
      IF(ISECTN.GT.0)GO TO 113
      NDXSEC=IAPNDX
      NDXSHW=KNDAPP
      GO TO 114
  113 NDXSEC=ICHAPT
      NDXSHW=KNDCHA
  114 IF(ISUBPG.EQ.0)GO TO 115
      NDXPAG=NXTPAG
      NDXPHW=KNDPAG
      IF(ISUBPG.GT.0)GO TO 115
      NDXSUB=0
      GO TO 116
  115 NDXSUB=NXTSUB
  116 NDXSPH=KNDSUB
      GO TO 118
  117 NDXLOC=KNTPAG
      NDXSEC=NOWSEC
      NDXSHW=NOWSHW
      NDXPAG=NOWPAG
      NDXPHW=NOWPHW
      NDXSUB=NOWSUB
      NDXSPH=NOWSPH
  118 WRITE(NDXDSK,70)NDXLOC,NDXSEC,NDXSHW,NDXPAG,NDXPHW,
     1NDXSUB,NDXSPH,KNTNDX
      READ(LDISK,71)(NUMNDX(I),I=1,KNTNDX)
      WRITE(NDXDSK,71)(NUMNDX(I),I=1,KNTNDX)
      IF(JFNRED.LT.JFNBGN)GO TO 111
      IFNHAV=0
      GO TO 99
  119 IFNHAV=1
  120 IF(IFPAGE.LE.0)GO TO 122
      IF(KTRMNL.NE.0)GO TO 121
      IF(IFNHAV.LE.0)GO TO 121
      IF((LOCPAG+MXTRSS+NXTRSS).GE.LNGPAG)GO TO 123
      GO TO 122
  121 IF(LOCPAG.GE.LNGPAG)GO TO 123
  122 IF(IFNRDY.GT.0)GO TO 58
  123 IF(MASTER.LE.0)GO TO 127
      IF(MASTER.EQ.5)GO TO 127
      IF(LNGMID.GT.0)GO TO 127
      IF(MASTER.EQ.3)GO TO 125
      IF(JDFRFG.LE.0)GO TO 124
      IF(NXTFIG.GT.0)NXTFIG=NXTFIG+ISPACE
      NXTFIG=NXTFIG+JDFRFG
      JDFRFG=0
  124 IF(NXTFIG.GT.0)GO TO 127
      IF(LINFIG.GT.0)GO TO 127
      IF(IFNRDY.LE.0)GO TO 125
      IF(IDEFER.GT.0)GO TO 125
      GO TO 127
  125 IF(IDFRPG.GT.0)GO TO 180
      ISKIP=LFNGAP
      IF(ISKIP.LT.ISPACE)ISKIP=ISPACE
      GO TO 180
C
C     TEST IF A NEW PAGE IS NEEDED
  126 IF(MASTER.LE.0)GO TO 127
      IF(LNGMID.GT.0)GO TO 127
      GO TO 180
C
C     GENERATE TITLE LINE
  127 CALL RNOBOT
      CALL RNOTOP
C
C     GENERATE DEFERRED PAGE
      IF(IDFRPG.LE.0)GO TO 132
  128 IDFRPG=IDFRPG-1
      GO TO 127
C
C     GENERATE DEFERRED PAGE IF PRINT INDEX OR PRINT
C     FOOTNOTE IS ACTIVE BUT NOTHING ELSE FOLLOWS
  129 CALL RNOBOT
      CALL RNOTOP
      IF(IDFRPG.LE.0)GO TO 131
  130 IDFRPG=IDFRPG-1
      GO TO 129
  131 NEWPAG=1
      GO TO 132
C
C     GENERATE DEFERRED FIGURE
  132 IF(NXTFIG.LE.0)GO TO 137
      IDFRFG=ISPACE
  133 INIBAR=NOWBAR
      KNDOUT=2
      CALL RNOLIN
      KNDLIN=KFNGAP
      IF(IFPAGE.LT.0)IFPAGE=1
      NXTFIG=NXTFIG-1
      IF(IFPAGE.LE.0)GO TO 134
      IF(LOCPAG.LT.LNGPAG)GO TO 134
      IF(NXTFIG.GT.0)GO TO 127
      IF(LINFIG.GT.0)GO TO 127
      IF(MASTER.LE.0)GO TO 127
      IF(MASTER.EQ.5)GO TO 127
      IF(LNGMID.GT.0)GO TO 127
      IF(NEWCHA.NE.0)GO TO 127
      GO TO 137
  134 IF(NXTFIG.GT.0)GO TO 133
      IF(LINFIG.GT.0)GO TO 135
      IF(MASTER.LE.0)GO TO 135
      IF(MASTER.EQ.5)GO TO 135
      IF(LNGMID.GT.0)GO TO 135
      IF(NEWCHA.NE.0)GO TO 135
      GO TO 137
  135 IF(IFPAGE.LE.0)GO TO 136
      IF((LOCPAG+IDFRFG).GE.LNGPAG)GO TO 127
  136 NXTFIG=IDFRFG
      IDFRFG=0
      IF(NXTFIG.GT.0)GO TO 133
  137 CONTINUE
C
C     GENERATE START OF NEW CHAPTER
      IF(NEWCHA.EQ.0)GO TO 160
      NEWCHA=LOCPAG
      INIBAR=NOWBAR
  138 IF(JSECTN.GT.0)GO TO 143
      IF(LOCPAG.LT.(INIAPP+NEWCHA))GO TO 145
      IF(LOCPAG.EQ.(INIAPP+NEWCHA))GO TO 139
      IF(LOCPAG.EQ.(INIAPP+MIDAPP+1+NEWCHA))GO TO 155
      IF(LOCPAG.GT.(INIAPP+1+MIDAPP+LSTAPP+NEWCHA))GO TO 159
      GO TO 144
  139 LNGWRK=9
      IF(INITAL.LT.0)GO TO 141
      IF(KAPITL.LT.0)GO TO 141
      DO 140 J=1,9
      LTRWRK(J)=LTRAPP(J)
  140 CONTINUE
      GO TO 150
  141 DO 142 J=1,9
      LTRWRK(J)=LWRAPP(J)
  142 CONTINUE
      GO TO 150
  143 IF(LOCPAG.LT.(INICHA+NEWCHA))GO TO 145
      IF(LOCPAG.EQ.(INICHA+NEWCHA))GO TO 146
      IF(LOCPAG.EQ.(INICHA+MIDCHA+1+NEWCHA))GO TO 155
      IF(LOCPAG.GT.(INICHA+1+MIDCHA+LSTCHA+NEWCHA))GO TO 159
  144 KNDOUT=2
      CALL RNOLIN
      GO TO 138
  145 KNDOUT=3
      CALL RNOLIN
      GO TO 138
  146 IF(INITAL.LT.0)GO TO 148
      IF(KAPITL.LT.0)GO TO 148
      LNGWRK=0
      DO 147 J=1,8
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRCPT(J)
  147 CONTINUE
      GO TO 150
  148 LNGWRK=0
      DO 149 J=1,8
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LWRCHA(J)
  149 CONTINUE
  150 CALL RNONUM(NOWSHW,NOWSEC,LTRWRK,LNGWRK,LMTWRK)
      K=LNGWRK
      LNGWRK=LNGWRK+((MRGFAR-LNGWRK)/2)
      IF(LNGWRK.GT.LMTWRK)LNGWRK=LMTWRK
      IF(K.GE.LNGWRK)GO TO 153
      J=LNGWRK
  151 LTRWRK(J)=LTRWRK(K)
      J=J-1
      K=K-1
      IF(K.GT.0)GO TO 151
  152 LTRWRK(J)=LTRSPA
      J=J-1
      IF(J.GT.0)GO TO 152
  153 DO 154 I=1,LNGWRK
      MSKWRK(I)=0
  154 CONTINUE
      KNDOUT=5
      CALL RNOLIN
      GO TO 138
  155 IF(LNGCHA.LE.0)GO TO 159
      NEEDED=((MRGFAR-LNGCHA)/2)
      LNGWRK=0
      DO 156 I=1,NEEDED
      IF(LNGWRK.GE.LMTWRK)GO TO 158
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRSPA
      MSKWRK(LNGWRK)=0
  156 CONTINUE
      DO 157 I=1,LNGCHA
      IF(LNGWRK.GE.LMTWRK)GO TO 158
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRCHA(I)
      MSKWRK(LNGWRK)=MSKCHA(I)
  157 CONTINUE
  158 KNDOUT=5
      CALL RNOLIN
      GO TO 138
  159 NEWCHA=0
      IF(IFPAGE.EQ.0)GO TO 160
      IFPAGE=1
      IF(LOCPAG.GE.LNGPAG)GO TO 127
C
C     TEST IF HAVE MORE THAN 1 PAGE OF FOOTNOTE
  160 IF(IFNRDY.LE.0)GO TO 166
      IF(IDEFER.GT.0)GO TO 166
      IF(IFPAGE.EQ.0)GO TO 162
      IF(KTRMNL.NE.0)GO TO 161
      IF(IFNHAV.EQ.0)GO TO 161
      IF((LOCPAG+IFNGAP+KNDLIN+MXTRSS+NXTRSS).GE.LNGPAG)GO TO 166
      GO TO 162
  161 IF((LOCPAG+IFNGAP+KNDLIN).GE.LNGPAG)GO TO 166
  162 I=KNDLIN
      IF(LINFIG.LE.0)GO TO 163
      IF(I.LT.KFNGAP)I=KFNGAP
      GO TO 164
  163 IF(I.LT.(ISPACE+KFNGAP))I=ISPACE+KFNGAP
  164 IF(IFPAGE.EQ.0)GO TO 166
      IF(KTRMNL.NE.0)GO TO 165
      I=I+JXTRSS
      IF(IFHALF.LE.0)I=I+IXTRSS
  165 IF((LOCPAG+IFNRDY+IFNGAP+I+IXTRSS+JXTRSS).GE.LNGPAG)GO TO 28
C
C     CANCEL A SKIP WHICH HAPPENS AT TOP OF PAGE
  166 IF(ISKIP.GT.0)GO TO 176
C
C     OUTPUT NEXT LINE ON PAGE
  167 IF(LINFIG.GT.0)GO TO 170
      IF(MASTER.LE.0)GO TO 168
      IF(MASTER.EQ.5)GO TO 168
      IF(LNGMID.LE.0)GO TO 177
  168 IF(ISKIP.GT.0)GO TO 169
      INIBAR=IFABAR
      KNDOUT=1
      CALL RNOLIN
      IF(NOWBAR.EQ.0)INIBAR=0
      IFABAR=0
      LNGMID=0
      GO TO 171
  169 IF(NOWBAR.EQ.0)INIBAR=0
      KNDOUT=1
      CALL RNOLIN
      LNGMID=0
      GO TO 171
  170 IF(ISKIP.GT.0)GO TO 169
      IF(NOWBAR.NE.0)IFABAR=NOWBAR
      INIBAR=IFABAR
      KNDOUT=2
      CALL RNOLIN
      IF(NOWBAR.EQ.0)INIBAR=0
      IFABAR=0
  171 KNDLIN=ISPACE+KFNGAP
      IF(IFPAGE.LT.0)IFPAGE=1
      IFNBGN=IFNRIT
      JFNBGN=JFNRIT
      IFNRDY=IFNTTL
      IF(LINFIG.GT.0)GO TO 173
      IF(ISKIP.LE.0)GO TO 172
      ISKIP=ISKIP-1
      GO TO 177
  172 ISKIP=ISPACE
      GO TO 177
  173 IF(ISKIP.LE.0)GO TO 174
      ISKIP=ISKIP-1
      GO TO 175
  174 ISKIP=0
      LINFIG=LINFIG-1
      IF(LINFIG.GT.0)GO TO 175
      ISKIP=ISPACE
      GO TO 177
  175 IF(IFPAGE.EQ.0)GO TO 170
      IF(LOCPAG.LT.LNGPAG)GO TO 170
      GO TO 127
  176 ISKIP=0
      IF(LINFIG.LE.0)GO TO 177
      INIBAR=NOWBAR
      GO TO 170
  177 IF(KDFRFG.EQ.0)GO TO 178
      LINFIG=KDFRFG
      KDFRFG=0
      GO TO 175
  178 IF(JDFRFG.LE.0)GO TO 179
      IF(NXTFIG.GT.0)NXTFIG=NXTFIG+ISPACE
      NXTFIG=NXTFIG+JDFRFG
      JDFRFG=0
  179 IDFRPG=IDFRPG+JDFRPG
      JDFRPG=0
      IF(IFNRDY.LE.0)GO TO 180
      IF(IDEFER.LT.0)GO TO 28
      IF(MASTER.EQ.2)GO TO 7
      IF(MASTER.EQ.3)GO TO 7
      IF(MASTER.EQ.4)GO TO 7
      GO TO 182
  180 IF(MASTER.EQ.3)GO TO 181
      IF(MASTER.EQ.4)GO TO 181
      GO TO 182
  181 CALL RNOBOT
  182 RETURN
      END
      SUBROUTINE RNOTOP
C     RENBR(/CONSTRUCT TOP OF PAGE)
C
C     DONALD E. BARTH, YALE SCHOOL OF MANAGEMENT
C
      COMMON/RNOONE/I     ,IAPNDX,IBRFTN,IBYTE ,ICENTR,
     1ICHAPT,IDEBUG,IDEFER,IDFILE,IDFRFG,IDFRPG,IDISK ,
     2IFABAR,IFAUTO,IFENCE,IFFILL,IFFLAG,IFHEAD,IFLIST,
     3IFLOOP,IFLSUB,IFNATO,IFNBGN,IFNFIL,IFNGAP,
     4IFNGSP,IFNHAV,IFNIBR,IFNICN,IFNIDF,IFNIFA,IFNIIN,
     5IFNILF,IFNIND,IFNIRT,IFNISP,IFNJCN,IFNJDF,IFNJFL,
     6IFNJST,IFNKCN,IFNKDF,IFNKLM,IFNLBR,IFNLBS,IFNLOF,
     7IFNLSP,IFNMBR,IFNMFR,IFNMLF,IFNMNS,IFNMRT,
     8IFNNBR,IFNNIN,IFNNLF,IFNNOF,IFNNOT,IFNNRT,IFNNSK,
     9IFNNTF,IFNNTL,IFNNTR,IFNNTS,IFNNTT,IFNNT1,IFNNT2
      COMMON/RNOTWO/IFNNT3,IFNOFF,IFNOPN,IFNOTE,IFNPIN,
     1IFNPRD,IFNPSK,IFNPTS,IFNRBS,IFNRDY,IFNRED,IFNRIT,
     2IFNROF,IFNTTL,IFNULS,IFNUMB,IFPAGE,IFRSUB,IFSPLC,
     3IGAPHI,IGAPLO,IGROUP,IMINUS,INDENT,INDFTN,INIALL,
     4INIAPP,INIBAR,INICHA,INIFRM,INILIN,ININDX,ININXT,
     5INISPA,INITAL,INNOTE,INTIND,INTLFT,INTRIT,INTRVL,
     6IOFFST,IPEROD,IPGSHO,IQUOTE,IRANGE,IREVRS,IRTBAS,
     7IRTFTN,IRTOFF,IRUNIN,ISECTN,ISKFTN,ISKIP ,ISPACE,
     8ISTART,ISUBPG,ITLALL,ITLLIN,ITLNXT,ITLSPA,ITRMNL,
     9ITTY  ,IULSPC,IVALUE,IWIZRD,J     ,JCENTR,JDFRFG
      COMMON/RNOTHR/JDFRPG,JDISK ,JFILL ,JFNBGN,JFNGAP,
     1JFNOPN,JFNRED,JFNRIT,JGROUP,JMINUS,JOFFST,JRANGE,
     2JSECTN,JSKIP ,JSTIFY,JTTY  ,JVALUE,K     ,KAPITL,
     3KASALL,KASFLG,KASLCL,KCENTR,KDFRFG,KDISK ,KFNGAP,
     4KLMFIL,KLMMNS,KMINUS,KNDAPP,KNDCHA,KNDFIL,KNDLFT,
     5KNDLIN,KNDPAG,KNDRIT,KNDSPL,KNDSUB,KNDTRN,KNTARG,
     6KNTCOD,KNTFTN,KNTFXD,KNTLIN,KNTLOP,KNTLVL,KNTPAG,
     7KNTPNT,KNTRST,KNTSHO,KNTSPC,KNTSPL,KNTTOP,KNTXTR,
     8KOMAND,KOMENT,KONECT,KPYBGN,KPYKAS,KPYMID,KPYPRT,
     9KRANGE,KSKIP ,KVALUE,LCLBAR,LCLNDX,LCLSUP,KAPNDX
      COMMON/RNOFOU/LDISK ,LENGTH,LEVEL0,LEVEL1,LEVEL3,
     1LEVEL4,LFNGAP,LFTBAS,ILFFTN,LFTOFF,LFTRIT,LINFIG,
     2LINSPL,LITERL,LMTBGN,LMTCHA,LMTCOD,LMTFNR,LMTKAS,
     3LMTLST,LMTLVL,LMTMID,LMTNDX,LMTTAB,LMTTTL,LMTUNT,
     4LMTWRK,LNGBGN,LNGBOT,LNGCHA,LNGFNR,LNGFTN,LNGMID,
     5NXTFTN,LNGPAG,LNGSPL,LNGSRC,LNGTRN,LNGTTL,KNDNDX,
     6LOCABC,LOCATE,LOCPAG,LOCPNT,LOKSUP,LOWBFR,NSKIP ,
     7LRADJS,LRFORC,LSNSPL,LSNSRC,LSTAPP,LSTCHA,LSTELM,
     8LSTFRM,LSTSPL,LSTTRN,MAJOR ,MASTER,MAXBGN,MAXLIN,
     9MAXLOP,MAXSPL,MAXTAB,MAXWRD,MDISK ,MIDAPP,MIDCHA
      COMMON/RNOFIV/MINLVL,MINTOP,MOVBAC,MRGFAR,MRGLFT,
     1MRGRIT,MRGTOP,MRKAMP,MRKBAC,MRKBAR,MRKCAR,MRKDOL,
     2MRKDOT,MRKEFN,MRKEXC,MRKFTN,MRKLES,MRKNDX,MRKNUM,
     3MRKREF,MRKSBX,MRKSEM,MRKSUB,MRKSUP,MRKTTL,MRKTXT,
     4MRKUND,MSTLST,NDISK ,NDXDSK,NDXFOU,NDXHOW,NDXKNT,
     5NDXMAK,NDXONE,NDXOPN,NDXTHR,NDXTWO,NEEDED,NEWCHA,
     6NEWPAG,NOTFIL,NOTIND,NOTKLM,NOTLFT,NOTMNS,NOTONE,
     7NOTRIT,NOTSEM,NOTSKP,NOTSPC,NOTTHR,NOTTST,NOTTWO,
     8NOWBAR,NOWFTN,NOWIND,NOWLFT,NOWLST,NOWOFF,NOWPAG,
     9NOWPHW,NOWRIT,NOWSEC,NOWSHW,NOWSKP,NOWSPH,NOWSUB
      COMMON/RNOSIX/NOWTST,NULTTL,NUMFTN,NXTFIG,NXTHDR,
     1NXTLST,NXTLVL,NXTONE,NXTPAG,NXTSUB,KNDOUT,LNGWRK,
     2KAPFTN,KOFFST,IRECRD,KNTNDX,INIPAG,INIHIA,MAGNFY,
     3INIHIB,IFHALF,KTRMNL,ITTLLO,ISUBLO,LNGTOP,MAGFNT,
     4ITTLHI,ISUBHI,IFINDX,IXTRSS,JXTRSS,KXTRSS,MAGSPC,
     5MXTRSS,NXTRSS,IFORMR,JTRMNL,IFNREF,IFNNUM,KMPPAG,
     6KMPLIN,KMPCLM,KMPVAL,INICLM,MFNGAP,NFNGAP,MAGSAV,
     7MAGSHD,MAGHIH,MRKMAG,LMTSHD,LNGSHD,LFTSHD,IRISHD,
     8IHISHD,ILOSHD,KNTSHD,LFTSGN,IRISGN,NGLSHD,NETNGL,
     9NETSEP,NETWID,NETOFF,NETKNT,KNTEDT,LMTEDT,LMTBIG,
     1LNGBIG,NGLBIG,KNTBIG,NXTSKP,JBORDR,INIMAG,INIOBJ,
     2IBORDR
      COMMON/RNOEIG/INDLST(10)  ,KMDARG(250) ,KMDBRK(250) ,
     1 KNDLVL(6)   ,KNDTTL(16)  ,LOCTAB(32)  ,LSTMRG(10)  ,
     2 LSTRIT(10)  ,LSTSKP(10)  ,LSTSPC(10)  ,LSTTTL(80)  ,
     3 LSTTYP(10)  ,LSTVAL(10)  ,MCHPNT(1300),MSKBGN(300) ,
     4 MSKCHA(200) ,MSKFNR(200) ,MSKFTN(200) ,MSKMID(200) ,
     5 MSKTTL(450) ,NARGMT(44)  ,NBEGIN(19)  ,NMINUS(32)  ,
     6 NOTPNT(1300),NUMLVL(6)   ,NUMNDX(300) ,NUMTTL(11)  ,
     7 NVALUE(32)  ,NXTCMD(81)  ,NXTPNT(12)  ,NXTUNT(4)   ,
     8 MSKWRK(200) ,MTYSTR(4)   ,MAGEDT(50)
      COMMON/RNONIN/LTRAMP,LTRBAC,LTRBAR,LTRCAR,LTRCOM,
     1LTRDOL,LTRDOT,LTREFN,LTREXC,LTRFNC,LTRLES,
     2LTRMNS,LTRNDX,LTRNOW,LTRNUM,LTRPLS,LTRQUO,LTRRUL,
     3LTRSBX,LTRSEM,LTRSPA,LTRSUB,LTRSUP,LTRTAB,
     4LTRPUT,LTRTXT,LTRUND,LTR1ST,LTRMAG
      COMMON/RNOTEN/LTRABC(26)  ,LTRAPP(9)   ,LTRBGN(300) ,
     1 LTRCPT(8)   ,LTRCLS(10)  ,LTRCOD(70)  ,LTRDGT(10)  ,
     2 LTRFLG(18)  ,LTRFTN(200) ,LTRIND(5)   ,LTRLST(10,6),
     3 LTRMID(200) ,LTRONL(26)  ,LTRONU(26)  ,LTROPN(10)  ,
     4 LTRPAG(5)   ,LTRREF(4)   ,LTRSPL(200) ,LTRTWO(4)   ,
     5 LTRTYP(8)   ,LTRWRK(200) ,LWRABC(26)  ,LWRAPP(9)   ,
     6 LWRCHA(8)   ,LWRIND(5)   ,LWRONL(26)  ,LWRONU(26)  ,
     7 LWRTYP(8)   ,LTRTTL(450) ,LTRCHA(200) ,LTRFNR(200) ,
     8 LTRSHD(50)  ,LTRBIG(50)
C
C     MARK THAT THIS ROUTINE HAS BEEN CALLED
      KNTTOP=1
C
C     DECIDE WHETHER CURRENT PAGE IS VISIBLE OR INVISIBLE
      KNTPAG=KNTPAG+1
      I=1
      IF(KNTPAG.LT.IRANGE)I=0
      IF(KNTPAG.GT.JRANGE)I=-1
      IF(KRANGE.EQ.I)GO TO 1
      KNDOUT=6
      CALL RNOLIN
      KRANGE=1
      IF(KNTPAG.LT.IRANGE)KRANGE=0
      IF(KNTPAG.GT.JRANGE)KRANGE=-1
    1 IF(KRANGE.LE.0)GO TO 5
      KNTRST=KNTRST+1
      KNTSHO=KNTSHO+1
      INIPAG=-1
      IF(KNTRST.GT.1)INIPAG=1
      IF(INIFRM.NE.0)INIPAG=1
C
C     ALLOW USER TO INPUT SHEET OF PAPER IF TERMINAL OUTPUT
      IF(ITRMNL.LE.0)GO TO 5
      IF(KNTPAG.EQ.IRANGE)WRITE(ITTY,2)
    2 FORMAT(34H Insert paper, then hit RETURN key)
      INIPAG=-1
      WRITE(JDISK,3)
    3 FORMAT(1H1)
      READ(JTTY,4,END=5)I
    4 FORMAT(1A1)
    5 CONTINUE
C
C     ADVANCE CHAPTER, PAGE AND OR SUBPAGE NUMBERS
      IF(IFPAGE.GT.0)IFPAGE=-1
      IF(NEWCHA.EQ.0)GO TO 7
      JSECTN=ISECTN
      IF(JSECTN.EQ.2)GO TO 7
      IF(JSECTN.GT.0)GO TO 6
      NOWSEC=IAPNDX
      NOWSHW=KNDAPP
      IAPNDX=IAPNDX+1
      GO TO 7
    6 NOWSEC=ICHAPT
      NOWSHW=KNDCHA
      ICHAPT=ICHAPT+1
    7 IF(ISUBPG.EQ.0)GO TO 8
      NOWPAG=NXTPAG
      NOWPHW=KNDPAG
      NXTPAG=NXTPAG+1
      LRADJS=LRADJS+NOWSUB
      IF(ISUBPG.GT.0)GO TO 8
      NOWSUB=0
      ISUBPG=-1
      GO TO 9
    8 ISUBPG=0
      NOWSUB=NXTSUB
      NOWSPH=KNDSUB
      NXTSUB=NXTSUB+1
C
C     GENERATE TITLE LINE
    9 LOCPAG=0
      KNDLIN=0
      LFTRIT=NOWPAG+NOWSUB+LRADJS
      LFTRIT=LFTRIT-(2*(LFTRIT/2))
      IF(LRFORC.LT.0)GO TO 11
      IF(LFTRIT.EQ.LRFORC)GO TO 10
      LRADJS=LRADJS+1
      LFTRIT=LRFORC
   10 LRFORC=-1
   11 IOFFST=LFTOFF
      IF(LFTRIT.NE.0)IOFFST=IRTOFF
      IF(MRKBAR.GT.0)MRKBAR=IOFFST-2
      IF(LCLBAR.NE.0)NOWBAR=MRKBAR
      IF(MRKBAR.LE.0)GO TO 12
      IF(IFABAR.GT.0)IFABAR=MRKBAR
   12 MRGRIT=NOWRIT
      IF(MRGRIT.GT.(LMTMID-IOFFST))MRGRIT=LMTMID-IOFFST
      IF(NEWPAG.LT.0)GO TO 19
      IF(IFHEAD.EQ.0)GO TO 21
C
C     GENERATE BLANK LINES ABOVE TITLE LINE
      IF(ITTLHI.LT.0)GO TO 15
      IF(ITTLHI.EQ.0)GO TO 14
      DO 13 NEEDED=1,ITTLHI
      KNDOUT=3
      CALL RNOLIN
   13 CONTINUE
C
C     GENERATE TITLE
   14 CALL RNOTTL(1)
C
C     GENERATE BLANK LINES BETWEEN TITLE AND SUBTITLE
   15 IF(ISUBHI.LT.0)GO TO 18
      IF(ISUBHI.EQ.0)GO TO 17
      DO 16 NEEDED=1,ISUBHI
      KNDOUT=3
      CALL RNOLIN
   16 CONTINUE
C
C     GENERATE SUBTITLE
   17 CALL RNOTTL(2)
C
C     GENERATE BLANK LINE BELOW TITLE AND SUBTITLE
   18 IF(LOCPAG.GE.LNGTOP)GO TO 21
      KNDOUT=3
      CALL RNOLIN
      GO TO 18
C
C     GENERATE BLANK LINES ON FIRST PAGE
   19 IF(IFHEAD.EQ.0)GO TO 21
      IF(LNGTOP.LE.0)GO TO 21
      DO 20 NEEDED=1,LNGTOP
      KNDOUT=3
      CALL RNOLIN
   20 CONTINUE
C
C     REPLACE OLD TOP TITLES WITH NEW
   21 DO 23 I=9,12
      IF(KNDTTL(I).EQ.0)GO TO 23
      IF(I.EQ.9)KNDLFT=KNDTTL(9)-2
      IF(I.EQ.10)KNDRIT=KNDTTL(10)-2
      IF(I.EQ.11)IFLSUB=KNDTTL(11)-2
      IF(I.EQ.12)IFRSUB=KNDTTL(12)-2
      KNDTTL(I)=0
      J=(5*I)-4
      DO 22 K=1,5
      LSTTTL(J-40)=LSTTTL(J)
      J=J+1
   22 CONTINUE
      LSTTTL(J-5)=0
      LSTTTL(J-4)=0
      LSTTTL(J-3)=-1
      LSTTTL(J-2)=-1
      LSTTTL(J-1)=-1
   23 CONTINUE
C
C     CALCULATE SIZE OF TOP MARGIN
      CALL RNOHIH(LSTTTL,MRGTOP,KTRMNL,LNGTOP,ITTLHI,
     1ISUBHI,IGAPHI,MINTOP,IFLSUB,IFRSUB)
C
C     SAVE CONDITIONS NEEDED FOR GENERATING BOTTOM TITLES
      NUMTTL(1)=NOWSHW
      NUMTTL(2)=NOWSEC
      NUMTTL(3)=NOWPHW
      NUMTTL(4)=NOWPAG
      NUMTTL(5)=NOWSPH
      NUMTTL(6)=NOWSUB
      NUMTTL(7)=NDXMAK
      NUMTTL(8)=JSECTN
      NUMTTL(9)=IOFFST
      NUMTTL(10)=LFTRIT
      NUMTTL(11)=NEWPAG
      NEWPAG=0
      RETURN
      END
      SUBROUTINE RNOBOT
C     RENBR(/CONSTRUCT TOP OF PAGE)
C
C     DONALD E. BARTH, YALE SCHOOL OF MANAGEMENT
C
      COMMON/RNOONE/I     ,IAPNDX,IBRFTN,IBYTE ,ICENTR,
     1ICHAPT,IDEBUG,IDEFER,IDFILE,IDFRFG,IDFRPG,IDISK ,
     2IFABAR,IFAUTO,IFENCE,IFFILL,IFFLAG,IFHEAD,IFLIST,
     3IFLOOP,IFLSUB,IFNATO,IFNBGN,IFNFIL,IFNGAP,
     4IFNGSP,IFNHAV,IFNIBR,IFNICN,IFNIDF,IFNIFA,IFNIIN,
     5IFNILF,IFNIND,IFNIRT,IFNISP,IFNJCN,IFNJDF,IFNJFL,
     6IFNJST,IFNKCN,IFNKDF,IFNKLM,IFNLBR,IFNLBS,IFNLOF,
     7IFNLSP,IFNMBR,IFNMFR,IFNMLF,IFNMNS,IFNMRT,
     8IFNNBR,IFNNIN,IFNNLF,IFNNOF,IFNNOT,IFNNRT,IFNNSK,
     9IFNNTF,IFNNTL,IFNNTR,IFNNTS,IFNNTT,IFNNT1,IFNNT2
      COMMON/RNOTWO/IFNNT3,IFNOFF,IFNOPN,IFNOTE,IFNPIN,
     1IFNPRD,IFNPSK,IFNPTS,IFNRBS,IFNRDY,IFNRED,IFNRIT,
     2IFNROF,IFNTTL,IFNULS,IFNUMB,IFPAGE,IFRSUB,IFSPLC,
     3IGAPHI,IGAPLO,IGROUP,IMINUS,INDENT,INDFTN,INIALL,
     4INIAPP,INIBAR,INICHA,INIFRM,INILIN,ININDX,ININXT,
     5INISPA,INITAL,INNOTE,INTIND,INTLFT,INTRIT,INTRVL,
     6IOFFST,IPEROD,IPGSHO,IQUOTE,IRANGE,IREVRS,IRTBAS,
     7IRTFTN,IRTOFF,IRUNIN,ISECTN,ISKFTN,ISKIP ,ISPACE,
     8ISTART,ISUBPG,ITLALL,ITLLIN,ITLNXT,ITLSPA,ITRMNL,
     9ITTY  ,IULSPC,IVALUE,IWIZRD,J     ,JCENTR,JDFRFG
      COMMON/RNOTHR/JDFRPG,JDISK ,JFILL ,JFNBGN,JFNGAP,
     1JFNOPN,JFNRED,JFNRIT,JGROUP,JMINUS,JOFFST,JRANGE,
     2JSECTN,JSKIP ,JSTIFY,JTTY  ,JVALUE,K     ,KAPITL,
     3KASALL,KASFLG,KASLCL,KCENTR,KDFRFG,KDISK ,KFNGAP,
     4KLMFIL,KLMMNS,KMINUS,KNDAPP,KNDCHA,KNDFIL,KNDLFT,
     5KNDLIN,KNDPAG,KNDRIT,KNDSPL,KNDSUB,KNDTRN,KNTARG,
     6KNTCOD,KNTFTN,KNTFXD,KNTLIN,KNTLOP,KNTLVL,KNTPAG,
     7KNTPNT,KNTRST,KNTSHO,KNTSPC,KNTSPL,KNTTOP,KNTXTR,
     8KOMAND,KOMENT,KONECT,KPYBGN,KPYKAS,KPYMID,KPYPRT,
     9KRANGE,KSKIP ,KVALUE,LCLBAR,LCLNDX,LCLSUP,KAPNDX
      COMMON/RNOFOU/LDISK ,LENGTH,LEVEL0,LEVEL1,LEVEL3,
     1LEVEL4,LFNGAP,LFTBAS,ILFFTN,LFTOFF,LFTRIT,LINFIG,
     2LINSPL,LITERL,LMTBGN,LMTCHA,LMTCOD,LMTFNR,LMTKAS,
     3LMTLST,LMTLVL,LMTMID,LMTNDX,LMTTAB,LMTTTL,LMTUNT,
     4LMTWRK,LNGBGN,LNGBOT,LNGCHA,LNGFNR,LNGFTN,LNGMID,
     5NXTFTN,LNGPAG,LNGSPL,LNGSRC,LNGTRN,LNGTTL,KNDNDX,
     6LOCABC,LOCATE,LOCPAG,LOCPNT,LOKSUP,LOWBFR,NSKIP ,
     7LRADJS,LRFORC,LSNSPL,LSNSRC,LSTAPP,LSTCHA,LSTELM,
     8LSTFRM,LSTSPL,LSTTRN,MAJOR ,MASTER,MAXBGN,MAXLIN,
     9MAXLOP,MAXSPL,MAXTAB,MAXWRD,MDISK ,MIDAPP,MIDCHA
      COMMON/RNOFIV/MINLVL,MINTOP,MOVBAC,MRGFAR,MRGLFT,
     1MRGRIT,MRGTOP,MRKAMP,MRKBAC,MRKBAR,MRKCAR,MRKDOL,
     2MRKDOT,MRKEFN,MRKEXC,MRKFTN,MRKLES,MRKNDX,MRKNUM,
     3MRKREF,MRKSBX,MRKSEM,MRKSUB,MRKSUP,MRKTTL,MRKTXT,
     4MRKUND,MSTLST,NDISK ,NDXDSK,NDXFOU,NDXHOW,NDXKNT,
     5NDXMAK,NDXONE,NDXOPN,NDXTHR,NDXTWO,NEEDED,NEWCHA,
     6NEWPAG,NOTFIL,NOTIND,NOTKLM,NOTLFT,NOTMNS,NOTONE,
     7NOTRIT,NOTSEM,NOTSKP,NOTSPC,NOTTHR,NOTTST,NOTTWO,
     8NOWBAR,NOWFTN,NOWIND,NOWLFT,NOWLST,NOWOFF,NOWPAG,
     9NOWPHW,NOWRIT,NOWSEC,NOWSHW,NOWSKP,NOWSPH,NOWSUB
      COMMON/RNOSIX/NOWTST,NULTTL,NUMFTN,NXTFIG,NXTHDR,
     1NXTLST,NXTLVL,NXTONE,NXTPAG,NXTSUB,KNDOUT,LNGWRK,
     2KAPFTN,KOFFST,IRECRD,KNTNDX,INIPAG,INIHIA,MAGNFY,
     3INIHIB,IFHALF,KTRMNL,ITTLLO,ISUBLO,LNGTOP,MAGFNT,
     4ITTLHI,ISUBHI,IFINDX,IXTRSS,JXTRSS,KXTRSS,MAGSPC,
     5MXTRSS,NXTRSS,IFORMR,JTRMNL,IFNREF,IFNNUM,KMPPAG,
     6KMPLIN,KMPCLM,KMPVAL,INICLM,MFNGAP,NFNGAP,MAGSAV,
     7MAGSHD,MAGHIH,MRKMAG,LMTSHD,LNGSHD,LFTSHD,IRISHD,
     8IHISHD,ILOSHD,KNTSHD,LFTSGN,IRISGN,NGLSHD,NETNGL,
     9NETSEP,NETWID,NETOFF,NETKNT,KNTEDT,LMTEDT,LMTBIG,
     1LNGBIG,NGLBIG,KNTBIG,NXTSKP,JBORDR,INIMAG,INIOBJ,
     2IBORDR
      COMMON/RNOEIG/INDLST(10)  ,KMDARG(250) ,KMDBRK(250) ,
     1 KNDLVL(6)   ,KNDTTL(16)  ,LOCTAB(32)  ,LSTMRG(10)  ,
     2 LSTRIT(10)  ,LSTSKP(10)  ,LSTSPC(10)  ,LSTTTL(80)  ,
     3 LSTTYP(10)  ,LSTVAL(10)  ,MCHPNT(1300),MSKBGN(300) ,
     4 MSKCHA(200) ,MSKFNR(200) ,MSKFTN(200) ,MSKMID(200) ,
     5 MSKTTL(450) ,NARGMT(44)  ,NBEGIN(19)  ,NMINUS(32)  ,
     6 NOTPNT(1300),NUMLVL(6)   ,NUMNDX(300) ,NUMTTL(11)  ,
     7 NVALUE(32)  ,NXTCMD(81)  ,NXTPNT(12)  ,NXTUNT(4)   ,
     8 MSKWRK(200) ,MTYSTR(4)   ,MAGEDT(50)
      COMMON/RNONIN/LTRAMP,LTRBAC,LTRBAR,LTRCAR,LTRCOM,
     1LTRDOL,LTRDOT,LTREFN,LTREXC,LTRFNC,LTRLES,
     2LTRMNS,LTRNDX,LTRNOW,LTRNUM,LTRPLS,LTRQUO,LTRRUL,
     3LTRSBX,LTRSEM,LTRSPA,LTRSUB,LTRSUP,LTRTAB,
     4LTRPUT,LTRTXT,LTRUND,LTR1ST,LTRMAG
      COMMON/RNOTEN/LTRABC(26)  ,LTRAPP(9)   ,LTRBGN(300) ,
     1 LTRCPT(8)   ,LTRCLS(10)  ,LTRCOD(70)  ,LTRDGT(10)  ,
     2 LTRFLG(18)  ,LTRFTN(200) ,LTRIND(5)   ,LTRLST(10,6),
     3 LTRMID(200) ,LTRONL(26)  ,LTRONU(26)  ,LTROPN(10)  ,
     4 LTRPAG(5)   ,LTRREF(4)   ,LTRSPL(200) ,LTRTWO(4)   ,
     5 LTRTYP(8)   ,LTRWRK(200) ,LWRABC(26)  ,LWRAPP(9)   ,
     6 LWRCHA(8)   ,LWRIND(5)   ,LWRONL(26)  ,LWRONU(26)  ,
     7 LWRTYP(8)   ,LTRTTL(450) ,LTRCHA(200) ,LTRFNR(200) ,
     8 LTRSHD(50)  ,LTRBIG(50)
C
C     RETURN TO CALLING PROGRAM IF NO LOWER TITLES
      IF(KNTTOP.LE.0)GO TO 17
      KNTTOP=-1
      IF(LNGBOT.LE.0)GO TO 13
      IF(NUMTTL(11).LT.0)GO TO 13
C
C     REGAIN CONDITIONS USED FOR THE TOP TITLE
      I=NUMTTL(1)
      NUMTTL(1)=NOWSHW
      NOWSHW=I
      I=NUMTTL(2)
      NUMTTL(2)=NOWSEC
      NOWSEC=I
      I=NUMTTL(3)
      NUMTTL(3)=NOWPHW
      NOWPHW=I
      I=NUMTTL(4)
      NUMTTL(4)=NOWPAG
      NOWPAG=I
      I=NUMTTL(5)
      NUMTTL(5)=NOWSPH
      NOWSPH=I
      I=NUMTTL(6)
      NUMTTL(6)=NOWSUB
      NOWSUB=I
      I=NUMTTL(7)
      NUMTTL(7)=NDXMAK
      NDXMAK=I
      I=NUMTTL(8)
      NUMTTL(8)=JSECTN
      JSECTN=I
      I=NUMTTL(9)
      NUMTTL(9)=IOFFST
      IOFFST=I
      I=NUMTTL(10)
      NUMTTL(10)=LFTRIT
      LFTRIT=I
C
C     FORCE OUT FINAL BLANK LINE IF ALREADY REQUESTED
      IF(KTRMNL.NE.0)GO TO 1
      KNDOUT=6
      CALL RNOLIN
C
C     TEST IF EITHER TITLE OR SUBTITLE APPEARS ON PAGE
    1 IF(LFTRIT.GT.0)GO TO 2
      IF(LSTTTL(21).GT.0)GO TO 3
      IF(LSTTTL(31).GT.0)GO TO 3
      GO TO 12
    2 IF(LSTTTL(26).GT.0)GO TO 3
      IF(LSTTTL(36).GT.0)GO TO 3
      GO TO 12
C
C     GENERATE BLANK LINES BETWEEN TEXT AND BOTTOM MARGIN
    3 IF(LOCPAG.GE.LNGPAG)GO TO 4
      KNDOUT=3
      CALL RNOLIN
      GO TO 3
C
C     GENERATE BLANK LINES IN MARGIN ABOVE TITLE
    4 IF(ITTLLO.LT.0)GO TO 7
      IF(ITTLLO.EQ.0)GO TO 6
      DO 5 NEEDED=1,ITTLLO
      KNDOUT=3
      CALL RNOLIN
    5 CONTINUE
C
C     GENERATE TITLE
    6 CALL RNOTTL(3)
C
C     GENERATE BLANK LINES BETWEEN TITLE AND SUBTITLE
    7 IF(ISUBLO.LT.0)GO TO 12
      IF(LFTRIT.GT.0)GO TO 8
      IF(LSTTTL(31).EQ.0)GO TO 12
      GO TO 9
    8 IF(LSTTTL(36).EQ.0)GO TO 12
    9 IF(ISUBLO.EQ.0)GO TO 11
      DO 10 NEEDED=1,ISUBLO
      KNDOUT=3
      CALL RNOLIN
   10 CONTINUE
C
C     GENERATE SUBTITLE
   11 CALL RNOTTL(4)
C
C     RESTORE ORIGINAL CONDITIONS
   12 NOWSHW=NUMTTL(1)
      NOWSEC=NUMTTL(2)
      NOWPHW=NUMTTL(3)
      NOWPAG=NUMTTL(4)
      NOWSPH=NUMTTL(5)
      NOWSUB=NUMTTL(6)
      NDXMAK=NUMTTL(7)
      JSECTN=NUMTTL(8)
      IOFFST=NUMTTL(9)
      LFTRIT=NUMTTL(10)
C
C     REPLACE OLD BOTTOM TITLES WITH NEW
   13 DO 15 I=13,16
      IF(KNDTTL(I).EQ.0)GO TO 15
      KNDTTL(I)=0
      J=(5*I)-4
      DO 14 K=1,5
      LSTTTL(J-40)=LSTTTL(J)
      J=J+1
   14 CONTINUE
      LSTTTL(J-5)=0
      LSTTTL(J-4)=0
      LSTTTL(J-3)=-1
      LSTTTL(J-2)=-1
      LSTTTL(J-1)=-1
   15 CONTINUE
C
C     CALCULATE SIZE OF BOTTOM MARGIN
   16 CALL RNOLOW(LSTTTL,IGAPLO,KTRMNL,LNGBOT,ITTLLO,
     1ISUBLO)
      LNGPAG=MAXLIN-LNGBOT
      IF(LNGPAG.LE.0)LNGPAG=58
   17 RETURN
      END
      SUBROUTINE RNOTTL(LOCTTL)
C     RENBR(/GENERATE TITLE OR SUBTITLE LINE)
C
C     DONALD E. BARTH, YALE SCHOOL OF MANAGEMENT
C
      COMMON/RNOONE/I     ,IAPNDX,IBRFTN,IBYTE ,ICENTR,
     1ICHAPT,IDEBUG,IDEFER,IDFILE,IDFRFG,IDFRPG,IDISK ,
     2IFABAR,IFAUTO,IFENCE,IFFILL,IFFLAG,IFHEAD,IFLIST,
     3IFLOOP,IFLSUB,IFNATO,IFNBGN,IFNFIL,IFNGAP,
     4IFNGSP,IFNHAV,IFNIBR,IFNICN,IFNIDF,IFNIFA,IFNIIN,
     5IFNILF,IFNIND,IFNIRT,IFNISP,IFNJCN,IFNJDF,IFNJFL,
     6IFNJST,IFNKCN,IFNKDF,IFNKLM,IFNLBR,IFNLBS,IFNLOF,
     7IFNLSP,IFNMBR,IFNMFR,IFNMLF,IFNMNS,IFNMRT,
     8IFNNBR,IFNNIN,IFNNLF,IFNNOF,IFNNOT,IFNNRT,IFNNSK,
     9IFNNTF,IFNNTL,IFNNTR,IFNNTS,IFNNTT,IFNNT1,IFNNT2
      COMMON/RNOTWO/IFNNT3,IFNOFF,IFNOPN,IFNOTE,IFNPIN,
     1IFNPRD,IFNPSK,IFNPTS,IFNRBS,IFNRDY,IFNRED,IFNRIT,
     2IFNROF,IFNTTL,IFNULS,IFNUMB,IFPAGE,IFRSUB,IFSPLC,
     3IGAPHI,IGAPLO,IGROUP,IMINUS,INDENT,INDFTN,INIALL,
     4INIAPP,INIBAR,INICHA,INIFRM,INILIN,ININDX,ININXT,
     5INISPA,INITAL,INNOTE,INTIND,INTLFT,INTRIT,INTRVL,
     6IOFFST,IPEROD,IPGSHO,IQUOTE,IRANGE,IREVRS,IRTBAS,
     7IRTFTN,IRTOFF,IRUNIN,ISECTN,ISKFTN,ISKIP ,ISPACE,
     8ISTART,ISUBPG,ITLALL,ITLLIN,ITLNXT,ITLSPA,ITRMNL,
     9ITTY  ,IULSPC,IVALUE,IWIZRD,J     ,JCENTR,JDFRFG
      COMMON/RNOTHR/JDFRPG,JDISK ,JFILL ,JFNBGN,JFNGAP,
     1JFNOPN,JFNRED,JFNRIT,JGROUP,JMINUS,JOFFST,JRANGE,
     2JSECTN,JSKIP ,JSTIFY,JTTY  ,JVALUE,K     ,KAPITL,
     3KASALL,KASFLG,KASLCL,KCENTR,KDFRFG,KDISK ,KFNGAP,
     4KLMFIL,KLMMNS,KMINUS,KNDAPP,KNDCHA,KNDFIL,KNDLFT,
     5KNDLIN,KNDPAG,KNDRIT,KNDSPL,KNDSUB,KNDTRN,KNTARG,
     6KNTCOD,KNTFTN,KNTFXD,KNTLIN,KNTLOP,KNTLVL,KNTPAG,
     7KNTPNT,KNTRST,KNTSHO,KNTSPC,KNTSPL,KNTTOP,KNTXTR,
     8KOMAND,KOMENT,KONECT,KPYBGN,KPYKAS,KPYMID,KPYPRT,
     9KRANGE,KSKIP ,KVALUE,LCLBAR,LCLNDX,LCLSUP,KAPNDX
      COMMON/RNOFOU/LDISK ,LENGTH,LEVEL0,LEVEL1,LEVEL3,
     1LEVEL4,LFNGAP,LFTBAS,ILFFTN,LFTOFF,LFTRIT,LINFIG,
     2LINSPL,LITERL,LMTBGN,LMTCHA,LMTCOD,LMTFNR,LMTKAS,
     3LMTLST,LMTLVL,LMTMID,LMTNDX,LMTTAB,LMTTTL,LMTUNT,
     4LMTWRK,LNGBGN,LNGBOT,LNGCHA,LNGFNR,LNGFTN,LNGMID,
     5NXTFTN,LNGPAG,LNGSPL,LNGSRC,LNGTRN,LNGTTL,KNDNDX,
     6LOCABC,LOCATE,LOCPAG,LOCPNT,LOKSUP,LOWBFR,NSKIP ,
     7LRADJS,LRFORC,LSNSPL,LSNSRC,LSTAPP,LSTCHA,LSTELM,
     8LSTFRM,LSTSPL,LSTTRN,MAJOR ,MASTER,MAXBGN,MAXLIN,
     9MAXLOP,MAXSPL,MAXTAB,MAXWRD,MDISK ,MIDAPP,MIDCHA
      COMMON/RNOFIV/MINLVL,MINTOP,MOVBAC,MRGFAR,MRGLFT,
     1MRGRIT,MRGTOP,MRKAMP,MRKBAC,MRKBAR,MRKCAR,MRKDOL,
     2MRKDOT,MRKEFN,MRKEXC,MRKFTN,MRKLES,MRKNDX,MRKNUM,
     3MRKREF,MRKSBX,MRKSEM,MRKSUB,MRKSUP,MRKTTL,MRKTXT,
     4MRKUND,MSTLST,NDISK ,NDXDSK,NDXFOU,NDXHOW,NDXKNT,
     5NDXMAK,NDXONE,NDXOPN,NDXTHR,NDXTWO,NEEDED,NEWCHA,
     6NEWPAG,NOTFIL,NOTIND,NOTKLM,NOTLFT,NOTMNS,NOTONE,
     7NOTRIT,NOTSEM,NOTSKP,NOTSPC,NOTTHR,NOTTST,NOTTWO,
     8NOWBAR,NOWFTN,NOWIND,NOWLFT,NOWLST,NOWOFF,NOWPAG,
     9NOWPHW,NOWRIT,NOWSEC,NOWSHW,NOWSKP,NOWSPH,NOWSUB
      COMMON/RNOSIX/NOWTST,NULTTL,NUMFTN,NXTFIG,NXTHDR,
     1NXTLST,NXTLVL,NXTONE,NXTPAG,NXTSUB,KNDOUT,LNGWRK,
     2KAPFTN,KOFFST,IRECRD,KNTNDX,INIPAG,INIHIA,MAGNFY,
     3INIHIB,IFHALF,KTRMNL,ITTLLO,ISUBLO,LNGTOP,MAGFNT,
     4ITTLHI,ISUBHI,IFINDX,IXTRSS,JXTRSS,KXTRSS,MAGSPC,
     5MXTRSS,NXTRSS,IFORMR,JTRMNL,IFNREF,IFNNUM,KMPPAG,
     6KMPLIN,KMPCLM,KMPVAL,INICLM,MFNGAP,NFNGAP,MAGSAV,
     7MAGSHD,MAGHIH,MRKMAG,LMTSHD,LNGSHD,LFTSHD,IRISHD,
     8IHISHD,ILOSHD,KNTSHD,LFTSGN,IRISGN,NGLSHD,NETNGL,
     9NETSEP,NETWID,NETOFF,NETKNT,KNTEDT,LMTEDT,LMTBIG,
     1LNGBIG,NGLBIG,KNTBIG,NXTSKP,JBORDR,INIMAG,INIOBJ,
     2IBORDR
      COMMON/RNOEIG/INDLST(10)  ,KMDARG(250) ,KMDBRK(250) ,
     1 KNDLVL(6)   ,KNDTTL(16)  ,LOCTAB(32)  ,LSTMRG(10)  ,
     2 LSTRIT(10)  ,LSTSKP(10)  ,LSTSPC(10)  ,LSTTTL(80)  ,
     3 LSTTYP(10)  ,LSTVAL(10)  ,MCHPNT(1300),MSKBGN(300) ,
     4 MSKCHA(200) ,MSKFNR(200) ,MSKFTN(200) ,MSKMID(200) ,
     5 MSKTTL(450) ,NARGMT(44)  ,NBEGIN(19)  ,NMINUS(32)  ,
     6 NOTPNT(1300),NUMLVL(6)   ,NUMNDX(300) ,NUMTTL(11)  ,
     7 NVALUE(32)  ,NXTCMD(81)  ,NXTPNT(12)  ,NXTUNT(4)   ,
     8 MSKWRK(200) ,MTYSTR(4)   ,MAGEDT(50)
      COMMON/RNONIN/LTRAMP,LTRBAC,LTRBAR,LTRCAR,LTRCOM,
     1LTRDOL,LTRDOT,LTREFN,LTREXC,LTRFNC,LTRLES,
     2LTRMNS,LTRNDX,LTRNOW,LTRNUM,LTRPLS,LTRQUO,LTRRUL,
     3LTRSBX,LTRSEM,LTRSPA,LTRSUB,LTRSUP,LTRTAB,
     4LTRPUT,LTRTXT,LTRUND,LTR1ST,LTRMAG
      COMMON/RNOTEN/LTRABC(26)  ,LTRAPP(9)   ,LTRBGN(300) ,
     1 LTRCPT(8)   ,LTRCLS(10)  ,LTRCOD(70)  ,LTRDGT(10)  ,
     2 LTRFLG(18)  ,LTRFTN(200) ,LTRIND(5)   ,LTRLST(10,6),
     3 LTRMID(200) ,LTRONL(26)  ,LTRONU(26)  ,LTROPN(10)  ,
     4 LTRPAG(5)   ,LTRREF(4)   ,LTRSPL(200) ,LTRTWO(4)   ,
     5 LTRTYP(8)   ,LTRWRK(200) ,LWRABC(26)  ,LWRAPP(9)   ,
     6 LWRCHA(8)   ,LWRIND(5)   ,LWRONL(26)  ,LWRONU(26)  ,
     7 LWRTYP(8)   ,LTRTTL(450) ,LTRCHA(200) ,LTRFNR(200) ,
     8 LTRSHD(50)  ,LTRBIG(50)
C
C     LOCTTL = 1, TOP TITLE
C            = 2, TOP SUBTITLE
C            = 3, BOTTOM TITLE
C            = 4, BOTTOM SUBTITLE
C     LFTRIT = 0, LEFT PAGE
C            = 1, RIGHT PAGE
      LOCLFT=(10*LOCTTL)+(5*LFTRIT)-8
      IFIRST=LSTTTL(LOCLFT)
      LNGWRK=0
C
C     CYCLE THROUGH THE 3 SECTIONS OF THE TITLE
      DO 18 NEWSEC=1,3
      LOCLFT=LOCLFT+1
      IFINAL=LSTTTL(LOCLFT)
      INIWRK=LNGWRK
C
C     LOCATE NEXT SECTION OF TITLE TO BE INSERTED
    1 IF(IFIRST.GT.IFINAL)GO TO 13
      JFINAL=IFIRST
    2 IF(JFINAL.GT.IFINAL)GO TO 3
      IF(MSKTTL(JFINAL).LT.0)GO TO 3
      JFINAL=JFINAL+1
      GO TO 2
    3 IF(JFINAL.LE.IFIRST)GO TO 6
      JFINAL=JFINAL-1
C
C     COPY ALPHABETIC SECTION OF TITLE
    4 IF(IFIRST.GT.JFINAL)GO TO 5
      IF(LNGWRK.GE.LMTWRK)GO TO 5
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRTTL(IFIRST)
      MSKWRK(LNGWRK)=MSKTTL(IFIRST)
      IFIRST=IFIRST+1
      GO TO 4
    5 IFIRST=JFINAL+1
    6 IF(IFIRST.GT.IFINAL)GO TO 13
      LOCWRK=LNGWRK
      IFIRST=IFIRST+1
      IF(MSKTTL(IFIRST-1).LT.-1)GO TO 8
      IF(IFNUMB.EQ.0)GO TO 12
      IF(IPGSHO.EQ.0)GO TO 8
      DO 7 I=1,5
      IF(LNGWRK.GE.LMTWRK)GO TO 12
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRPAG(I)
    7 CONTINUE
C
C     INSERT CURRENT PAGE NUMBER
    8 IF(NDXMAK.EQ.0)GO TO 10
      DO 9 I=1,5
      IF(LNGWRK.GE.LMTWRK)GO TO 12
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LWRIND(I)
    9 CONTINUE
      IF(LNGWRK.GE.LMTWRK)GO TO 12
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRMNS
      GO TO 11
   10 IF(JSECTN.EQ.0)GO TO 11
      CALL RNONUM(NOWSHW,NOWSEC,LTRWRK,LNGWRK,LMTWRK)
      IF(LNGWRK.GE.LMTWRK)GO TO 12
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRMNS
   11 CALL RNONUM(NOWPHW,NOWPAG,LTRWRK,LNGWRK,LMTWRK)
      IF(NOWSUB.LE.0)GO TO 12
      CALL RNONUM(NOWSPH,NOWSUB,LTRWRK,LNGWRK,LMTWRK)
   12 IF(LOCWRK.GE.LNGWRK)GO TO 1
      LOCWRK=LOCWRK+1
      MSKWRK(LOCWRK)=0
      GO TO 12
C
C     CALCULATE OFFSET FOR JUSTIFICATION OR CENTERING
   13 IF(INIWRK.GE.LNGWRK)GO TO 18
      IF(NEWSEC.EQ.1)GO TO 18
      IF(NEWSEC.EQ.3)GO TO 14
      NEEDED=((MRGFAR-LNGWRK+INIWRK)/2)
     1-INIWRK
      GO TO 15
   14 NEEDED=MRGFAR-LNGWRK
C
C     PERFORM JUSTIFICATION OR CENTERING
   15 IF(NEEDED.GT.(LMTWRK-LNGWRK))NEEDED=LMTWRK-LNGWRK
      IF(NEEDED.LE.0)GO TO 18
      I=LNGWRK
      LNGWRK=LNGWRK+NEEDED
      J=LNGWRK
   16 LTRWRK(J)=LTRWRK(I)
      MSKWRK(J)=MSKWRK(I)
      J=J-1
      I=I-1
      IF(I.GT.INIWRK)GO TO 16
   17 IF(J.LE.INIWRK)GO TO 18
      LTRWRK(J)=LTRSPA
      MSKWRK(J)=0
      J=J-1
      GO TO 17
   18 CONTINUE
C
C     OUTPUT THE TITLE
   19 KNDOUT=4
      CALL RNOLIN
      RETURN
      END
      SUBROUTINE RNOSET
C     RENBR(/APPLY ALL COMMANDS EXCEPT INDEX CONSTRUCTION)
C
C     DONALD E. BARTH, YALE SCHOOL OF MANAGEMENT
C
      COMMON/RNOONE/I     ,IAPNDX,IBRFTN,IBYTE ,ICENTR,
     1ICHAPT,IDEBUG,IDEFER,IDFILE,IDFRFG,IDFRPG,IDISK ,
     2IFABAR,IFAUTO,IFENCE,IFFILL,IFFLAG,IFHEAD,IFLIST,
     3IFLOOP,IFLSUB,IFNATO,IFNBGN,IFNFIL,IFNGAP,
     4IFNGSP,IFNHAV,IFNIBR,IFNICN,IFNIDF,IFNIFA,IFNIIN,
     5IFNILF,IFNIND,IFNIRT,IFNISP,IFNJCN,IFNJDF,IFNJFL,
     6IFNJST,IFNKCN,IFNKDF,IFNKLM,IFNLBR,IFNLBS,IFNLOF,
     7IFNLSP,IFNMBR,IFNMFR,IFNMLF,IFNMNS,IFNMRT,
     8IFNNBR,IFNNIN,IFNNLF,IFNNOF,IFNNOT,IFNNRT,IFNNSK,
     9IFNNTF,IFNNTL,IFNNTR,IFNNTS,IFNNTT,IFNNT1,IFNNT2
      COMMON/RNOTWO/IFNNT3,IFNOFF,IFNOPN,IFNOTE,IFNPIN,
     1IFNPRD,IFNPSK,IFNPTS,IFNRBS,IFNRDY,IFNRED,IFNRIT,
     2IFNROF,IFNTTL,IFNULS,IFNUMB,IFPAGE,IFRSUB,IFSPLC,
     3IGAPHI,IGAPLO,IGROUP,IMINUS,INDENT,INDFTN,INIALL,
     4INIAPP,INIBAR,INICHA,INIFRM,INILIN,ININDX,ININXT,
     5INISPA,INITAL,INNOTE,INTIND,INTLFT,INTRIT,INTRVL,
     6IOFFST,IPEROD,IPGSHO,IQUOTE,IRANGE,IREVRS,IRTBAS,
     7IRTFTN,IRTOFF,IRUNIN,ISECTN,ISKFTN,ISKIP ,ISPACE,
     8ISTART,ISUBPG,ITLALL,ITLLIN,ITLNXT,ITLSPA,ITRMNL,
     9ITTY  ,IULSPC,IVALUE,IWIZRD,J     ,JCENTR,JDFRFG
      COMMON/RNOTHR/JDFRPG,JDISK ,JFILL ,JFNBGN,JFNGAP,
     1JFNOPN,JFNRED,JFNRIT,JGROUP,JMINUS,JOFFST,JRANGE,
     2JSECTN,JSKIP ,JSTIFY,JTTY  ,JVALUE,K     ,KAPITL,
     3KASALL,KASFLG,KASLCL,KCENTR,KDFRFG,KDISK ,KFNGAP,
     4KLMFIL,KLMMNS,KMINUS,KNDAPP,KNDCHA,KNDFIL,KNDLFT,
     5KNDLIN,KNDPAG,KNDRIT,KNDSPL,KNDSUB,KNDTRN,KNTARG,
     6KNTCOD,KNTFTN,KNTFXD,KNTLIN,KNTLOP,KNTLVL,KNTPAG,
     7KNTPNT,KNTRST,KNTSHO,KNTSPC,KNTSPL,KNTTOP,KNTXTR,
     8KOMAND,KOMENT,KONECT,KPYBGN,KPYKAS,KPYMID,KPYPRT,
     9KRANGE,KSKIP ,KVALUE,LCLBAR,LCLNDX,LCLSUP,KAPNDX
      COMMON/RNOFOU/LDISK ,LENGTH,LEVEL0,LEVEL1,LEVEL3,
     1LEVEL4,LFNGAP,LFTBAS,ILFFTN,LFTOFF,LFTRIT,LINFIG,
     2LINSPL,LITERL,LMTBGN,LMTCHA,LMTCOD,LMTFNR,LMTKAS,
     3LMTLST,LMTLVL,LMTMID,LMTNDX,LMTTAB,LMTTTL,LMTUNT,
     4LMTWRK,LNGBGN,LNGBOT,LNGCHA,LNGFNR,LNGFTN,LNGMID,
     5NXTFTN,LNGPAG,LNGSPL,LNGSRC,LNGTRN,LNGTTL,KNDNDX,
     6LOCABC,LOCATE,LOCPAG,LOCPNT,LOKSUP,LOWBFR,NSKIP ,
     7LRADJS,LRFORC,LSNSPL,LSNSRC,LSTAPP,LSTCHA,LSTELM,
     8LSTFRM,LSTSPL,LSTTRN,MAJOR ,MASTER,MAXBGN,MAXLIN,
     9MAXLOP,MAXSPL,MAXTAB,MAXWRD,MDISK ,MIDAPP,MIDCHA
      COMMON/RNOFIV/MINLVL,MINTOP,MOVBAC,MRGFAR,MRGLFT,
     1MRGRIT,MRGTOP,MRKAMP,MRKBAC,MRKBAR,MRKCAR,MRKDOL,
     2MRKDOT,MRKEFN,MRKEXC,MRKFTN,MRKLES,MRKNDX,MRKNUM,
     3MRKREF,MRKSBX,MRKSEM,MRKSUB,MRKSUP,MRKTTL,MRKTXT,
     4MRKUND,MSTLST,NDISK ,NDXDSK,NDXFOU,NDXHOW,NDXKNT,
     5NDXMAK,NDXONE,NDXOPN,NDXTHR,NDXTWO,NEEDED,NEWCHA,
     6NEWPAG,NOTFIL,NOTIND,NOTKLM,NOTLFT,NOTMNS,NOTONE,
     7NOTRIT,NOTSEM,NOTSKP,NOTSPC,NOTTHR,NOTTST,NOTTWO,
     8NOWBAR,NOWFTN,NOWIND,NOWLFT,NOWLST,NOWOFF,NOWPAG,
     9NOWPHW,NOWRIT,NOWSEC,NOWSHW,NOWSKP,NOWSPH,NOWSUB
      COMMON/RNOSIX/NOWTST,NULTTL,NUMFTN,NXTFIG,NXTHDR,
     1NXTLST,NXTLVL,NXTONE,NXTPAG,NXTSUB,KNDOUT,LNGWRK,
     2KAPFTN,KOFFST,IRECRD,KNTNDX,INIPAG,INIHIA,MAGNFY,
     3INIHIB,IFHALF,KTRMNL,ITTLLO,ISUBLO,LNGTOP,MAGFNT,
     4ITTLHI,ISUBHI,IFINDX,IXTRSS,JXTRSS,KXTRSS,MAGSPC,
     5MXTRSS,NXTRSS,IFORMR,JTRMNL,IFNREF,IFNNUM,KMPPAG,
     6KMPLIN,KMPCLM,KMPVAL,INICLM,MFNGAP,NFNGAP,MAGSAV,
     7MAGSHD,MAGHIH,MRKMAG,LMTSHD,LNGSHD,LFTSHD,IRISHD,
     8IHISHD,ILOSHD,KNTSHD,LFTSGN,IRISGN,NGLSHD,NETNGL,
     9NETSEP,NETWID,NETOFF,NETKNT,KNTEDT,LMTEDT,LMTBIG,
     1LNGBIG,NGLBIG,KNTBIG,NXTSKP,JBORDR,INIMAG,INIOBJ,
     2IBORDR
      COMMON/RNOEIG/INDLST(10)  ,KMDARG(250) ,KMDBRK(250) ,
     1 KNDLVL(6)   ,KNDTTL(16)  ,LOCTAB(32)  ,LSTMRG(10)  ,
     2 LSTRIT(10)  ,LSTSKP(10)  ,LSTSPC(10)  ,LSTTTL(80)  ,
     3 LSTTYP(10)  ,LSTVAL(10)  ,MCHPNT(1300),MSKBGN(300) ,
     4 MSKCHA(200) ,MSKFNR(200) ,MSKFTN(200) ,MSKMID(200) ,
     5 MSKTTL(450) ,NARGMT(44)  ,NBEGIN(19)  ,NMINUS(32)  ,
     6 NOTPNT(1300),NUMLVL(6)   ,NUMNDX(300) ,NUMTTL(11)  ,
     7 NVALUE(32)  ,NXTCMD(81)  ,NXTPNT(12)  ,NXTUNT(4)   ,
     8 MSKWRK(200) ,MTYSTR(4)   ,MAGEDT(50)
      COMMON/RNONIN/LTRAMP,LTRBAC,LTRBAR,LTRCAR,LTRCOM,
     1LTRDOL,LTRDOT,LTREFN,LTREXC,LTRFNC,LTRLES,
     2LTRMNS,LTRNDX,LTRNOW,LTRNUM,LTRPLS,LTRQUO,LTRRUL,
     3LTRSBX,LTRSEM,LTRSPA,LTRSUB,LTRSUP,LTRTAB,
     4LTRPUT,LTRTXT,LTRUND,LTR1ST,LTRMAG
      COMMON/RNOTEN/LTRABC(26)  ,LTRAPP(9)   ,LTRBGN(300) ,
     1 LTRCPT(8)   ,LTRCLS(10)  ,LTRCOD(70)  ,LTRDGT(10)  ,
     2 LTRFLG(18)  ,LTRFTN(200) ,LTRIND(5)   ,LTRLST(10,6),
     3 LTRMID(200) ,LTRONL(26)  ,LTRONU(26)  ,LTROPN(10)  ,
     4 LTRPAG(5)   ,LTRREF(4)   ,LTRSPL(200) ,LTRTWO(4)   ,
     5 LTRTYP(8)   ,LTRWRK(200) ,LWRABC(26)  ,LWRAPP(9)   ,
     6 LWRCHA(8)   ,LWRIND(5)   ,LWRONL(26)  ,LWRONU(26)  ,
     7 LWRTYP(8)   ,LTRTTL(450) ,LTRCHA(200) ,LTRFNR(200) ,
     8 LTRSHD(50)  ,LTRBIG(50)
C
C
      IF(KOMAND.GT.500)GO TO 466
      IF(KOMAND.GT.100)GO TO 1
      IF(KOMAND.GT.200)GO TO 2
      GO TO(543,  10,543,  14, 68, 125, 128, 129,405, 130,
     1      136,139,141,145,406,168,199,543,202,208,
     2      377,226,209,230,231,265,232,238,241,243,
     3      247,250,251,271,155,291,249,286,296,300,
     4      313,327,  13,387,146, 71,140, 132,151,242,
     5      234,248,  16,174,543,  3, 38, 56,260, 37,
     6      259,253,223, 105,329, 116,312,215,221, 103,
     7      264, 39,543, 32,543, 131,233,144,246,  4,
     8      229,167,322,170,222, 104,297,349,156,262,
     9      346, 54,324,543,257, 114,325, 33,384, 65),KOMAND
    1 I=KOMAND-100
      GO TO(  9, 67, 35,143,245, 119, 135,237,345, 122,
     1      299,209,  15,301,203, 127,348, 117,266,321,
     2      319, 126,543, 64,295,255,290,254,142,244,
     3      174,543, 53,323,543,311,279,138,240,210,
     4      306,388,391,394,395,396,397,398,399,400,
     5      401,402,403,326,320,66,36,543,376,353,
     6      316,318,317,543,543,261,252,169, 46, 57,
     7      201,171,280,154,198,404,465,267,269,385,
     8      156,386,256,172,204,204,115,211,543,543,
     9      543, 227,134,236,133,235,347,543,543,543),I
    2 I=KOMAND-200
      GO TO(307,543,543,543,543,543,543,543,543,543,
     1      543,543,5,281,543,543,338,137,239,289,
     2      118),I
      GO TO 543
C
C     .APPENDIX
    3 ISECTN=-1
      GO TO 17
C
C     .AUTO PARAGRAPH
    4 IF(IFAUTO.EQ.0)IFAUTO=1
      IF(IFNATO.EQ.0)IFNATO=1
      IF(IMINUS.NE.0)NOWIND=IVALUE
      IF(KNTARG.LE.1)GO TO 543
      IF(NMINUS(2).LE.0)NVALUE(2)=NVALUE(2)+NOWSKP
      IF(NVALUE(2).GE.0)NOWSKP=NVALUE(2)
      IF(KNTARG.LE.2)GO TO 543
      IF(NMINUS(3).LE.0)NVALUE(3)=NVALUE(3)+NOWTST
      IF(NVALUE(3).GE.0)NOWTST=NVALUE(3)
      GO TO 543
C
C     .BACKGROUND
    5 IF(IFNOTE.NE.0)GO TO 543
      KNDTRN=1
      LNGSHD=0
      LFTSHD=0
      LFTSGN=-1
      IRISHD=0
      IRISGN=-1
      IHISHD=1
      ILOSHD=1
      NGLSHD=1
      LNGTRN=2
      NETWID=LMTMID
      NETSEP=0
      NETOFF=0
      NETNGL=0
      INIOBJ=0
      IF(KNTARG.LE.0)GO TO 8
      IF(IMINUS.LE.0)GO TO 7
      IFIRST=IVALUE
      IFINAL=IFIRST+IMINUS-1
    6 IF(IFIRST.GT.IFINAL)GO TO 7
      IF(LNGSHD.GE.LMTSHD)GO TO 7
      LNGSHD=LNGSHD+1
      LTRSHD(LNGSHD)=LTRBGN(IFIRST)
      IFIRST=IFIRST+1
      GO TO 6
C     LEFT MARGIN
    7 IF(KNTARG.LT.2)GO TO 8
      LFTSHD=NVALUE(2)
      LFTSGN=NMINUS(2)
C     RIGHT MARGIN
      IF(KNTARG.LT.3)GO TO 8
      IRISHD=NVALUE(3)
      IRISGN=NMINUS(3)
C     TOP MARGIN
      IF(KNTARG.LT.4)GO TO 8
      IF(NMINUS(4).NE.0)IHISHD=NVALUE(4)
      IF(IHISHD.LT.0)IHISHD=0
C     BOTTOM MARGIN
      IF(KNTARG.LT.5)GO TO 8
      IF(NMINUS(5).NE.0)ILOSHD=NVALUE(5)
      IF(ILOSHD.LT.0)ILOSHD=0
C     BACKGROUND WORD REPETITION SLANT
      IF(KNTARG.LT.6)GO TO 8
      IF(NMINUS(6).NE.0)NGLSHD=NVALUE(6)
      IF(NGLSHD.LE.(-LNGSHD))NGLSHD=0
      IF(NGLSHD.GE.LNGSHD)NGLSHD=0
C     ORIENTATION OF SUPERIMPOSED PATTERN
      IF(KNTARG.LT.7)GO TO 8
      IF(NMINUS(7).NE.0)INIOBJ=NVALUE(7)
C     BAR WIDTH
      IF(KNTARG.LT.8)GO TO 8
      IF(NMINUS(8).NE.0)NETWID=NVALUE(8)
      IF(NETWID.LT.0)NETWID=LMTMID
C     BAR SEPARATION
      IF(KNTARG.LT.9)GO TO 8
      IF(NMINUS(9).NE.0)NETSEP=NVALUE(9)
      IF(NETSEP.LT.0)NETSEP=0
C     OFFSET OF INITIAL BAR
      IF(KNTARG.LT.10)GO TO 8
      IF(NMINUS(10).NE.0)NETOFF=NVALUE(10)
      IF(NETOFF.LE.(-NETSEP-NETWID))NETOFF=0
      IF(NETOFF.GE.(NETSEP+NETWID))NETOFF=0
C     BAR SLANT
      IF(KNTARG.LT.11)GO TO 8
      IF(NMINUS(11).NE.0)NETNGL=NVALUE(11)
      IF(NETNGL.LE.(-NETSEP-NETWID))NETNGL=0
      IF(NETNGL.GT.(NETSEP+NETWID))NETNGL=0
    8 GO TO 543
C
C     .BEGIN BAR
    9 LCLBAR=1
      IF(MRKBAR.LE.0)GO TO 543
      NOWBAR=MRKBAR
      GO TO 543
C
C     .BLANK
   10 IF(ISKIP.LT.0)GO TO 543
      IF(IMINUS.EQ.0)GO TO 11
      IF(IVALUE.LE.0)GO TO 12
   11 IF(IVALUE.LE.0)IVALUE=1
      ISKIP=ISKIP+IVALUE
      GO TO 543
   12 IF(IFNOTE.NE.0)GO TO 543
      I=LNGPAG+IVALUE-LOCPAG-1
      IF(ISKIP.LT.I)ISKIP=I
      GO TO 543
C
C     .CARRIAGE
   13 LTR1ST=LTRSPA
      IF(IMINUS.GT.0)LTR1ST=LTRBGN(IVALUE)
      GO TO 543
C
C     .CENTER
   14 JFILL=1
      IF(IVALUE.EQ.0)IMINUS=-1
      GO TO 302
C
C     .CENTER NO FILL
   15 JFILL=4
      GO TO 304
C
C     .CHAPTER
   16 ISECTN=1
   17 IF(KNTARG.LE.0)GO TO 24
      IF(NMINUS(KNTARG).LE.0)GO TO 24
      IF(INITAL.LT.0)GO TO 24
      I=NVALUE(KNTARG)
      N=I+NMINUS(KNTARG)-1
      K=0
   18 MSKBIT=MSKBGN(I)
      CALL RNOUNP(1,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 19
      K=0
      GO TO 23
   19 IF(K.EQ.0)GO TO 20
      IF(KAPITL.LT.0)GO TO 23
   20 MSKBIT=MSKBGN(I)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 22
      LTRNOW=LTRBGN(I)
      DO 21 M=1,26
      IF(LTRNOW.NE.LWRABC(M))GO TO 21
      LTRBGN(I)=LTRABC(M)
      GO TO 22
   21 CONTINUE
   22 K=1
   23 I=I+1
      IF(I.LE.N)GO TO 18
   24 NEWCHA=1
      NEWPAG=NULTTL
      NXTPAG=1
      LRADJS=LFTRIT+NOWSUB
      IF(ISUBPG.LT.0)GO TO 25
      ISUBPG=ISUBPG-2
      NXTSUB=1
   25 CONTINUE
C     NO ACTIVE HEADER LEVELS
      KSKIP=0
      KNTLVL=0
      NXTLVL=0
      DO 26 I=1,LMTLVL
      KNDLVL(I)=1
      NUMLVL(I)=0
   26 CONTINUE
      NUMLVL(1)=1
      LNGCHA=0
      IF(KNTARG.LE.0)GO TO 28
      IF(NMINUS(KNTARG).LE.0)GO TO 28
      IFIRST=NVALUE(KNTARG)
      IFINAL=IFIRST+NMINUS(KNTARG)-1
   27 IF(IFIRST.GT.IFINAL)GO TO 28
      IF(LNGCHA.GE.LMTCHA)GO TO 28
      LNGCHA=LNGCHA+1
      MSKCHA(LNGCHA)=MSKBGN(IFIRST)
      LTRCHA(LNGCHA)=LTRBGN(IFIRST)
      IFIRST=IFIRST+1
      GO TO 27
C     REMOVE SUBTITLES IF ESTABLISHED BY .SUBTITLE COMMAND
   28 IF(IFLSUB.LE.0)GO TO 29
      LSTTTL(11)=0
      LSTTTL(12)=0
      LSTTTL(13)=-1
      LSTTTL(14)=-1
      LSTTTL(15)=-1
   29 IF(IFRSUB.LE.0)GO TO 30
      LSTTTL(16)=0
      LSTTTL(17)=0
      LSTTTL(18)=-1
      LSTTTL(19)=-1
      LSTTTL(20)=-1
C     ESTABLISH TITLE IF FORMERLY SET BY .TITLE COMMAND
   30 KOMAND=9
      IF(KNDLFT.NE.0)GO TO 31
      IF(KNDRIT.NE.0)GO TO 392
      GO TO 458
   31 IF(KNDRIT.EQ.0)GO TO 389
      GO TO 405
C
C     .COLLECT FOOT NOTES
   32 IF(IDEFER.EQ.0)IDEFER=1
      GO TO 543
C
C     .DEBUG
   33 IDEBUG=1
      IF(IMINUS.LE.0)GO TO 543
      J=IVALUE+IMINUS-1
      WRITE(JDISK,34)LTR1ST,(LTRBGN(I),I=IVALUE,J)
   34 FORMAT(1A1,6HDEBUG ,300A1)
      GO TO 543
C
C     .DISABLE BAR
   35 IF(MRKBAR.EQ.0)GO TO 543
      MRKBAR=0
      IF(IFNOTE.EQ.0)IFNMBR=0
      IVALUE=0
      IMINUS=-1
      GO TO 271
C
C     .DISABLE INDEX
   36 IFINDX=0
      GO TO 543
C
C     .DISPLAY APPENDIX
   37 IF(IVALUE.GT.0)KNDAPP=IVALUE
      GO TO 543
C
C     .DISPLAY CHAPTER
   38 IF(IVALUE.GT.0)KNDCHA=IVALUE
      GO TO 543
C
C     .DISPLAY ELEMENT
   39 IF(IFLIST.LE.0)GO TO 543
      IF(KNTARG.LE.0)GO TO 220
      IF(IMINUS.GT.0)GO TO 41
      IF(IMINUS.LT.0)GO TO 40
      IF(KNTARG.LT.3)GO TO 45
      IF(NMINUS(3).EQ.0)GO TO 45
      LTROPN(IFLIST)=LTRSPA
      GO TO 43
   40 LTROPN(IFLIST)=LTRSPA
      GO TO 42
   41 LTROPN(IFLIST)=LTRBGN(IVALUE)
   42 IF(KNTARG.LT.3)GO TO 44
   43 IF(NMINUS(3).LE.0)GO TO 44
      IVALUE=NVALUE(3)
      LTRCLS(IFLIST)=LTRBGN(IVALUE)
      GO TO 45
   44 LTRCLS(IFLIST)=LTRSPA
   45 IF(KNTARG.LE.1)GO TO 220
      IF(NMINUS(2).GT.0)LSTTYP(IFLIST)=NVALUE(2)
      GO TO 220
C
C     .DISPLAY FOOTNOTE
   46 IF(KNTARG.LE.0)GO TO 543
      IF(IMINUS.GT.0)GO TO 48
      IF(IMINUS.LT.0)GO TO 47
      IF(KNTARG.LT.3)GO TO 52
      IF(NMINUS(3).EQ.0)GO TO 52
      LTRREF(3)=LTRSPA
      GO TO 50
   47 LTRREF(3)=LTRSPA
      GO TO 49
   48 LTRREF(3)=LTRBGN(IVALUE)
   49 IF(KNTARG.LT.3)GO TO 51
   50 IF(NMINUS(3).LE.0)GO TO 51
      IVALUE=NVALUE(3)
      LTRREF(4)=LTRBGN(IVALUE)
      GO TO 52
   51 LTRREF(4)=LTRSPA
   52 IF(KNTARG.LE.1)GO TO 543
      IF(NMINUS(2).GT.0)MRKFTN=NVALUE(2)
      IF(KNTARG.LE.3)GO TO 543
      IF(NMINUS(4).NE.0)IFNNUM=NVALUE(4)
      GO TO 543
C
C     .DISPLAY INDEX
   53 IF(IVALUE.GT.0)NDXHOW=IVALUE
      GO TO 543
C
C     .DISPLAY LEVELS
   54 IF(KNTARG.LE.0)GO TO 543
      DO 55 I=1,KNTARG
      IF(NMINUS(I).GT.0)KNDLVL(I)=NVALUE(I)
   55 CONTINUE
      GO TO 543
C
C     .DISPLAY NUMBER
   56 IF(IVALUE.GT.0)KNDPAG=IVALUE
      GO TO 543
C
C     .DISPLAY REFERENCE
   57 IF(KNTARG.LE.0)GO TO 543
      IF(IMINUS.GT.0)GO TO 59
      IF(IMINUS.LT.0)GO TO 58
      IF(KNTARG.LT.3)GO TO 63
      IF(NMINUS(3).EQ.0)GO TO 63
      LTRREF(1)=LTRSPA
      GO TO 61
   58 LTRREF(1)=LTRSPA
      GO TO 60
   59 LTRREF(1)=LTRBGN(IVALUE)
   60 IF(KNTARG.LT.3)GO TO 62
   61 IF(NMINUS(3).LE.0)GO TO 62
      IVALUE=NVALUE(3)
      LTRREF(2)=LTRBGN(IVALUE)
      GO TO 63
   62 LTRREF(2)=LTRSPA
   63 IF(KNTARG.LE.1)GO TO 543
      IF(NMINUS(2).GT.0)MRKREF=NVALUE(2)
      IF(KNTARG.LE.3)GO TO 543
      IF(NMINUS(4).NE.0)IFNREF=NVALUE(4)
      GO TO 543
C
C     .DISPLAY SUBPAGE
   64 IF(IVALUE.GT.0)KNDSUB=IVALUE
      GO TO 543
C
C     .ENABLE BAR
   65 IF(MRKBAR.NE.0)GO TO 543
      MRKBAR=1
      IF(IFNOTE.EQ.0)IFNMBR=1
      IVALUE=0
      IMINUS=-1
      GO TO 271
C
C     .ENABLE INDEX
   66 IFINDX=1
      GO TO 543
C
C     .END BAR
   67 LCLBAR=0
      NOWBAR=0
      GO TO 543
C
C     .END FILE (OR PHYSICAL EOF) IF IN SPLICE FILE
   68 IF(KNDFIL.LE.0)GO TO 70
      KOMAND=0
   69 IFSPLC=0
      IF(IWIZRD.EQ.0)CALL RNOFIL(4,5,NDISK,NXTUNT,LMTUNT,
     1ITTY,JTTY,IDFILE)
      GO TO 111
C     MAKE SURE HAVE CLOSED SPLICE FILE IF ENCOUNTER EOF
C     IN THE MAIN FILE.  OTHERWISE, USE OF SCRATCH UNITS
C     ACCUMULATES WITH EACH SET OF INPUT FILES PROCESSED.
   70 IF(IFSPLC.EQ.0)GO TO 297
      IFSPLC=0
      IF(IWIZRD.EQ.0)CALL RNOFIL(4,5,NDISK,NXTUNT,LMTUNT,
     1ITTY,JTTY,IDFILE)
      GO TO 297
C
C     .END FOOT NOTE
   71 IF(IFNOTE.EQ.0)GO TO 543
      INNOTE=IFNNOT
      IF(INNOTE.EQ.0)GO TO 72
      NOTLFT=IFNNTL
      NOTRIT=IFNNTR
      NOTSPC=IFNNTS
      NOTFIL=IFNNTF
   72 KNTSPC=IFNKSP
      LNGMID=LNGFTN
      IF(LNGMID.LE.0)GO TO 74
      DO 73 I=1,LNGMID
      LTRMID(I)=LTRFTN(I)
   73 MSKMID(I)=MSKFTN(I)
   74 IREVRS=IFNREV
      ITLALL=IFNALL
      ITLNXT=IFNNXT
      ITLSPA=IFNSPA
      IFNOTE=0
      INDENT=IFNIND
C
C     GET INITIAL VALUE FROM FILE IF NONE OPEN FOR READING
      IF(IFNOPN.LT.0)GO TO 150
      IF(JFNOPN.LT.0)GO TO 150
      IF(JFNOPN.GT.0)GO TO 89
      IF(IFNOPN.EQ.0)GO TO 150
      CALL RNOFIL(1,2,KDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      CALL RNOFIL(1,4,KDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      IFNOPN=-1
      IFNRED=0
   75 READ(KDISK,76)IRECRD,NXTFTN,ILFFTN,IRTFTN,IBRFTN,
     1MXTRSS,NXTRSS
   76 FORMAT(7I3)
      GO TO(77,87,88),IRECRD
   77 IFNRED=IFNRED+1
      IF(NDXKNT.NE.0)GO TO 78
      CALL RNOFIL(5,1,NDXDSK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
   78 NDXKNT=NDXKNT+1
      READ(KDISK,194)KNTNDX,NDXMID,NDXSKP
      IF(NEWCHA.NE.0)GO TO 79
      IF(NEWPAG.NE.0)GO TO 79
      IF(KNTTOP.LT.0)GO TO 79
      IF(IFPAGE.LE.0)GO TO 84
      I=KNDLIN
      IF(LNGMID.GT.0)I=1+KFNGAP+IFNISP
      IF((LOCPAG+IFNGAP+I).GE.LNGPAG)GO TO 79
      GO TO 84
   79 NDXLOC=KNTPAG+IDFRPG+1
      IF(NEWCHA.EQ.0)GO TO 81
      IF(ISECTN.GT.0)GO TO 80
      NDXSEC=IAPNDX
      NDXSHW=KNDAPP
      GO TO 81
   80 NDXSEC=ICHAPT
      NDXSHW=KNDCHA
   81 IF(ISUBPG.EQ.0)GO TO 82
      NDXPAG=NXTPAG+IDFRPG
      NDXPHW=KNDPAG
      IF(ISUBPG.GT.0)GO TO 82
      NDXSUB=0
      GO TO 83
   82 NDXSUB=NXTSUB
   83 NDXSPH=KNDSUB
      GO TO 85
   84 NDXLOC=KNTPAG
      IF(NDXLOC.LE.0)NDXLOC=1
      NDXSEC=NOWSEC
      NDXSHW=NOWSHW
      NDXPAG=NOWPAG
      NDXPHW=NOWPHW
      NDXSUB=NOWSUB
      NDXSPH=NOWSPH
   85 WRITE(NDXDSK,189)NDXLOC,NDXSEC,NDXSHW,NDXPAG,NDXPHW,
     1NDXSUB,NDXSPH,KNTNDX
      READ(KDISK,190)(NUMNDX(I),I=1,KNTNDX)
      WRITE(NDXDSK,190)(NUMNDX(I),I=1,KNTNDX)
   86 CONTINUE
      IF(IFNRED.LT.IFNBGN)GO TO 75
      IFNHAV=0
      GO TO 150
   87 IFNHAV=1
      GO TO 150
   88 IFNRED=IFNRED+1
      IFNTTL=IFNTTL-NXTFTN
      IFNRDY=IFNRDY-NXTFTN
      IFNHAV=0
      GO TO 150
   89 CALL RNOFIL(2,2,LDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      CALL RNOFIL(2,4,LDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      JFNOPN=-1
      JFNRED=0
   90 READ(LDISK,76)IRECRD,NXTFTN,ILFFTN,IRTFTN,IBRFTN,
     1MXTRSS,NXTRSS
      GO TO(91,101,102),IRECRD
   91 JFNRED=JFNRED+1
      IF(NDXKNT.NE.0)GO TO 92
      CALL RNOFIL(5,1,NDXDSK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
   92 NDXKNT=NDXKNT+1
      READ(LDISK,194)KNTNDX,NDXMID,NDXSKP
      IF(NEWCHA.NE.0)GO TO 93
      IF(NEWPAG.NE.0)GO TO 93
      IF(KNTTOP.LT.0)GO TO 93
      IF(IFPAGE.LE.0)GO TO 93
      IF(IFPAGE.LE.0)GO TO 98
      I=KNDLIN
      IF(LNGMID.GT.0)I=1+KFNGAP+IFNISP
      IF((LOCPAG+IFNGAP+KNDLIN+I).GE.LNGPAG)GO TO 93
      GO TO 98
   93 NDXLOC=KNTPAG+IDFRPG+1
      IF(NEWCHA.EQ.0)GO TO 95
      IF(ISECTN.GT.0)GO TO 94
      NDXSEC=IAPNDX
      NDXSHW=KNDAPP
      GO TO 95
   94 NDXSEC=ICHAPT
      NDXSHW=KNDCHA
   95 IF(ISUBPG.EQ.0)GO TO 96
      NDXPAG=NXTPAG+IDFRPG
      NDXPHW=KNDPAG
      IF(ISUBPG.GT.0)GO TO 96
      NDXSUB=0
      GO TO 97
   96 NDXSUB=NXTSUB
   97 NDXSPH=KNDSUB
      GO TO 99
   98 NDXLOC=KNTPAG
      IF(NDXLOC.LE.0)NDXLOC=1
      NDXSEC=NOWSEC
      NDXSHW=NOWSHW
      NDXPAG=NOWPAG
      NDXPHW=NOWPHW
      NDXSUB=NOWSUB
      NDXSPH=NOWSPH
   99 WRITE(NDXDSK,189)NDXLOC,NDXSEC,NDXSHW,NDXPAG,NDXPHW,
     1NDXSUB,NDXSPH,KNTNDX
      READ(LDISK,190)(NUMNDX(I),I=1,KNTNDX)
      WRITE(NDXDSK,190)(NUMNDX(I),I=1,KNTNDX)
  100 CONTINUE
      IF(JFNRED.LT.JFNBGN)GO TO 90
      IFNHAV=0
      GO TO 150
  101 IFNHAV=1
      GO TO 150
  102 JFNRED=JFNRED+1
      IFNTTL=IFNTTL-NXTFTN
      IFNRDY=IFNRDY-NXTFTN
      IFNHAV=0
      GO TO 150
C
C     .END LIST
  103 IF(IFLIST.LE.0)GO TO 543
      NOWLFT=LSTMRG(IFLIST)
      MRGLFT=0
      IF(NOWLFT.GT.0)MRGLFT=NOWLFT
      NOWRIT=LSTRIT(IFLIST)
      IF(MRGFAR.LT.NOWRIT)MRGFAR=NOWRIT
      MRGRIT=NOWRIT
      IF(MRGRIT.GT.(LMTMID-IOFFST))MRGRIT=LMTMID-IOFFST
      ISPACE=LSTSPC(IFLIST)
      IFLIST=IFLIST-1
      GO TO 543
C
C     .END LITERAL
  104 IF(JFILL.NE.6)GO TO 543
      JFILL=IFFILL
      ICENTR=KLMFIL
      KCENTR=KLMMNS
      GO TO 543
C
C     .END LOOP
  105 IF(KNDFIL.GT.0)GO TO 111
      IF(IFLOOP.EQ.0)GO TO 543
      KNTLOP=KNTLOP-1
      IF(IFLOOP.GT.0)GO TO 107
      IF(IFLOOP.EQ.-1)GO TO 110
      IF(KNTLOP.EQ.0)GO TO 106
      IF(KNTLOP.EQ.-1)GO TO 106
C     CLOSE AND RETAIN SCRATCH FILE JUST READ
      CALL RNOFIL(3,5,MDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      GO TO 108
C     CLOSE AND DELETE SCRATCH FILE READ FINAL TIME
  106 CALL RNOFIL(3,6,MDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      GO TO 110
  107 IF(IFLOOP.EQ.1)GO TO 110
      IF(KNTLOP.EQ.0)GO TO 109
      IF(KNTLOP.EQ.-1)GO TO 109
C     CLOSE AND RETAIN SCRATCH FILE JUST WRITTEN
      CALL RNOFIL(3,2,MDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
  108 LMTKAS=MAXBGN
      IFLOOP=-1
      GO TO 543
C     CLOSE AND DELETE SCRATCH FILE JUST WRITTEN
  109 CALL RNOFIL(3,3,MDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
  110 IFLOOP=0
      GO TO 543
  111 IF(IFLOOP.EQ.0)GO TO 113
      KNDSPL=0
      IF(IFLOOP.GT.0)GO TO 112
      IF(IFLOOP.EQ.-1)GO TO 113
      CALL RNOFIL(3,6,MDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      GO TO 113
  112 IF(IFLOOP.EQ.1)GO TO 113
      CALL RNOFIL(3,3,MDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
  113 IFLOOP=0
      IF(KOMAND.EQ.173)GO TO 328
      GO TO 543
C
C     .END NOTE
  114 IF(INNOTE.EQ.0)GO TO 543
      INNOTE=0
      NOWLFT=NOTLFT
      MRGLFT=0
      IF(NOWLFT.GT.0)MRGLFT=NOWLFT
      NOWRIT=NOTRIT
      IF(MRGFAR.LT.NOWRIT)MRGFAR=NOWRIT
      MRGRIT=NOWRIT
      IF(MRGRIT.GT.(LMTMID-IOFFST))MRGRIT=LMTMID-IOFFST
      JFILL=NOTFIL
      IFFILL=NOTFIL
      ICENTR=NOTKLM
      KCENTR=NOTMNS
      ISPACE=NOTSPC
      IF(ISKIP.GE.0)ISKIP=ISKIP+ISPACE+NOTTHR
      INDENT=0
      I=NOTIND
      NOTIND=NOWIND
      NOWIND=I
      I=NOTTST
      NOTTST=NOWTST
      NOWTST=I
      I=NOTSKP
      NOTSKP=NOWSKP
      NOWSKP=I
      GO TO 543
C
C     .END OBJECT
  115 KNDTRN=0
      GO TO 543
C
C     .END SPLICE
  116 IF(KNDFIL.LE.0)GO TO 543
      IFSPLC=-1
      MAXSPL=0
      GO TO 543
C
C     .END SUBPAGE
  117 IF(ISUBPG.LT.0)GO TO 543
      ISUBPG=ISUBPG-2
      NXTSUB=1
      GO TO 543
C
C     .FACING PAGE
  118 LRFORC=1-LFTRIT
      GO TO 543
C
C     .FIGURE
  119 IF(IMINUS.EQ.0)IVALUE=1
      IF(IVALUE.LE.0)GO TO 543
      NVALUE(1)=IVALUE
      IF(IFNOTE.EQ.0)GO TO 377
  120 IF(LINFIG.GT.0)LINFIG=LINFIG+ISPACE
      LINFIG=LINFIG+NVALUE(1)
      GO TO 543
  121 IF(LFTOVR.LE.0)GO TO 120
      IF(LINFIG.GT.0)LINFIG=LINFIG+ISPACE
      LINFIG=LINFIG+NVALUE(1)
      GO TO 285
C
C     .FIGURE DEFERRED
  122 IF(IMINUS.EQ.0)IVALUE=1
      IF(IVALUE.LE.0)GO TO 543
      NVALUE(1)=IVALUE
      IF(IFNOTE.NE.0)GO TO 120
      IF(NXTFIG.EQ.0)GO TO 377
      NXTFIG=NXTFIG+ISPACE
      GO TO 124
  123 IF(LFTOVR.LE.0)GO TO 120
  124 NXTFIG=NXTFIG+NVALUE(1)
      GO TO 543
C
C     .FILL
  125 JFILL=0
      IFFILL=0
      GO TO 543
C
C     .FIRST FORM
  126 INIFRM=1
      GO TO 543
C
C     .FIRST TITLE
  127 NULTTL=1
      IF(NEWPAG.NE.0)NEWPAG=1
      NUMTTL(11)=NEWPAG
      GO TO 543
C
C     .FLAGS ALL
  128 IFFLAG=1
      IF(MRKLES.EQ.-1)MRKLES=1
      IF(MRKDOL.EQ.-1)MRKDOL=1
      IF(MRKBAC.EQ.-1)MRKBAC=1
      IF(MRKUND.EQ.-1)MRKUND=1
      IF(MRKNUM.EQ.-1)MRKNUM=1
      IF(MRKCAR.EQ.-1)MRKCAR=1
      IF(MRKAMP.EQ.-1)MRKAMP=1
      IF(MRKEFN.EQ.-1)MRKEFN=1
      IF(MRKNDX.EQ.-1)MRKNDX=1
      IF(MRKSBX.EQ.-1)MRKSBX=1
      IF(MRKMAG.EQ.-1)MRKMAG=1
      IF(MRKTTL.EQ.-1)MRKTTL=1
      IF(MRKSUP.EQ.-1)MRKSUP=1
      IF(MRKSUB.EQ.-1)MRKSUB=1
      GO TO 543
C
C     .FLAGS CAPITALIZE
  129 IF(IMINUS.GT.0)LTRLES=LTRBGN(IVALUE)
      MRKLES=IFFLAG
      GO TO 543
C
C     .FLAGS CONTROL
  130 IF(IMINUS.GT.0)LTRDOT=LTRBGN(IVALUE)
      MRKDOT=1
      GO TO 543
C
C     .FLAGS END FOOT NOTES
  131 IF(IMINUS.GT.0)LTREFN=LTRBGN(IVALUE)
      MRKEFN=IFFLAG
      GO TO 543
C
C     .FLAGS FENCE
  132 IF(IMINUS.GT.0)LTRSEM=LTRBGN(IVALUE)
      MRKSEM=1
      GO TO 543
C
C     .FLAGS HALFDOWN
  133 IF(IMINUS.GT.0)LTRSUB=LTRBGN(IVALUE)
      MRKSUB=IFFLAG
      GO TO 543
C
C     .FLAGS HALFUP
  134 IF(IMINUS.GT.0)LTRSUP=LTRBGN(IVALUE)
      MRKSUP=IFFLAG
      GO TO 543
C
C     .FLAGS INDEX
  135 IF(IMINUS.GT.0)LTRNDX=LTRBGN(IVALUE)
      MRKNDX=IFFLAG
      GO TO 543
C
C     .FLAGS LOWER CASE
  136 IF(IMINUS.GT.0)LTRBAC=LTRBGN(IVALUE)
      MRKBAC=IFFLAG
      GO TO 543
C
C     .FLAGS MAGNIFY
  137 IF(IMINUS.GT.0)LTRMAG=LTRBGN(IVALUE)
      MRKMAG=IFFLAG
      GO TO 543
C
C     .FLAGS PAGE
  138 IF(IMINUS.GT.0)LTRPUT=LTRBGN(IVALUE)
      MRKTTL=IFFLAG
      GO TO 543
C
C     .FLAGS QUOTE
  139 IF(IMINUS.GT.0)LTRUND=LTRBGN(IVALUE)
      MRKUND=IFFLAG
      GO TO 543
C
C     .FLAGS REMARK
  140 IF(IMINUS.GT.0)LTREXC=LTRBGN(IVALUE)
      MRKEXC=1
      GO TO 543
C
C     .FLAGS SPACE
  141 IF(IMINUS.GT.0)LTRNUM=LTRBGN(IVALUE)
      MRKNUM=IFFLAG
      GO TO 543
C
C     .FLAGS SUBINDEX
  142 IF(IMINUS.GT.0)LTRSBX=LTRBGN(IVALUE)
      MRKSBX=IFFLAG
      GO TO 543
C
C     .FLAGS TEXT
  143 IF(IMINUS.GT.0)LTRTXT=LTRBGN(IVALUE)
      MRKTXT=1
      GO TO 543
C
C     .FLAGS UNDER LINE
  144 IF(IMINUS.GT.0)LTRAMP=LTRBGN(IVALUE)
      MRKAMP=IFFLAG
      GO TO 543
C
C     .FLAGS UPPER CASE
  145 IF(IMINUS.GT.0)LTRCAR=LTRBGN(IVALUE)
      MRKCAR=IFFLAG
      GO TO 543
C
C     .FOOT NOTE
  146 IF(IFNOTE.NE.0)GO TO 543
      KNDTRN=0
      LSTTRN=0
      NOWFTN=KNTFTN
      KNTFTN=KNTFTN+1
      IFNNOT=INNOTE
      IF(INNOTE.EQ.0)GO TO 147
      INNOTE=0
      IFNNTL=NOTLFT
      IFNNTR=NOTRIT
      IFNNTS=NOTSPC
      IFNNTF=NOTFIL
  147 ISKFTN=ISKFTN+LFNGAP
      IFNKSP=KNTSPC
      KNTSPC=0
      LNGFTN=LNGMID
      LNGMID=0
      IF(LNGFTN.LE.0)GO TO 149
      DO 148 I=1,LNGFTN
      LTRFTN(I)=LTRMID(I)
  148 MSKFTN(I)=MSKMID(I)
  149 IFNREV=IREVRS
      IREVRS=1
      IFNALL=ITLALL
      IFNNXT=ITLNXT
      IFNSPA=ITLSPA
      IFNLSP=LCLSUP
      IFNGSP=LOKSUP
      ITLALL=0
      ITLNXT=0
      ITLSPA=0
      LCLSUP=0
      LOKSUP=0
      IFNOTE=1
      IF(NUMFTN.NE.0)IFNOTE=-1
      IFNBGN=IFNRIT
      JFNBGN=JFNRIT
      IFNIND=INDENT
      INDENT=INDFTN
C
C     INTERCHANGE TEXT AND FOOTNOTE CONDITIONS
  150 I=IFNNLF
      IFNNLF=NOWLFT
      NOWLFT=I
      I=IFNMLF
      IFNMLF=MRGLFT
      MRGLFT=I
      I=IFNOFF
      IFNOFF=IOFFST
      IOFFST=I
      I=IFNNOF
      IFNNOF=NOWOFF
      NOWOFF=I
      I=IFNNRT
      IFNNRT=NOWRIT
      NOWRIT=I
      I=IFNMFR
      IFNMFR=MRGFAR
      MRGFAR=I
      I=IFNMRT
      IFNMRT=MRGRIT
      MRGRIT=I
      I=IFNFIL
      IFNFIL=IFFILL
      IFFILL=I
      I=IFNJST
      IFNJST=JSTIFY
      JSTIFY=I
      I=ISKFTN
      ISKFTN=ISKIP
      ISKIP=I
      I=IFNISP
      IFNISP=ISPACE
      ISPACE=I
      I=IFNNT1
      IFNNT1=NOTONE
      NOTONE=I
      I=IFNNT2
      IFNNT2=NOTTWO
      NOTTWO=I
      I=IFNNT3
      IFNNT3=NOTTHR
      NOTTHR=I
      I=IFNIBR
      IFNIBR=INIBAR
      INIBAR=I
      I=IFNMBR
      IFNMBR=MRKBAR
      MRKBAR=I
      I=IFNNBR
      IFNNBR=NOWBAR
      NOWBAR=I
      I=IFNICN
      IFNICN=ICENTR
      ICENTR=I
      I=IFNJFL
      IFNJFL=JFILL
      JFILL=I
      I=IFNJCN
      IFNJCN=JCENTR
      JCENTR=I
      I=IFNKCN
      IFNKCN=KCENTR
      KCENTR=I
      I=IFNLBR
      IFNLBR=LCLBAR
      LCLBAR=I
      I=IFNPRD
      IFNPRD=IPEROD
      IPEROD=I
      I=IFNATO
      IFNATO=IFAUTO
      IFAUTO=I
      I=IFNKLM
      IFNKLM=KLMFIL
      KLMFIL=I
      I=IFNMNS
      IFNMNS=KLMMNS
      KLMMNS=I
      I=IFNPIN
      IFNPIN=NOWIND
      NOWIND=I
      I=IFNPSK
      IFNPSK=NOWSKP
      NOWSKP=I
      I=IFNPTS
      IFNPTS=NOWTST
      NOWTST=I
      I=IFNIIN
      IFNIIN=INTIND
      INTIND=I
      I=IFNILF
      IFNILF=INTLFT
      INTLFT=I
      I=IFNIRT
      IFNIRT=INTRIT
      INTRIT=I
      I=IFNNIN
      IFNNIN=NOTIND
      NOTIND=I
      I=IFNNTT
      IFNNTT=NOTTST
      NOTTST=I
      I=IFNNSK
      IFNNSK=NOTSKP
      NOTSKP=I
      I=IFNULS
      IFNULS=IULSPC
      IULSPC=I
      I=IFNLOF
      IFNLOF=LFTOFF
      LFTOFF=I
      I=IFNROF
      IFNROF=IRTOFF
      IRTOFF=I
      I=IFNLBS
      IFNLBS=LFTBAS
      LFTBAS=I
      I=IFNRBS
      IFNRBS=IRTBAS
      IRTBAS=I
      I=IFNIFA
      IFNIFA=IFABAR
      IFABAR=I
      I=IFNIDF
      IFNIDF=NXTFIG
      NXTFIG=I
      I=IFNJDF
      IFNJDF=JDFRFG
      JDFRFG=I
      I=IFNKDF
      IFNKDF=KDFRFG
      KDFRFG=I
      GO TO 543
C
C     .FOOT NOTE HEADER
  151 LNGFNR=0
      IF(KNTARG.LE.0)GO TO 153
      IF(NMINUS(KNTARG).LE.0)GO TO 153
      IFIRST=NVALUE(KNTARG)
      IFINAL=IFIRST+NMINUS(KNTARG)-1
  152 IF(IFIRST.GT.IFINAL)GO TO 153
      IF(LNGFNR.GE.LMTFNR)GO TO 153
      LNGFNR=LNGFNR+1
      LTRFNR(LNGFNR)=LTRBGN(IFIRST)
      MSKFNR(LNGFNR)=MSKBGN(IFIRST)
      IFIRST=IFIRST+1
      GO TO 152
  153 GO TO 459
C
C     .FOOT NOTE RULE
  154 LNGFNR=0
      IF(IMINUS.LE.0)GO TO 459
      LTRFNR(1)=LTRBGN(IVALUE)
      MSKFNR(1)=MSKBGN(IVALUE)
      LNGFNR=-1
      GO TO 459
C
C     .HEADER
  155 IFHEAD=1
      GO TO 543
C
C     .HEADER LEVEL
  156 IF(IMINUS.LE.0)IVALUE=KNTLVL+IVALUE
      IF(IVALUE.LE.0)IVALUE=1
      IF(IVALUE.GT.LMTLVL)IVALUE=LMTLVL
      IF(KNTARG.LT.2)GO TO 164
      IF(NMINUS(2).LE.0)GO TO 165
      IF(IVALUE.GT.INITAL)GO TO 165
      I=NVALUE(2)
      J=NMINUS(2)
      K=0
  157 MSKBIT=MSKBGN(I)
      CALL RNOUNP(1,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 158
      K=0
      GO TO 163
  158 IF(K.EQ.0)GO TO 159
      IF(IVALUE.GT.KAPITL)GO TO 163
  159 MSKBIT=MSKBGN(I)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 162
      LTRNOW=LTRBGN(I)
      IF(MRKNDX.LE.0)GO TO 160
      IF(LTRNOW.EQ.LTRNDX)GO TO 163
  160 DO 161 M=1,26
      IF(LTRNOW.NE.LWRABC(M))GO TO 161
      LTRBGN(I)=LTRABC(M)
      GO TO 162
  161 CONTINUE
  162 K=1
  163 I=I+1
      J=J-1
      IF(J.GT.0)GO TO 157
      GO TO 165
  164 IF(KOMAND.NE.181)GO TO 165
      JSKIP=0
      NXTHDR=IVALUE
      GO TO 166
  165 JSKIP=2
      NXTHDR=0
  166 I=0
      IF(KSKIP.NE.0)I=LEVEL1
      IF(ISKIP.GE.0)ISKIP=ISKIP+I
      IF(IVALUE.GE.IRUNIN)GO TO 294
      IVALUE=LEVEL3+(NOWTST+1)+(NOWTST*ISPACE)
      IMINUS=1
      GO TO 377
C
C     .IMMEDIATE FOOT NOTES
  167 IDEFER=0
      GO TO 543
C
C     .INDENT
  168 INDENT=5
      IF(IMINUS.NE.0)INDENT=IVALUE
      GO TO 543
C
C     .INDENT FOOTNOTES
  169 IF(IMINUS.NE.0)INDFTN=IVALUE
      GO TO 543
C
C     .INDENT LEVELS
  170 IF(IMINUS.NE.0)LEVEL4=IVALUE
      GO TO 543
C
C     .INDENT LIST
  171 IF(IFLIST.LE.0)GO TO 543
      IF(IMINUS.NE.0)INDLST(IFLIST)=IVALUE
      GO TO 220
C
C     .INDENT NOTE
  172 IF(KNTARG.LE.0)GO TO 543
      IF(IMINUS.EQ.0)GO TO 173
      INTIND=IVALUE
      IF(INNOTE.EQ.0)NOTIND=INTIND
      IF(INNOTE.NE.0)NOWIND=INTIND
  173 IF(KNTARG.LE.1)GO TO 543
      IF(NMINUS(2).NE.0)INTLFT=NVALUE(2)
      IF(KNTARG.LE.2)GO TO 543
      IF(NMINUS(3).NE.0)INTRIT=NVALUE(3)
      GO TO 543
C
C     .INDEX
  174 IF(IMINUS.LE.0)GO TO 543
      IF(IFINDX.EQ.0)GO TO 543
      IVALUE=NVALUE(1)
      IMINUS=IVALUE+NMINUS(1)-1
  175 IF(IVALUE.GT.IMINUS)GO TO 543
      IF(LTRBGN(IVALUE).NE.LTRSPA)GO TO 176
      IVALUE=IVALUE+1
      GO TO 175
  176 KNTNDX=0
      CALL RNOCOD
      IF(KNTNDX.LE.0)GO TO 543
      IF(KOMAND.EQ.131)GO TO 179
  177 IF(IFNOTE.NE.0)GO TO 191
      IVALUE=1
      IF(NEWCHA.NE.0)GO TO 180
      IF(NEWPAG.NE.0)GO TO 180
      IF(KNTTOP.LT.0)GO TO 180
      IF(LNGMID.GT.0)GO TO 377
C     LINE FITS ON CURRENT PAGE
  178 NDXLOC=KNTPAG
      IF(NDXLOC.EQ.0)NDXLOC=1
      NDXSEC=NOWSEC
      NDXSHW=NOWSHW
      NDXPAG=NOWPAG
      NDXPHW=NOWPHW
      NDXSUB=NOWSUB
      NDXSPH=NOWSPH
      GO TO 187
C     ENTRY COMMAND, NO PAGE NUMBER
  179 NDXLOC=0
      NDXSEC=0
      NDXSHW=0
      NDXPAG=0
      NDXPHW=0
      NDXSUB=0
      NDXSPH=0
      GO TO 187
C     LINE GOES ON NEXT PAGE
  180 NDXLOC=KNTPAG+IDFRPG+1
      IF(NEWCHA.EQ.0)GO TO 182
      IF(ISECTN.GT.0)GO TO 181
      NDXSEC=IAPNDX
      NDXSHW=KNDAPP
      GO TO 183
  181 NDXSEC=ICHAPT
      NDXSHW=KNDCHA
      GO TO 183
  182 NDXSEC=NOWSEC
      NDXSHW=NOWSHW
  183 IF(ISUBPG.EQ.0)GO TO 184
      NDXPAG=NXTPAG+IDFRPG
      NDXPHW=KNDPAG
      IF(ISUBPG.GT.0)GO TO 185
      NDXSUB=0
      GO TO 186
  184 NDXPAG=NOWPAG+IDFRPG
      NDXPHW=NOWPHW
  185 NDXSUB=NXTSUB
  186 NDXSPH=KNDSUB
  187 IVALUE=NVALUE(1)
      IMINUS=NMINUS(1)
      IF(NDXKNT.NE.0)GO TO 188
      CALL RNOFIL(5,1,NDXDSK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
  188 NDXKNT=NDXKNT+1
      WRITE(NDXDSK,189)NDXLOC,NDXSEC,NDXSHW,NDXPAG,NDXPHW,
     1NDXSUB,NDXSPH,KNTNDX
  189 FORMAT(10I5)
      WRITE(NDXDSK,190)(NUMNDX(I),I=1,KNTNDX)
  190 FORMAT(24I3)
      GO TO 543
  191 CONTINUE
      IF(IFNOPN.GT.0)GO TO 192
      IF(JFNOPN.GT.0)GO TO 196
      IF(IFNOPN.LT.0)GO TO 195
      IFNOPN=1
      IFNRIT=0
      IFNRED=0
      IFNBGN=0
      CALL RNOFIL(1,1,KDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
  192 IFNRIT=IFNRIT+1
      WRITE(KDISK,193)
  193 FORMAT(21H  1  0  0  0  0  0  0)
      WRITE(KDISK,194)KNTNDX,LNGMID,ISKIP
  194 FORMAT(10I5)
      WRITE(KDISK,190)(NUMNDX(I),I=1,KNTNDX)
      IF(LNGFTN.LE.0)IFNRDY=IFNTTL
      IF(LNGFTN.LE.0)IFNBGN=IFNRIT
      GO TO 197
  195 JFNOPN=1
      JFNRIT=0
      JFNRED=0
      JFNBGN=0
      CALL RNOFIL(2,1,LDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
  196 JFNRIT=JFNRIT+1
      WRITE(LDISK,193)
      WRITE(LDISK,194)KNTNDX,LNGMID,ISKIP
      WRITE(LDISK,190)(NUMNDX(I),I=1,KNTNDX)
      IF(LNGFTN.LE.0)IFNRDY=IFNTTL
      IF(LNGFTN.LE.0)JFNBGN=JFNRIT
  197 CONTINUE
      GO TO 543
C
C     .INITIAL PAGE
  198 NULTTL=-1
      NEWPAG=-1
      GO TO 543
C
C     .INPUT WIDTH
  199 IF(KNDFIL.LT.0)GO TO 543
      IF(KNDFIL.EQ.0)GO TO 200
      LNGSPL=LNGSPL-LSNSPL
      IF(IMINUS.LT.0)IVALUE=LNGSPL+IVALUE
      IF(IVALUE.GT.0)LNGSPL=IVALUE
      LNGSPL=LNGSPL+LSNSPL
      IF(LNGSPL.GT.LMTBGN)LNGSPL=LMTBGN
      GO TO 543
  200 LNGSRC=LNGSRC-LSNSRC
      IF(IMINUS.LT.0)IVALUE=LNGSRC+IVALUE
      IF(IVALUE.GT.0)LNGSRC=IVALUE
      LNGSRC=LNGSRC+LSNSRC
      IF(LNGSRC.GT.LMTBGN)LNGSRC=LMTBGN
      GO TO 543
C
C     .JOIN
  201 IF(LNGMID.LE.0)GO TO 543
      IF(IFNOTE.NE.0)GO TO 543
      KONECT=1
      GO TO 543
C
C     .JUSTIFY
  202 JSTIFY=1
      GO TO 543
C
C     .LAST FORM
  203 LSTFRM=1
      GO TO 543
C
C     .LEFT EDGE, .RIGHT EDGE
  204 IF(IFNOTE.NE.0)GO TO 543
      KNDTRN=4
      KNTSHD=0
      LNGSHD=0
      LNGTRN=1
      NGLSHD=1
      INIOJB=0
      IF(KNTARG.LE.0)GO TO 207
      IF(IMINUS.LE.0)GO TO 206
      IFIRST=IVALUE
      IFINAL=IFIRST+IMINUS-1
  205 IF(IFIRST.GT.IFINAL)GO TO 206
      IF(LNGSHD.GE.LMTSHD)GO TO 206
      LNGSHD=LNGSHD+1
      LTRSHD(LNGSHD)=LTRBGN(IFIRST)
      IFIRST=IFIRST+1
      GO TO 205
C     WIDTH OF EDGE
  206 IF(KNTARG.LT.2)GO TO 207
      IF(NVALUE(2).NE.0)LNGTRN=NVALUE(2)
C     PHRASE REPLICATION SLANT
      IF(KNTARG.LT.3)GO TO 207
      IF(NMINUS(3).NE.0)NGLSHD=NVALUE(3)
      IF(NGLSHD.LE.(-LNGSHD))NGLSHD=0
      IF(NGLSHD.GE.LNGSHD)NGLSHD=0
C     ORIENATION OF SUPERIMPOSED PATTERN
      IF(KNTARG.LT.4)GO TO 207
      IF(NMINUS(4).NE.0)INIOBJ=NVALUE(4)
  207 IF(KOMAND.EQ.185)LNGTRN=-LNGTRN
      GO TO 543
C
C     .LEFT MARGIN
  208 IF(IMINUS.LT.0)IVALUE=NOWLFT+IVALUE
      NOWLFT=IVALUE
      MRGLFT=0
      IF(NOWLFT.GT.0)MRGLFT=NOWLFT
      GO TO 543
C
C     .LEFT NO FILL
  209 JFILL=3
      GO TO 304
C
C     .LEFT PAGE
  210 LRFORC=0
      GO TO 543
C
C     .LETTER
  211 MAGNFY=-1
      LNGBIG=0
      IF(KNTARG.LE.0)GO TO 214
      IF(IMINUS.LE.0)GO TO 213
      IFIRST=IVALUE
      IFINAL=IFIRST+IMINUS-1
  212 IF(IFIRST.GT.IFINAL)GO TO 213
      IF(LNGBIG.GE.LMTBIG)GO TO 213
      LNGBIG=LNGBIG+1
      LTRBIG(LNGBIG)=LTRBGN(IFIRST)
      IFIRST=IFIRST+1
      GO TO 212
  213 IF(KNTARG.LE.1)GO TO 214
      IF(NMINUS(2).NE.0)MAGFNT=NVALUE(2)
      IF(KNTARG.LE.2)GO TO 214
      IF(NMINUS(3).NE.0)MAGSPC=NVALUE(3)
      IF(KNTARG.LE.3)GO TO 214
      IF(NMINUS(4).NE.0)MAGSHD=NVALUE(4)
      IF(KNTARG.LE.4)GO TO 214
      IF(NMINUS(5).NE.0)NGLBIG=NVALUE(5)
      IF(KNTARG.LE.5)GO TO 214
      IF(NMINUS(6).NE.0)INIMAG=NVALUE(6)
  214 GO TO 543
C
C     .LIST
  215 IF(IFLIST.GE.LMTLST)GO TO 543
      IFLIST=IFLIST+1
      IF(IFLIST.LE.MSTLST)GO TO 216
      MSTLST=IFLIST
      LTROPN(IFLIST)=LTRSPA
      LTRCLS(IFLIST)=1H.
      LSTTYP(IFLIST)=1
      INDLST(IFLIST)=0
      LSTSKP(IFLIST)=NOWLST
  216 LSTVAL(IFLIST)=1
      LSTSPC(IFLIST)=ISPACE
      IF(IMINUS.EQ.0)GO TO 217
      IF(IVALUE.GE.0)LSTSKP(IFLIST)=IVALUE
  217 NOWLST=LSTSKP(IFLIST)
      IF(KNTARG.LE.1)GO TO 219
      IF(NMINUS(2).LE.0)GO TO 219
      IVALUE=NVALUE(2)
      IMINUS=NMINUS(2)
      IF(IMINUS.GT.6)IMINUS=6
      DO 218 I=1,IMINUS
      LTRLST(IFLIST,I)=LTRBGN(IVALUE)
      IVALUE=IVALUE+1
  218 CONTINUE
      LSTTYP(IFLIST)=-IMINUS
      LTRCLS(IFLIST)=LTRSPA
  219 LSTMRG(IFLIST)=NOWLFT
      LSTRIT(IFLIST)=NOWRIT
  220 I=3
      IF(LSTTYP(IFLIST).LT.0)I=2-LSTTYP(IFLIST)
      IF(LTROPN(IFLIST).NE.LTRSPA)I=I+1
      IF(LTRCLS(IFLIST).NE.LTRSPA)I=I+1
      IF(I.LT.INDLST(IFLIST))I=INDLST(IFLIST)
      NOWLFT=LSTMRG(IFLIST)+I-INDLST(IFLIST)
      MRGLFT=0
      IF(NOWLFT.GT.0)MRGLFT=NOWLFT
      GO TO 543
C
C     .LIST ELEMENT
  221 IF(IFLIST.LE.0)GO TO 543
      I=3
      IF(LSTTYP(IFLIST).LT.0)I=2-LSTTYP(IFLIST)
      IF(LTROPN(IFLIST).NE.LTRSPA)I=I+1
      IF(LTRCLS(IFLIST).NE.LTRSPA)I=I+1
      IF(I.LT.INDLST(IFLIST))I=INDLST(IFLIST)
      NOWLFT=LSTMRG(IFLIST)+I-INDLST(IFLIST)
      MRGLFT=0
      IF(NOWLFT.GT.0)MRGLFT=NOWLFT
      NOWRIT=LSTRIT(IFLIST)
      IF(MRGFAR.LT.NOWRIT)MRGFAR=NOWRIT
      MRGRIT=NOWRIT
      IF(MRGRIT.GT.(LMTMID-IOFFST))MRGRIT=LMTMID-IOFFST
      ISPACE=LSTSPC(IFLIST)
      LSTELM=1
      IF(ISKIP.LT.0)GO TO 543
      ISKIP=ISKIP+LSTSKP(IFLIST)
      GO TO 294
C
C     .LITERAL
  222 JFILL=6
      GO TO 304
C
C     .LOOP
  223 IF(IFLOOP.NE.0)GO TO 543
      IF(IVALUE.EQ.1)GO TO 543
      IF(IVALUE.LT.0)GO TO 543
      IFLOOP=1
      KNTLOP=IVALUE
      IF(LMTKAS.GE.MAXBGN)GO TO 543
      IF(KNDFIL.NE.0)GO TO 543
      IFLOOP=2
      CALL RNOFIL(3,1,MDISK,NXTUNT,LMTUNT,ITTY,JTTY,IDFILE)
      I=MAXBGN-LMTKAS
      WRITE(MDISK,224)I
  224 FORMAT(1I3)
      J=LMTKAS+1
      WRITE(MDISK,225)(LTRBGN(I),I=J,MAXBGN)
  225 FORMAT(300A1)
      GO TO 543
C
C     .LOWER CASE, CORRESPONDS TO \\ IN TEXT
  226 KASALL=1
      GO TO 543
C
C     .MOVABLE PAGE
  227 IF(IVALUE.LE.0)IVALUE=1
      IF(IFNOTE.NE.0)GO TO 228
      IF(LNGMID.NE.0)GO TO 228
      IDFRPG=IDFRPG+IVALUE
      GO TO 543
  228 JDFRPG=JDFRPG+IVALUE
      GO TO 543
C
C     .NO AUTO PARAGRAPH
  229 IFAUTO=0
      IFNATO=0
      GO TO 543
C
C     .NO FLAGS ALL
  230 IFFLAG=-1
      IF(MRKLES.EQ.1)MRKLES=-1
      IF(MRKDOL.EQ.1)MRKDOL=-1
      IF(MRKBAC.EQ.1)MRKBAC=-1
      IF(MRKUND.EQ.1)MRKUND=-1
      IF(MRKNUM.EQ.1)MRKNUM=-1
      IF(MRKCAR.EQ.1)MRKCAR=-1
      IF(MRKAMP.EQ.1)MRKAMP=-1
      IF(MRKEFN.EQ.1)MRKEFN=-1
      IF(MRKNDX.EQ.1)MRKNDX=-1
      IF(MRKSBX.EQ.1)MRKSBX=-1
      IF(MRKMAG.EQ.1)MRKMAG=-1
      IF(MRKTTL.EQ.1)MRKTTL=-1
      IF(MRKSUP.EQ.1)MRKSUP=-1
      IF(MRKSUB.EQ.1)MRKSUB=-1
      GO TO 543
C
C     .NO FLAGS CAPITALIZE
  231 MRKLES=0
      GO TO 543
C
C     .NO FLAGS CONTROL
  232 MRKDOT=0
      GO TO 543
C
C     .NO FLAGS END FOOT NOTES
  233 MRKEFN=0
      GO TO 56
C
C     .NO FLAGS FENCE
  234 MRKSEM=0
      GO TO 543
C
C     .NO FLAGS HALFDOWN
  235 MRKSUB=0
      GO TO 543
C
C     .NO FLAGS HALFUP
  236 MRKSUP=0
      GO TO 543
C
C     .NO FLAGS INDEX
  237 MRKNDX=0
      GO TO 543
C
C     .NO FLAGS LOWER CASE
  238 MRKBAC=0
      GO TO 543
C
C     .NO FLAGS MAGNIFY
  239 MRKMAG=0
      GO TO 543
C
C     .NO FLAGS PAGE
  240 MRKTTL=0
      GO TO 543
C
C     .NO FLAGS QUOTE
  241 MRKUND=0
      GO TO 543
C
C     .NO FLAGS REMARK
  242 MRKEXC=0
      GO TO 543
C
C     .NO FLAGS SPACE
  243 MRKNUM=0
      GO TO 543
C
C     .NO FLAGS SUBINDEX
  244 MRKSBX=0
      GO TO 543
C
C     .NO FLAGS TEXT
  245 MRKTXT=0
      GO TO 543
C
C     .NO FLAGS UNDER LINE
  246 MRKAMP=0
      GO TO 543
C
C     .NO FLAGS UPPER CASE
  247 MRKCAR=0
      GO TO 543
C
C     .NO FOOT NOTE HEADER
  248 LNGFNR=0
      IFNGAP=0
      GO TO 543
C
C     .NO HEADER
  249 IFHEAD=0
      GO TO 543
C
C     .NO JUSTIFY
  250 JSTIFY=0
      GO TO 543
C
C     .NO NUMBER
  251 IFNUMB=0
      GO TO 543
C
C     .NO NUMBER FOOTNOTES
  252 NUMFTN=0
      GO TO 543
C
C     .NO OFFSET
  253 IVALUE=0
      IMINUS=1
      GO TO 271
C
C     .NO PAGING
  254 IFPAGE=0
      GO TO 543
C
C     .NO PERIOD
  255 IPEROD=0
      GO TO 543
C
C     .NO UNDERLINE SPACE
  256 IULSPC=1
      GO TO 543
C
C     .NOTE
  257 IF(INNOTE.NE.0)GO TO 543
      INNOTE=1
      NOTLFT=NOWLFT
      NOWLFT=NOWLFT+INTLFT
      MRGLFT=0
      IF(NOWLFT.GT.0)MRGLFT=NOWLFT
      NOTRIT=NOWRIT
      NOWRIT=NOWRIT+INTRIT
      IF(MRGFAR.LT.NOWRIT)MRGFAR=NOWRIT
      MRGRIT=NOWRIT
      IF(MRGRIT.GT.(LMTMID-IOFFST))MRGRIT=LMTMID-IOFFST
      NOTFIL=IFFILL
      NOTKLM=ICENTR
      NOTMNS=KCENTR
      IFFILL=0
      JFILL=0
      NOTSPC=ISPACE
      ISPACE=0
      IF(ISKIP.GE.0)ISKIP=ISKIP+NOTONE
      I=NOTIND
      NOTIND=NOWIND
      NOWIND=I
      I=NOTTST
      NOTTST=NOWTST
      NOWTST=I
      I=NOTSKP
      NOTSKP=NOWSKP
      NOWSKP=I
      IF(KNTARG.LE.0)GO TO 258
      IF(NMINUS(KNTARG).LE.0)GO TO 258
      JSKIP=6
      IVALUE=NOTTWO+1+NOWTST
      IMINUS=1
      GO TO 384
  258 INDENT=INTIND
      GO TO 294
C
C     .NUMBER APPENDIX
  259 IFNUMB=1
      IF(IMINUS.EQ.0)GO TO 543
      IF(IMINUS.LT.0)IVALUE=IAPNDX+IVALUE
      IF(IVALUE.GE.0)IAPNDX=IVALUE
      GO TO 543
C
C     .NUMBER CHAPTER
  260 IFNUMB=1
      IF(IMINUS.EQ.0)GO TO 543
      IF(IMINUS.LT.0)IVALUE=ICHAPT+IVALUE
      IF(IVALUE.GE.0)ICHAPT=IVALUE
      GO TO 543
C
C     .NUMBER FOOTNOTES
  261 NUMFTN=1
      IF(IMINUS.LE.0)IVALUE=IVALUE+KNTFTN
      IF(IVALUE.GT.0)KNTFTN=IVALUE
      GO TO 543
C
C     .NUMBER LEVELS
  262 IF(KNTARG.LE.0)GO TO 543
      IF(KNTARG.GT.LMTLVL)KNTARG=LMTLVL
      DO 263 I=1,KNTARG
      IF(I.GT.KNTLVL)NUMLVL(I)=0
      IF(NMINUS(I).LE.0)NVALUE(I)=NUMLVL(I)+NVALUE(I)
      IF(NVALUE(I).GE.0)NUMLVL(I)=NVALUE(I)
  263 CONTINUE
      KNTLVL=KNTARG
      NXTLVL=KNTLVL
      GO TO 543
C
C     .NUMBER LIST
  264 IF(IMINUS.LT.0)IVALUE=IFLIST+IVALUE
      IF(IMINUS.EQ.0)IVALUE=IFLIST
      IF(IVALUE.LE.0)GO TO 543
      IF(IVALUE.GT.IFLIST)GO TO 543
      IF(KNTARG.LT.2)GO TO 543
      IF(NMINUS(2).LT.0)NVALUE(2)=NVALUE(2)+LSTVAL(IVALUE)
      IF(NVALUE(2).GT.0)LSTVAL(IVALUE)=NVALUE(2)
      GO TO 543
C
C     .NUMBER PAGE
  265 IFNUMB=1
      IF(IMINUS.EQ.0)GO TO 543
      IF(IMINUS.LT.0)IVALUE=NXTPAG+IVALUE
      IF(IVALUE.GT.0)NXTPAG=IVALUE
      GO TO 543
C
C     .NUMBER SUBPAGE
  266 IF(IMINUS.EQ.0)GO TO 543
      IF(IMINUS.LT.0)IVALUE=NXTSUB+IVALUE
      IF(IVALUE.GT.0)NXTSUB=IVALUE
      GO TO 543
C
C     .OFFSET LEFT
  267 JVALUE=IVALUE
      IF(IMINUS.LE.0)IVALUE=LFTBAS-JOFFST+IVALUE
      LFTBAS=IVALUE+JOFFST
      IF(IFNOTE.NE.0)GO TO 268
      IF(IMINUS.LE.0)JVALUE=IFNLBS-JOFFST+JVALUE
      IFNLBS=JVALUE+JOFFST
  268 IVALUE=0
      IMINUS=-1
      GO TO 271
C
C     .OFFSET RIGHT
  269 JVALUE=IVALUE
      IF(IMINUS.LE.0)IVALUE=IRTBAS-JOFFST+IVALUE
      IRTBAS=IVALUE+JOFFST
      IF(IFNOTE.NE.0)GO TO 270
      IF(IMINUS.LE.0)JVALUE=IFNRBS-JOFFST+JVALUE
      IFNRBS=JVALUE+JOFFST
  270 IVALUE=0
      IMINUS=-1
      GO TO 271
C
C     .OFFSET
  271 JVALUE=IVALUE
      KVALUE=IVALUE
      IF(IMINUS.GT.0)GO TO 272
      JVALUE=LFTBAS-JOFFST+JVALUE
      KVALUE=IRTBAS-JOFFST+KVALUE
  272 LFTBAS=JOFFST+JVALUE
      IRTBAS=JOFFST+KVALUE
      IF(JVALUE.LT.0)JVALUE=0
      IF(KVALUE.LT.0)KVALUE=0
      IF(MRKBAR.NE.0)GO TO 273
      IF(IFNOTE.EQ.0)GO TO 274
      IF(IFNMBR.EQ.0)GO TO 274
  273 IF(JVALUE.LT.3)JVALUE=3
      IF(KVALUE.LT.3)KVALUE=3
  274 LFTOFF=JOFFST+JVALUE
      IRTOFF=JOFFST+KVALUE
      IOFFST=LFTOFF
      NOWOFF=LFTBAS
      IF(LFTRIT.NE.0)IOFFST=IRTOFF
      IF(LFTRIT.NE.0)NOWOFF=IRTBAS
      IF(MRKBAR.GT.0)MRKBAR=IOFFST-2
      IF(LCLBAR.NE.0)NOWBAR=MRKBAR
      IF(MRKBAR.LE.0)GO TO 275
      IF(IFABAR.GT.0)IFABAR=MRKBAR
  275 INIBAR=NOWBAR
      MRGRIT=NOWRIT
      IF(MRGRIT.GT.(LMTMID-IOFFST))MRGRIT=LMTMID-IOFFST
C     IF NOT IN FOOTNOTE, APPLY OFFSET TO FOOTNOTE ALSO
  276 IF(IFNOTE.NE.0)GO TO 543
      JVALUE=IVALUE
      IF(IMINUS.LE.0)JVALUE=IFNLBS-JOFFST+JVALUE
      IFNLBS=JOFFST+JVALUE
      IF(JVALUE.LT.0)JVALUE=0
      IF(IFNMBR.EQ.0)GO TO 277
      IF(JVALUE.LT.3)JVALUE=3
  277 IFNLOF=JOFFST+JVALUE
      KVALUE=IVALUE
      IF(IMINUS.LE.0)KVALUE=IFNRBS-JOFFST+KVALUE
      IFNRBS=JOFFST+KVALUE
      IF(KVALUE.LT.0)KVALUE=0
      IF(IFNMBR.EQ.0)GO TO 278
      IF(KVALUE.LT.3)KVALUE=3
  278 IFNROF=JOFFST+KVALUE
C     IF(IFNMBR.GT.0)IFNMBR=IFNOFF-2
C     IF(IFNLBR.NE.0)IFNNBR=IFNMBR
C     IFNMLF=IFNNLF+IFNOFF
C     IF(IFNMLF.LT.IFNOFF)IFNMLF=IFNOFF
C     IFNMRT=IFNNRT+IFNOFF
C     IF(IFNMRT.GT.LMTMID)IFNMRT=LMTMID
      GO TO 543
C
C     .OMIT PAGE
  279 IPGSHO=0
      GO TO 543
C
C     .OPEN SPLICE
C     INACTIVE IF READ FROM SPLICE FILE ITSELF
  280 IF(IFSPLC.GT.0)GO TO 543
      IF(IFSPLC.EQ.0)GO TO 111
      GO TO 69
C
C     .OUTLINE
  281 IF(IFNOTE.NE.0)GO TO 543
      KNDTRN=7
      KNTSHD=0
      LNGSHD=0
      LNGTRN=1
      IBORDR=1
      NGLSHD=1
      JBORDR=0
      INIOBJ=0
      IF(KNTARG.LE.0)GO TO 284
      IF(IMINUS.LE.0)GO TO 283
      IFIRST=IVALUE
      IFINAL=IFIRST+IMINUS-1
  282 IF(IFIRST.GT.IFINAL)GO TO 283
      IF(LNGSHD.GE.LMTSHD)GO TO 283
      LNGSHD=LNGSHD+1
      LTRSHD(LNGSHD)=LTRBGN(IFIRST)
      IFIRST=IFIRST+1
      GO TO 282
C     WIDTH OF OUTLINE
  283 IF(KNTARG.LT.2)GO TO 284
      IF(NVALUE(2).GT.0)LNGTRN=NVALUE(2)
      IBORDR=LNGTRN
C     HEIGHT OF OUTLINE
      IF(KNTARG.LT.3)GO TO 284
      IF(NVALUE(3).GT.0)IBORDR=NVALUE(3)
C     SQUARE OR ROUNDED EDGE, FILLED IN
      IF(KNTARG.LT.4)GO TO 284
      IF(NVALUE(4).GE.0)JBORDR=NVALUE(4)
C     PHRASE OFFSET FROM ONE LINE TO NEXT
      IF(KNTARG.LT.5)GO TO 284
      IF(NMINUS(5).NE.0)NGLSHD=NVALUE(5)
      IF(NGLSHD.LE.(-LNGSHD))NGLSHD=0
      IF(NGLSHD.GE.LNGSHD)NGLSHD=0
C     PATTERN ORIENTATION
      IF(KNTARG.LT.6)GO TO 284
      IF(NMINUS(6).NE.0)INIOBJ=NVALUE(6)
  284 IF(IBORDR.GT.2)IBORDR=2
      GO TO 543
C
C     SIMULATE .PAGE
  285 IF(KNTTOP.LT.0)GO TO 543
      IF(NEWPAG.EQ.0)NEWPAG=1
      IF(NEWPAG.GT.0)ISKIP=-1
      GO TO 543
C
C     .PAGE SIZE OR .PAPER SIZE OR .PAGE LENGTH
  286 IF(KNTARG.GT.0)GO TO 287
      MAXLIN=58
      LNGPAG=MAXLIN-LNGBOT
      IF(LNGPAG.LE.0)LNGPAG=58
      MRGFAR=60
      GO TO 288
  287 IF(IMINUS.LT.0)MAXLIN=MAXLIN+IVALUE
      IF(IMINUS.GT.0)MAXLIN=IVALUE
      LNGPAG=MAXLIN-LNGBOT
      IF(LNGPAG.LE.0)LNGPAG=58
      IF(KNTARG.EQ.1)GO TO 543
      IF(NMINUS(2).LT.0)MRGFAR=MRGFAR+NVALUE(2)
      IF(NMINUS(2).GT.0)MRGFAR=NVALUE(2)
  288 IF(MRGFAR.LE.0)MRGFAR=60
      NOWRIT=MRGFAR
      MRGRIT=NOWRIT
      IF(MRGRIT.GT.(LMTMID-IOFFST))MRGRIT=LMTMID-IOFFST
      IFNNRT=NOWRIT
      IFNMFR=MRGFAR
      IFNMRT=MRGRIT
      GO TO 543
C
C     .PAGE WIDTH
  289 IF(IMINUS.LT.0)MRGFAR=MRGFAR+IVALUE
      IF(IMINUS.GT.0)MRGFAR=IVALUE
      IF(IMINUS.EQ.0)MRGFAR=60
      GO TO 288
C
C     .PAGING
  290 IF(IFPAGE.EQ.0)IFPAGE=-1
      GO TO 543
C
C     .PARAGRAPH
  291 IF(IFAUTO.NE.0)IFAUTO=2
      INDENT=NOWIND
      IF(IMINUS.NE.0)INDENT=IVALUE
      NOWIND=INDENT
      IF(KNTARG.LE.1)GO TO 292
      IF(NMINUS(2).LE.0)NVALUE(2)=NVALUE(2)+NOWSKP
      IF(NVALUE(2).GE.0)NOWSKP=NVALUE(2)
  292 IF(ISKIP.GE.0)ISKIP=ISKIP+NOWSKP
  293 IF(KNTARG.LE.2)GO TO 294
      IF(NMINUS(3).LE.0)NVALUE(3)=NVALUE(3)+NOWTST
      IF(NVALUE(3).GE.0)NOWTST=NVALUE(3)
  294 IVALUE=NOWTST
      IMINUS=1
      GO TO 384
C
C     .PERIOD
  295 IPEROD=1
      GO TO 543
C
C     .RESET
  296 KNDOUT=6
      CALL RNOLIN
      GO TO 543
C
C     .RESET ALL
  297 IF(KNTRST.EQ.0)GO TO 296
      IF(LSTFRM.EQ.0)GO TO 296
      IF(KRANGE.GT.0)GO TO 298
      KNDOUT=6
      CALL RNOLIN
  298 INIPAG=1
      KRANGE=1
      KNDOUT=3
      CALL RNOLIN
      GO TO 296
C
C     .RIGHT
  299 JFILL=2
      GO TO 302
C
C     .RIGHT MARGIN
  300 IF(IMINUS.LT.0)IVALUE=NOWRIT+IVALUE
      IF(IMINUS.EQ.0)IVALUE=MRGFAR
      NOWRIT=IVALUE
      IF(MRGFAR.LT.NOWRIT)MRGFAR=NOWRIT
      MRGRIT=NOWRIT
      IF(MRGRIT.GT.(LMTMID-IOFFST))MRGRIT=LMTMID-IOFFST
      GO TO 543
C
C     .RIGHT NO FILL
  301 JFILL=5
      GO TO 304
  302 IF(KNTARG.LT.2)GO TO 303
      IF(NVALUE(2).GT.0)GO TO 304
  303 KNTARG=2
      NMINUS(2)=1
      NVALUE(2)=1
  304 ICENTR=IVALUE
      KCENTR=IMINUS
      JCENTR=0
      IF(KNTARG.LT.2)GO TO 305
      IF(NMINUS(2).NE.0)JCENTR=NVALUE(2)
  305 IF(JCENTR.GT.0)GO TO 543
      IF(JFILL.EQ.6)GO TO 543
      IFFILL=JFILL
      KLMFIL=ICENTR
      KLMMNS=KCENTR
      GO TO 543
C
C     .RIGHT PAGE
  306 LRFORC=1
      GO TO 543
C
C     .SEQUENCE
  307 IF(IMINUS.LE.0)GO TO 543
      IF(KNTCOD.GE.LMTCOD)GO TO 543
      LTRNOW=LTRBGN(IVALUE)
      IF(LTRNOW.EQ.LTRSPA)GO TO 310
      IF(LTRNOW.EQ.LTRTAB)GO TO 310
      DO 308 I=1,26
      IF(LTRNOW.EQ.LTRABC(I))GO TO 310
      IF(LTRNOW.EQ.LWRABC(I))GO TO 310
  308 CONTINUE
      DO 309 I=1,KNTCOD
      IF(LTRNOW.EQ.LTRCOD(I))GO TO 310
  309 CONTINUE
      KNTCOD=KNTCOD+1
      LTRCOD(KNTCOD)=LTRNOW
  310 IVALUE=IVALUE+1
      IMINUS=IMINUS-1
      GO TO 307
C
C     .SHOW PAGE
  311 IPGSHO=1
      GO TO 543
C
C     .SIMULATE SPLICE
  312 IWIZRD=1
      GO TO 543
C
C     .SKIP
  313 IF(ISKIP.LT.0)GO TO 543
      IF(IMINUS.EQ.0)GO TO 314
      IF(IVALUE.LE.0)GO TO 315
  314 IF(IVALUE.LE.0)IVALUE=1
      ISKIP=ISKIP+(IVALUE*(ISPACE+1))
      GO TO 543
  315 IF(IFNOTE.NE.0)GO TO 543
      I=LNGPAG+(IVALUE*(ISPACE+1))-LOCPAG-1
      IF(ISKIP.LT.I)ISKIP=I
      GO TO 543
C
C     .SKIP LEFT PAGE
  316 IF(LRFORC.EQ.1)GO TO 543
      IF(LRFORC.EQ.0)GO TO 317
      IF(LFTRIT.EQ.1)GO TO 317
      GO TO 543
C
C     .SKIP PAGE
  317 CALL RNOTOP
      CALL RNOBOT
      IVALUE=IVALUE-1
      IF(IVALUE.GT.0)GO TO 317
      GO TO 543
C
C     .SKIP RIGHT PAGE
  318 IF(LRFORC.EQ.0)GO TO 543
      IF(LRFORC.EQ.1)GO TO 317
      IF(LFTRIT.EQ.0)GO TO 317
      GO TO 543
C
C     .SPACE APPENDIX
  319 IF(IMINUS.LE.0)IVALUE=INIAPP+IVALUE
      IF(IVALUE.GE.0)INIAPP=IVALUE
      IF(KNTARG.LT.2)GO TO 543
      IF(NMINUS(2).LE.0)NVALUE(2)=MIDAPP+NVALUE(2)
      IF(NVALUE(2).GE.0)MIDAPP=NVALUE(2)
      IF(KNTARG.LT.3)GO TO 543
      IF(NMINUS(3).LE.0)NVALUE(3)=LSTAPP+NVALUE(3)
      IF(NVALUE(3).GE.0)LSTAPP=NVALUE(3)
      GO TO 543
C
C     .SPACE BOTTOM
  320 IF(IMINUS.LE.0)IVALUE=IGAPLO+IVALUE
      IF(IVALUE.GE.0)IGAPLO=IVALUE
      GO TO 458
C
C     .SPACE CHAPTER
  321 IF(IMINUS.LE.0)IVALUE=INICHA+IVALUE
      IF(IVALUE.GE.0)INICHA=IVALUE
      IF(KNTARG.LT.2)GO TO 543
      IF(NMINUS(2).LE.0)NVALUE(2)=MIDCHA+NVALUE(2)
      IF(NVALUE(2).GE.0)MIDCHA=NVALUE(2)
      IF(KNTARG.LT.3)GO TO 543
      IF(NMINUS(3).LE.0)NVALUE(3)=LSTCHA+NVALUE(3)
      IF(NVALUE(3).GE.0)LSTCHA=NVALUE(3)
      GO TO 543
C
C     .SPACE FOOT NOTES
  322 IF(IMINUS.LE.0)IVALUE=MFNGAP+IVALUE
      IF(IVALUE.GE.0)MFNGAP=IVALUE
      IF(KNTARG.LT.2)GO TO 459
      IF(NMINUS(2).LE.0)NMINUS(2)=NFNGAP+NMINUS(2)
      IF(NVALUE(2).GE.0)NFNGAP=NVALUE(2)
      IF(KNTARG.LT.3)GO TO 459
      IF(NMINUS(3).LE.0)NMINUS(3)=LFNGAP+NMINUS(3)
      IF(NVALUE(3).GE.0)LFNGAP=NVALUE(3)
      GO TO 459
C
C     .SPACE INDEX
  323 IF(IMINUS.LE.0)IVALUE=NDXONE+IVALUE
      IF(IVALUE.GE.0)NDXONE=IVALUE
      IF(KNTARG.LT.2)GO TO 543
      IF(NMINUS(2).LE.0)NVALUE(2)=NDXTWO+NVALUE(2)
      IF(NVALUE(2).GE.0)NDXTWO=NVALUE(2)
      IF(KNTARG.LT.3)GO TO 543
      IF(NMINUS(3).LE.0)NVALUE(3)=NDXTHR+NVALUE(3)
      IF(NVALUE(3).GE.0)NDXTHR=NVALUE(3)
      IF(KNTARG.LT.4)GO TO 543
      IF(NMINUS(4).LE.0)NVALUE(4)=NDXFOU+NVALUE(4)
      IF(NVALUE(4).GE.0)NDXFOU=NVALUE(4)
      GO TO 543
C
C     .SPACE LEVELS
  324 IF(IMINUS.LE.0)IVALUE=LEVEL1+IVALUE
      IF(IVALUE.GE.0)LEVEL1=IVALUE
      IF(KNTARG.LT.2)GO TO 543
      IF(NMINUS(2).LE.0)NVALUE(2)=LEVEL3+NVALUE(2)
      IF(NVALUE(2).GE.0)LEVEL3=NVALUE(2)
      GO TO 543
C
C     .SPACE NOTES
  325 IF(IMINUS.LE.0)IVALUE=NOTONE+IVALUE
      IF(IVALUE.GE.0)NOTONE=IVALUE
      IF(KNTARG.LT.2)GO TO 543
      IF(NMINUS(2).LE.0)NMINUS(2)=NOTTWO+NMINUS(2)
      IF(NVALUE(2).GE.0)NOTTWO=NVALUE(2)
      IF(KNTARG.LT.3)GO TO 543
      IF(NMINUS(3).LE.0)NMINUS(3)=NOTTHR+NMINUS(3)
      IF(NVALUE(3).GE.0)NOTTHR=NVALUE(3)
      GO TO 543
C
C     .SPACE TOP
  326 IF(IMINUS.LE.0)IVALUE=MRGTOP+IVALUE
      IF(IVALUE.GE.0)MRGTOP=IVALUE
      IF(KNTARG.LT.2)GO TO 458
      IF(NMINUS(2).LE.0)NVALUE(2)=IGAPHI+NVALUE(2)
      IF(NVALUE(2).GE.0)IGAPHI=NVALUE(2)
      IF(KNTARG.LT.3)GO TO 458
      IF(NMINUS(3).LE.0)NVALUE(3)=MINTOP+NVALUE(3)
      IF(NVALUE(3).GE.0)MINTOP=NVALUE(3)
      GO TO 458
C
C     .SPACING
  327 ISPACE=0
      IF(IVALUE.GT.0)ISPACE=IVALUE-1
      GO TO 543
C
C     .SPLICE
  328 IMINUS=1
      IVALUE=0
      KOMAND=65
      GO TO 333
  329 IF(IFSPLC.GT.0)GO TO 337
      KNDSPL=MAXBGN-KPYBGN
      IF(JSKIP.EQ.1)KNDSPL=-1
      IF(KNDSPL.EQ.0)GO TO 333
      KPYBGN=MAXBGN
      LMTKAS=MAXBGN
      JSKIP=0
      LSTSPL=0
      IF(LSNSRC.LE.0)GO TO 331
      DO 330 I=1,LSNSRC
      LSTSPL=LSTSPL+1
      LTRSPL(LSTSPL)=LTRBGN(I)
  330 CONTINUE
  331 IF(KNDSPL.LE.0)GO TO 333
      DO 332 I=1,KNDSPL
      KPYKAS=KPYKAS+1
      LSTSPL=LSTSPL+1
      LTRSPL(LSTSPL)=LTRBGN(KPYKAS)
  332 CONTINUE
  333 IF(IFSPLC.NE.0)GO TO 334
      LNGSPL=132
      LINSPL=0
      IF(IWIZRD.EQ.0)GO TO 335
  334 KOMAND=0
  335 IFSPLC=1
      KNTSPL=0
      MAXSPL=IVALUE
      IF(IMINUS.EQ.0)GO TO 336
      IF(IVALUE.LE.0)IFSPLC=-1
  336 IF(IFLOOP.EQ.0)GO TO 543
      IF(KNTLOP.EQ.0)KNTLOP=-1
      GO TO 543
  337 KOMAND=0
      GO TO 543
C
C     .SQUEEZE
  338 NEEDED=0
  339 NEEDED=NEEDED+1
      IF(NEEDED.GT.KNTARG)GO TO 543
      IF(NMINUS(NEEDED).EQ.0)GO TO 339
      IF(NVALUE(NEEDED).LT.0)GO TO 342
      IF(NVALUE(NEEDED).EQ.0)GO TO 339
C     CHECK IF NEW ITEM IS PROPERLY TO RIGHT OF PREVIOUS
      IF(KNTEDT.LE.0)GO TO 344
      IF(MAGEDT(KNTEDT).EQ.-1)KNTEDT=KNTEDT-1
      I=MAGEDT(KNTEDT)
      J=I
      K=KNTEDT
      IF(I.GT.0)GO TO 340
      K=KNTEDT-1
      I=MAGEDT(K)
      J=I-J-1
C     CHECK IF CAN COMBINE PREVIOUS 2 ENTRIES
  340 IF(K.LE.1)GO TO 344
      K=K-1
      M=MAGEDT(K)
      N=M
      IF(M.GT.0)GO TO 341
      K=K-1
      M=MAGEDT(K)
      N=M-N-1
  341 IF(N.LT.(I-1))GO TO 344
      KNTEDT=K+1
      IF(J.GT.N)MAGEDT(KNTEDT)=M-J-1
      GO TO 344
C     ADD NEW NEGATIVE TO PREVIOUS IF IT WAS NEGATIVE
  342 IF(KNTEDT.LE.0)GO TO 343
      IF(MAGEDT(KNTEDT).GT.0)GO TO 344
      MAGEDT(KNTEDT)=MAGEDT(KNTEDT)+NVALUE(NEEDED)
      GO TO 339
  343 IF(LMTEDT.LE.0)GO TO 543
      KNTEDT=1
      MAGEDT(KNTEDT)=1
C     INSERT NEW ITEM
  344 IF(KNTEDT.GE.LMTEDT)GO TO 543
      KNTEDT=KNTEDT+1
      MAGEDT(KNTEDT)=NVALUE(NEEDED)
      GO TO 339
C
C     .STANDARD
  345 ISPACE=0
      JFILL=0
      JSTIFY=1
      NOWLFT=0
      MRGLFT=0
      IF(IMINUS.LT.0)MRGFAR=MRGFAR+IVALUE
      IF(IMINUS.GT.0)MRGFAR=IVALUE
      IF(MRGFAR.LE.0)MRGFAR=60
      IF(MRGFAR.EQ.60)MAXLIN=58
      IF(MRGFAR.EQ.70)MAXLIN=74
      LNGPAG=MAXLIN-LNGBOT
      IF(LNGPAG.LE.0)LNGPAG=58
      GO TO 288
C
C     .STYLE HEADERS
  346 IF(IMINUS.NE.0)IRUNIN=IVALUE
      IF(KNTARG.LT.2)GO TO 543
      IF(NMINUS(2).NE.0)KAPITL=NVALUE(2)
      IF(KNTARG.LT.3)GO TO 543
      IF(NMINUS(3).NE.0)INITAL=NVALUE(3)
      IF(KNTARG.LT.4)GO TO 543
      IF(NMINUS(4).LE.0)NVALUE(4)=MINLVL+NVALUE(4)
      MINLVL=NVALUE(4)
      IF(MINLVL.GT.LMTLVL)MINLVL=LMTLVL
      GO TO 543
C
C     .STYLE INDEX
  347 IF(KNTARG.LT.1)GO TO 543
      IF(IMINUS.NE.0)KNDNDX=IVALUE
      IF(KNTARG.LT.2)GO TO 543
      IF(NMINUS(2).NE.0)KAPNDX=NVALUE(2)
      GO TO 543
C
C     .SUBPAGE
  348 IF(ISUBPG.GE.0)GO TO 543
      ISUBPG=-1-ISUBPG
      GO TO 543
C
C     .TAB STOPS
  349 IF(KNTARG.LE.0)GO TO 351
      MAXTAB=KNTARG
      IF(MAXTAB.GT.LMTTAB)MAXTAB=LMTTAB
      DO 350 I=1,MAXTAB
      J=8*I
      IF(NMINUS(I).LT.0)J=LOCTAB(I)+NVALUE(I)
      IF(NMINUS(I).GT.0)J=NVALUE(I)
      IF(J.GT.0)LOCTAB(I)=J
  350 CONTINUE
      GO TO 543
  351 MAXTAB=LMTTAB
      DO 352 I=1,MAXTAB
      LOCTAB(I)=8*I
  352 CONTINUE
      GO TO 543
C
C     .TELL
  353 IF(ITRMNL.NE.0)GO TO 543
      IF(KNTARG.LE.0)GO TO 543
      IF(IMINUS.LE.0)GO TO 543
      IFIRST=IVALUE
      IFINAL=IFIRST+IMINUS
      LNGWRK=0
C     COPY TEXT TO BE DISPLAYED TO USER
  354 IF(IFIRST.GE.IFINAL)GO TO 374
      IF(LNGWRK.GE.LMTWRK)GO TO 374
      IF(MRKTTL.LE.0)GO TO 355
      IF(LTRBGN(IFIRST).EQ.LTRPUT)GO TO 356
  355 LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRBGN(IFIRST)
      IFIRST=IFIRST+1
      GO TO 354
C     EVALUATE NUMBER AFTER MARKING CHARACTER
  356 IVALUE=0
  357 IFIRST=IFIRST+1
      IF(IFIRST.GE.IFINAL)GO TO 360
      MSKBIT=MSKBGN(IFIRST)
      IF(MSKBIT.EQ.0)GO TO 358
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 360
  358 LTRNOW=LTRBGN(IFIRST)
      DO 359 I=1,10
      IF(LTRNOW.NE.LTRDGT(I))GO TO 359
      IVALUE=(10*IVALUE)+I-1
      GO TO 357
  359 CONTINUE
  360 CONTINUE
C     GET NEW PAGE NUMBER
      IVALUE=1
      IF(NEWCHA.NE.0)GO TO 362
      IF(NEWPAG.NE.0)GO TO 362
      IF(KNTTOP.LT.0)GO TO 362
      IF(LNGMID.GT.0)GO TO 377
C     LINE FITS ON CURRENT PAGE
  361 NDXLOC=KNTPAG
      IF(NDXLOC.EQ.0)NDXLOC=1
      NDXSEC=NOWSEC
      NDXSHW=NOWSHW
      NDXPAG=NOWPAG
      NDXPHW=NOWPHW
      NDXSUB=NOWSUB
      NDXSPH=NOWSPH
      GO TO 369
C     LINE GOES ON NEXT PAGE
  362 NDXLOC=KNTPAG+IDFRPG+1
      IF(NEWCHA.EQ.0)GO TO 364
      IF(ISECTN.GT.0)GO TO 363
      NDXSEC=IAPNDX
      NDXSHW=KNDAPP
      GO TO 365
  363 NDXSEC=ICHAPT
      NDXSHW=KNDCHA
      GO TO 365
  364 NDXSEC=NOWSEC
      NDXSHW=NOWSHW
  365 IF(ISUBPG.EQ.0)GO TO 366
      NDXPAG=NXTPAG+IDFRPG
      NDXPHW=KNDPAG
      IF(ISUBPG.GT.0)GO TO 367
      NDXSUB=0
      GO TO 368
  366 NDXPAG=NOWPAG+IDFRPG
      NDXPHW=NOWPHW
  367 NDXSUB=NXTSUB
  368 NDXSPH=KNDSUB
  369 CONTINUE
C     INSERT CURRENT PAGE NUMBER
      IF(NDXMAK.EQ.0)GO TO 371
      DO 370 I=1,5
      IF(LNGWRK.GE.LMTWRK)GO TO 373
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LWRIND(I)
  370 CONTINUE
      IF(LNGWRK.GE.LMTWRK)GO TO 373
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRMNS
      GO TO 372
  371 IF(ISECTN.EQ.0)GO TO 372
      CALL RNONUM(NDXSHW,NDXSEC,LTRWRK,LNGWRK,LMTWRK)
      IF(LNGWRK.GE.LMTWRK)GO TO 373
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRMNS
  372 CALL RNONUM(NDXPHW,NDXPAG,LTRWRK,LNGWRK,LMTWRK)
      IF(NDXSUB.LE.0)GO TO 373
      CALL RNONUM(NDXSPH,NDXSUB,LTRWRK,LNGWRK,LMTWRK)
  373 GO TO 354
  374 IF(IDEBUG.EQ.0)WRITE(ITTY,375)(LTRWRK(I),I=1,LNGWRK)
      IF(IDEBUG.NE.0)WRITE(JDISK,375)(LTRWRK(I),I=1,LNGWRK)
  375 FORMAT(1X,300A1)
      GO TO 543
C
C     .TERMINAL
  376 IF(IMINUS.NE.0)KTRMNL=IVALUE
      GO TO 458
C
C     .TEST PAGE
  377 IF(IFNOTE.NE.0)GO TO 381
      IF(NEWPAG.NE.0)GO TO 382
      IF(KNTTOP.LT.0)GO TO 382
      IF(IFPAGE.LE.0)GO TO 381
      IF(ISKIP.GT.0)IVALUE=IVALUE+ISKIP
  378 LFTOVR=LNGPAG-LOCPAG
      IF((LFTOVR-IVALUE).LT.0)GO TO 383
      IF(IFNRDY.LE.0)GO TO 381
      IF(IDEFER.GT.0)GO TO 381
      IF((LOCPAG+KNDLIN).GE.LNGPAG)GO TO 381
      IF(IFNHAV.EQ.0)GO TO 380
      IF(IRECRD.NE.3)GO TO 380
      IF(JFNOPN.LT.0)GO TO 379
      IF(IFNRED.GE.IFNBGN)GO TO 380
      IFNHAV=0
      IFNRED=IFNRED+1
      IFNTTL=IFNTTL-NXTFTN
      IFNRDY=IFNRDY-NXTFTN
      GO TO 380
  379 IF(JFNRED.GE.JFNBGN)GO TO 380
      IFNHAV=0
      JFNRED=JFNRED+1
      IFNTTL=IFNTTL-NXTFTN
      IFNRDY=IFNRDY-NXTFTN
  380 I=KNDLIN
      IF(I.LT.(ISPACE+KFNGAP))I=ISPACE+KFNGAP
      LFTOVR=LNGPAG-LOCPAG-IFNRDY-IFNGAP-I
      IF((LFTOVR-IVALUE).LT.0)GO TO 383
C     LINES FIT CURRENT PAGE
  381 IF(KOMAND.EQ.54)GO TO 178
      IF(KOMAND.EQ.503)GO TO 178
      IF(KOMAND.EQ.160)GO TO 361
      IF(KOMAND.EQ.106)GO TO 120
      IF(KOMAND.EQ.110)GO TO 120
      GO TO 543
C     LINES DO NOT FIT CURRENT PAGE
  382 LFTOVR=0
  383 IF(KOMAND.EQ.54)GO TO 180
      IF(KOMAND.EQ.503)GO TO 180
      IF(KOMAND.EQ.160)GO TO 362
      IF(KOMAND.EQ.106)GO TO 121
      IF(KOMAND.EQ.110)GO TO 123
      GO TO 285
C
C     .TEST SPACE
  384 IF(IVALUE.LE.0)GO TO 543
      IVALUE=IVALUE+((IVALUE-1)*ISPACE)
      GO TO 377
C
C     .UNDERLINE
  385 ITLALL=-1
      ITLLIN=1
      GO TO 543
C
C     .UNDERLINE SPACE
  386 IULSPC=-1
      GO TO 543
C
C     .UPPER CASE, CORRESPONDS TO ^^ IN TEXT
  387 KASALL=0
      GO TO 543
C
C     ***********************************************
C     *                                             *
C     *  THE VARIOUS VERSIONS OF THE TITLE COMMAND  *
C     *                                             *
C     ***********************************************
C
C     .LEFT TOP TITLE
  388 KNDTTL(9)=2
      GO TO 390
  389 KNDTTL(9)=3
  390 LOCLFT=1
      GO TO 418
C
C     .RIGHT TOP TITLE
  391 KNDTTL(10)=2
      GO TO 393
  392 KNDTTL(10)=3
  393 LOCLFT=2
      GO TO 418
C
C     .LEFT TOP SUB TITLE
  394 LOCLFT=3
      KNDTTL(11)=1
      GO TO 418
C
C     .RIGHT TOP SUB TITLE
  395 LOCLFT=4
      KNDTTL(12)=1
      GO TO 418
C
C     .TOP TITLE
  396 LOCLFT=1
      KNDTTL(9)=2
      KNDTTL(10)=2
      GO TO 407
C
C     .TOP SUB TITLE
  397 LOCLFT=3
      KNDTTL(11)=1
      KNDTTL(12)=1
      GO TO 407
C
C     .LEFT BOTTOM TITLE
  398 LOCLFT=5
      GO TO 427
C
C     .RIGHT BOTTOM TITLE
  399 LOCLFT=6
      GO TO 427
C
C     .LEFT BOTTOM SUB TITLE
  400 LOCLFT=7
      GO TO 427
C
C     .RIGHT BOTTOM SUB TITLE
  401 LOCLFT=8
      GO TO 427
C
C     .BOTTOM TITLE
  402 LOCLFT=5
      GO TO 413
C
C     .BOTTOM SUB TITLE
  403 LOCLFT=7
      GO TO 413
C
C     .TITLE
  404 KOMAND=9
  405 LOCLFT=1
      KNDTTL(9)=3
      KNDTTL(10)=3
      GO TO 407
C
C     .SUBTITLE
  406 LOCLFT=3
      KNDTTL(11)=3
      KNDTTL(12)=3
      GO TO 407
C
C     CHECK IF BOTH TOP TITLES OR TOP SUBTITLES CAN BE
C     APPLIED IMMEDIATELY OR SHOULD BE STORED
  407 IF(KNTTOP.LT.0)GO TO 408
      IF(NEWPAG.EQ.0)GO TO 410
  408 IF(IFNOTE.NE.0)GO TO 409
      IF(LNGMID.NE.0)GO TO 412
      GO TO 410
  409 IF(LNGFTN.NE.0)GO TO 412
  410 IF(LOCLFT.NE.1)GO TO 411
      KNDLFT=KNDTTL(9)-2
      KNDRIT=KNDTTL(10)-2
      KNDTTL(9)=0
      KNDTTL(10)=0
      GO TO 417
  411 IFLSUB=KNDTTL(11)-2
      IFRSUB=KNDTTL(12)-2
      KNDTTL(11)=0
      KNDTTL(12)=0
      GO TO 417
  412 LOCLFT=LOCLFT+8
      GO TO 417
C
C     CHECK IF BOTH BOTTOM TITLES OR SUBTITLES CAN BE
C     APPLIED IMMEDIATELY OR SHOULD BE STORED
  413 IF(KNTTOP.GT.0)GO TO 416
      IF(NEWPAG.NE.0)GO TO 417
  414 IF(IFNOTE.NE.0)GO TO 415
      IF(LNGMID.NE.0)GO TO 416
      GO TO 417
  415 IF(LNGFTN.NE.0)GO TO 416
      GO TO 417
  416 LOCLFT=LOCLFT+8
      KNDTTL(LOCLFT)=1
      KNDTTL(LOCLFT+1)=1
C
C     CANCEL RIGHT TITLE IF BOTH ARE TO BE CANCELLED
  417 NOWARG=1
      LOCLFT=(5*LOCLFT)-4
      LSTTTL(LOCLFT+5)=0
      LSTTTL(LOCLFT+6)=0
      LSTTTL(LOCLFT+7)=-1
      LSTTTL(LOCLFT+8)=-1
      LSTTTL(LOCLFT+9)=-1
      GO TO 432
C
C     CHECK IF SINGLE TOP TITLE OR TOP SUBTITLE CAN BE
C     APPLIED IMMEDIATELY OR SHOULD BE STORED
  418 IF(KNTTOP.LT.0)GO TO 419
      IF(NEWPAG.EQ.0)GO TO 421
  419 IF(IFNOTE.NE.0)GO TO 420
      IF(LNGMID.NE.0)GO TO 426
      GO TO 421
  420 IF(LNGFTN.NE.0)GO TO 426
  421 GO TO(422,423,424,425),LOCLFT
  422 KNDLFT=KNDTTL(9)-2
      KNDTTL(9)=0
      GO TO 431
  423 KNDRIT=KNDTTL(10)-2
      KNDTTL(10)=0
      GO TO 431
  424 IFLSUB=KNDTTL(11)-2
      KNDTTL(11)=0
      GO TO 431
  425 IFRSUB=KNDTTL(12)-2
      KNDTTL(12)=0
      GO TO 431
  426 LOCLFT=LOCLFT+8
      GO TO 431
C
C     CHECK IF SINGLE BOTTOM TITLE OR SUBTITLE CAN BE
C     APPLIED IMMEDIATELY OR SHOULD BE STORED
  427 IF(KNTTOP.GT.0)GO TO 430
      IF(NEWPAG.NE.0)GO TO 431
  428 IF(IFNOTE.NE.0)GO TO 429
      IF(LNGMID.NE.0)GO TO 430
      GO TO 431
  429 IF(LNGFTN.NE.0)GO TO 430
      GO TO 431
  430 LOCLFT=LOCLFT+8
      KNDTTL(LOCLFT)=1
C
C     CANCEL A SINGLE TITLE, NOT BOTH
  431 NOWARG=0
      LOCLFT=(5*LOCLFT)-4
  432 LSTTTL(LOCLFT)=0
      LSTTTL(LOCLFT+1)=0
      LSTTTL(LOCLFT+2)=-1
      LSTTTL(LOCLFT+3)=-1
      LSTTTL(LOCLFT+4)=-1
C
C     GARBAGE COLLECT THE TITLE STORAGE
      LNGTTL=0
      IFOUND=0
      J=2
      DO 434 I=1,16
      IF(LSTTTL(J).GT.LSTTTL(J+3))GO TO 434
      IF(IFOUND.EQ.0)GO TO 433
      IF(LSTTTL(J).GE.JFIRST)GO TO 434
  433 IFOUND=1
      JFIRST=LSTTTL(J)
      JFINAL=LSTTTL(J+3)
  434 J=J+5
      GO TO 438
  435 IFOUND=0
      J=2
      DO 437 I=1,16
      IF(LSTTTL(J).GT.LSTTTL(J+3))GO TO 437
      IF(LSTTTL(J).LE.IFINAL)GO TO 437
      IF(IFOUND.EQ.0)GO TO 436
      IF(JFIRST.LE.LSTTTL(J))GO TO 437
  436 JFIRST=LSTTTL(J)
      JFINAL=LSTTTL(J+3)
      IFOUND=1
  437 J=J+5
  438 IF(IFOUND.EQ.0)GO TO 443
      NEEDED=JFIRST-LNGTTL-1
      IF(NEEDED.EQ.0)GO TO 441
      J=2
      DO 439 I=1,16
      IF(LSTTTL(J).GT.LSTTTL(J+3))GO TO 439
      IF(LSTTTL(J).NE.JFIRST)GO TO 439
      LSTTTL(J)=LNGTTL+1
      LSTTTL(J+1)=LSTTTL(J+1)-NEEDED
      LSTTTL(J+2)=LSTTTL(J+2)-NEEDED
      LSTTTL(J+3)=LSTTTL(J+3)-NEEDED
  439 J=J+5
      DO 440 I=JFIRST,JFINAL
      LNGTTL=LNGTTL+1
      MSKTTL(LNGTTL)=MSKTTL(I)
      LTRTTL(LNGTTL)=LTRTTL(I)
  440 CONTINUE
      GO TO 442
  441 LNGTTL=JFINAL
  442 IFINAL=JFINAL
      GO TO 435
  443 CONTINUE
C
C     STORE NEW TITLE OR NEW SUBTITLE
      NEWARG=0
      LSTTTL(LOCLFT)=1
      LSTTTL(LOCLFT+1)=LNGTTL+1
  444 NEWARG=NEWARG+1
      IF(NEWARG.GT.3)GO TO 454
      IF(NEWARG.GT.KNTARG)GO TO 453
      IF(NMINUS(NEWARG).LE.0)GO TO 453
      IFIRST=NVALUE(NEWARG)
      IFINAL=IFIRST+NMINUS(NEWARG)-1
  445 IF(IFIRST.GT.IFINAL)GO TO 452
      IF(LNGTTL.GE.LMTTTL)GO TO 452
      LTRNOW=LTRBGN(IFIRST)
      IF(KOMAND.EQ.9)GO TO 446
      IF(KOMAND.EQ.15)GO TO 446
      IF(MRKTTL.LE.0)GO TO 446
      IF(LTRNOW.NE.LTRPUT)GO TO 446
      MSKBIT=MSKBGN(IFIRST)
      IF(MSKBIT.EQ.0)GO TO 448
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 448
  446 LNGTTL=LNGTTL+1
      MSKTTL(LNGTTL)=MSKBGN(IFIRST)
      LTRTTL(LNGTTL)=LTRBGN(IFIRST)
      MSKBIT=MSKBGN(IFIRST)
      IF(MSKBIT.EQ.0)GO TO 451
      CALL RNOUNP(4,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 447
      IF(LSTTTL(LOCLFT).EQ.1)LSTTTL(LOCLFT)=2
      IF(LSTTTL(LOCLFT).EQ.4)LSTTTL(LOCLFT)=3
  447 MSKBIT=MSKBGN(IFIRST)
      CALL RNOUNP(5,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 451
      IF(LSTTTL(LOCLFT).EQ.1)LSTTTL(LOCLFT)=4
      IF(LSTTTL(LOCLFT).EQ.2)LSTTTL(LOCLFT)=3
      GO TO 451
  448 LNGTTL=LNGTTL+1
      IF(IFIRST.GE.IFINAL)GO TO 450
      MSKBIT=MSKBGN(IFIRST+1)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 450
      LTRNOW=LTRBGN(IFIRST+1)
      DO 449 J=1,10
      IF(LTRNOW.NE.LTRDGT(J))GO TO 449
      IFIRST=IFIRST+1
      MSKTTL(LNGTTL)=-1-J
      GO TO 451
  449 CONTINUE
  450 MSKTTL(LNGTTL)=-2
  451 IFIRST=IFIRST+1
      GO TO 445
  452 CONTINUE
  453 I=LOCLFT+NEWARG+1
      LSTTTL(I)=LNGTTL
      GO TO 444
  454 IF(KOMAND.NE.9)GO TO 455
      IF(LNGTTL.GE.LMTTTL)GO TO 455
      LNGTTL=LNGTTL+1
      MSKTTL(LNGTTL)=-1
      LSTTTL(LOCLFT+4)=LNGTTL
  455 IF(LSTTTL(LOCLFT+1).LE.LSTTTL(LOCLFT+4))GO TO 456
      LSTTTL(LOCLFT)=0
      LSTTTL(LOCLFT+1)=0
      LSTTTL(LOCLFT+2)=-1
      LSTTTL(LOCLFT+3)=-1
      LSTTTL(LOCLFT+4)=-1
  456 IF(NOWARG.EQ.0)GO TO 458
      DO 457 I=1,5
      LSTTTL(LOCLFT+5)=LSTTTL(LOCLFT)
      LOCLFT=LOCLFT+1
  457 CONTINUE
C
C     CALCULATE SIZE OF TOP AND BOTTOM MARGINS
  458 CALL RNOHIH(LSTTTL,MRGTOP,KTRMNL,LNGTOP,ITTLHI,
     1ISUBHI,IGAPHI,MINTOP,IFLSUB,IFRSUB)
      CALL RNOLOW(LSTTTL,IGAPLO,KTRMNL,LNGBOT,ITTLLO,
     1ISUBLO)
      LNGPAG=MAXLIN-LNGBOT
      IF(LNGPAG.LE.0)LNGPAG=58
C
C     DETERMINE LINE GAP NEEDED FOR FOOTNOTE RULE
  459 KFNGAP=MFNGAP
      JFNGAP=NFNGAP
      IFNGAP=0
      IF(LNGFNR.EQ.0)GO TO 464
      IF(KTRMNL.NE.0)GO TO 463
      NEEDED=LNGFNR
      IF(LNGFNR.LT.0)NEEDED=1
      IF(KFNGAP.GT.0)GO TO 461
      DO 460 I=1,NEEDED
      MSKBIT=MSKFNR(I)
      IF(MSKBIT.EQ.0)GO TO 460
      CALL RNOUNP(4,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 460
      KFNGAP=1
      GO TO 461
  460 CONTINUE
  461 IF(JFNGAP.GT.0)GO TO 463
      DO 462 I=1,NEEDED
      MSKBIT=MSKFNR(I)
      IF(MSKBIT.EQ.0)GO TO 462
      CALL RNOUNP(5,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 462
      JFNGAP=1
      GO TO 463
  462 CONTINUE
  463 IFNGAP=1+JFNGAP
  464 GO TO 543
C
C     .NO SUBTITLE
  465 IFLSUB=0
      LSTTTL(11)=0
      LSTTTL(12)=0
      LSTTTL(13)=-1
      LSTTTL(14)=-1
      LSTTTL(15)=-1
      IFRSUB=0
      LSTTTL(16)=0
      LSTTTL(17)=0
      LSTTTL(18)=-1
      LSTTTL(19)=-1
      LSTTTL(20)=-1
      GO TO 458
C
C     ******************************
C     *                            *
C     *  MISCELLANEOUS OPERATIONS  *
C     *                            *
C     ******************************
C
  466 I=KOMAND-500
      GO TO(467,469,174,543,487,506,507,524,533,470,
     1471,472,484),I
      GO TO 543
C
C     TURN OFF DEFERRED FOOTNOTES SO CAN GENERATE FOOTNOTES
  467 IF(IDEFER.EQ.0)GO TO 543
      IF(NXTONE.EQ.94)GO TO 468
      IF(NXTONE.EQ.132)GO TO 468
      IDEFER=-2
      IF(KNTTOP.LT.0)GO TO 543
      IF(NEWPAG.EQ.0)NEWPAG=1
      IF(NEWPAG.GT.0)ISKIP=-1
      GO TO 543
  468 IDEFER=-5
      IF(KNTTOP.LT.0)IDEFER=-6
      IF(NEWPAG.NE.0)IDEFER=-6
      GO TO 543
C
C     TURN DEFERRED FOOTNOTES BACK ON AFTER GENERATION
  469 IF(IDEFER.NE.0)IDEFER=1
      GO TO 543
C
C     INSERT MOVABLE PAGES BEFORE APPLYING ANY PAGE COMMAND
  470 IF(IDFRPG.LE.0)GO TO 543
      CALL RNOTOP
      CALL RNOBOT
      IDFRPG=IDFRPG-1
      GO TO 470
C
C     INSERT RULED LINE
  471 MAJOR=MAJOR+2
  472 LNGMID=0
      IF(ISKIP.LE.0)GO TO 474
      IF(IFPAGE.LE.0)GO TO 473
      IF((LOCPAG+ISKIP).LT.LNGPAG)GO TO 473
      IF(NEWPAG.EQ.0)NEWPAG=1
      ISKIP=-1
      GO TO 474
  473 MAJOR=MAJOR-2
      GO TO 543
  474 LNGMID=0
      IF(NOWBAR.NE.0)IFABAR=NOWBAR
      NEEDED=MRGLFT
      IF(KNTARG.LT.2)GO TO 476
      IF(NMINUS(2).EQ.0)GO TO 476
      IF(NMINUS(2).LT.0)GO TO 475
      NEEDED=NVALUE(2)
      GO TO 476
  475 NEEDED=MRGLFT+NVALUE(2)
  476 IF(NEEDED.LE.0)GO TO 477
      IF(LNGMID.GE.LMTMID)GO TO 483
      NEEDED=NEEDED-1
      LNGMID=LNGMID+1
      LTRMID(LNGMID)=LTRSPA
      MSKMID(LNGMID)=0
      GO TO 476
  477 NEEDED=MRGRIT
      IF(KNTARG.LT.3)GO TO 479
      IF(NMINUS(3).EQ.0)GO TO 479
      IF(NMINUS(3).LT.0)GO TO 478
      NEEDED=NVALUE(3)
      GO TO 479
  478 NEEDED=MRGRIT+NVALUE(3)
  479 IF(NEEDED.GT.LMTMID)NEEDED=LMTMID
  480 IF(LNGMID.GE.NEEDED)GO TO 483
      IF(IMINUS.GT.0)GO TO 481
      LNGMID=LNGMID+1
      LTRMID(LNGMID)=1H-
      MSKMID(LNGMID)=0
      GO TO 480
  481 J=IVALUE
      DO 482 I=1,IMINUS
      IF(LNGMID.GE.NEEDED)GO TO 483
      LNGMID=LNGMID+1
      LTRMID(LNGMID)=LTRBGN(J)
      MSKMID(LNGMID)=MSKBGN(J)
      J=J+1
  482 CONTINUE
      GO TO 480
  483 CONTINUE
      GO TO 543
C
C     END LITERAL COMMAND
C     DETERMINE IF OBJECT NEEDS TO BE COMPLETED
  484 IF(JFILL.NE.6)GO TO 543
      IF(LSTTRN.EQ.0)GO TO 543
      IF(IFFILL.NE.0)GO TO 543
      GO TO 485
C
C     WHERE THE COMMAND SEQUENCE HAS AN EMBEDDED ZERO,
C     AND ARE EXECUTING COMMANDS BEFORE THE EMBEDDED ZERO,
C     ADVANCE SO THAT THE NEXT ITEM EXECUTED WILL BE THE
C     FIRST ITEM AFTER THE EMBEDDED ZERO.
  485 IF(NXTCMD(MAJOR).EQ.0)GO TO 486
      MAJOR=MAJOR+1
      GO TO 485
  486 MAJOR=MAJOR+1
      GO TO 543
C
C     *****************************************************
C     *                                                   *
C     *  INSERT FOOTNOTE COUNT INTO TEXT BEFORE FOOTNOTE  *
C     *                                                   *
C     *****************************************************
C
C     CHECK IF FOOTNOTE NUMBER CAUSES OVERFLOW OF LINE
  487 IF(IFNOTE.NE.0)GO TO 523
      IF(NUMFTN.EQ.0)GO TO 523
      LNGFTN=0
      IF(LNGMID.LE.0)GO TO 505
      IF(KMPPAG.NE.KNTPAG)GO TO 488
      IF(KMPLIN.NE.LOCPAG)GO TO 488
      IF(KMPCLM.NE.LNGMID)GO TO 488
      LNGMID=INICLM
      KONECT=-1
  488 IF(KONECT.NE.0)GO TO 490
      IF(IFNREF.GE.2)GO TO 489
      IF(JFILL.NE.0)GO TO 543
      GO TO 490
  489 KONECT=1
  490 LNGWRK=0
      IF(LTRREF(1).NE.LTRSPA)LNGWRK=1
      IF(KONECT.LT.0)LNGWRK=1
      CALL RNONUM(MRKREF,KNTFTN,LTRWRK,LNGWRK,LMTWRK)
      IF(LTRREF(2).NE.LTRSPA)LNGWRK=LNGWRK+1
      NEEDED=0
      IF(KONECT.NE.0)GO TO 493
      NEEDED=1
      IF(IPEROD.EQ.0)GO TO 492
      MSKBIT=MSKMID(LNGMID)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 492
      LTRNOW=LTRMID(LNGMID)
      DO 491 I=1,4
      IF(LTRNOW.NE.LTRTWO(I))GO TO 491
      NEEDED=2
      GO TO 492
  491 CONTINUE
  492 CONTINUE
  493 IF((LNGMID+LNGWRK+NEEDED).GT.MRGRIT)GO TO 495
C
C     INSERT SEPARATING SPACES IF PRECEDING WORD AND THE
C     REFERENCE FIT ON LINE AND NO .NO SPACE GIVEN
      IF(NEEDED.LE.0)GO TO 514
      KNTSPC=KNTSPC+1
      DO 494 I=1,NEEDED
      LNGMID=LNGMID+1
      LTRMID(LNGMID)=LTRSPA
      MSKBIT=0
      CALL RNOPAK(1,MSKBIT)
      MSKMID(LNGMID)=MSKBIT
  494 CONTINUE
      GO TO 514
C
C     STORE RIGHT WORD IF FOOTNOTE NUMBER OVERFLOWS LINE
  495 IF(KONECT.EQ.0)GO TO 499
      IF(KNTSPC.LE.0)GO TO 514
  496 IF(LNGMID.LE.0)GO TO 513
      MSKBIT=MSKMID(LNGMID)
      CALL RNOUNP(1,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 497
      LNGFTN=LNGFTN+1
      LTRFTN(LNGFTN)=LTRMID(LNGMID)
      MSKFTN(LNGFTN)=MSKMID(LNGMID)
      LNGMID=LNGMID-1
      GO TO 496
  497 LNGMID=LNGMID-1
      IF(LNGMID.LE.0)GO TO 498
      MSKBIT=MSKMID(LNGMID)
      CALL RNOUNP(1,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 497
C
C     JUSTIFY OLD TEXT IF FOOTNOTE NUMBER OVERFLOWS LINE
  498 IF(JFILL.NE.0)GO TO 543
      KNTSPC=KNTSPC-1
  499 IREVRS=-IREVRS
      IF(LNGMID.GE.MRGRIT)GO TO 543
      IF(KNTSPC.LE.0)GO TO 543
      IF(JSTIFY.EQ.0)GO TO 543
      IGROUP=(MRGRIT-LNGMID)/KNTSPC
      JGROUP=MRGRIT-LNGMID-(KNTSPC*IGROUP)
      IF(IREVRS.GT.0)JGROUP=JGROUP-KNTSPC-1
      J=MRGRIT
  500 MSKBIT=MSKMID(LNGMID)
      CALL RNOUNP(1,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 503
      JGROUP=JGROUP+IREVRS
      NEEDED=IGROUP
      IF(JGROUP.GE.0)NEEDED=IGROUP+1
      IF(NEEDED.LE.0)GO TO 502
      DO 501 I=1,NEEDED
      LTRMID(J)=LTRSPA
      MSKMID(J)=MSKMID(LNGMID)
  501 J=J-1
      IF(J.LE.LNGMID)GO TO 504
  502 LTRMID(J)=LTRMID(LNGMID)
      MSKMID(J)=MSKMID(LNGMID)
      J=J-1
      LNGMID=LNGMID-1
      MSKBIT=MSKMID(LNGMID)
      CALL RNOUNP(1,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 502
  503 LTRMID(J)=LTRMID(LNGMID)
      MSKMID(J)=MSKMID(LNGMID)
      J=J-1
      LNGMID=LNGMID-1
      GO TO 500
  504 LNGMID=MRGRIT
      GO TO 543
C
C     OUTPUT LINE SPACING BEFORE NUMBER WHICH CAUSED OVERFLOW
  505 MAJOR=MAJOR+2
  506 MAJOR=MAJOR+2
  507 LNGMID=0
      IF(ISKIP.LE.0)GO TO 509
      IF(IFPAGE.LE.0)GO TO 508
      IF((LOCPAG+ISKIP).LT.LNGPAG)GO TO 508
      IF(NEWPAG.EQ.0)NEWPAG=1
      ISKIP=-1
      GO TO 509
  508 MAJOR=MAJOR-2
      GO TO 543
C
C     RESTORE RIGHTMOST WORD IN LINE IF FOOTNOTE NUMBER
C     WOULD HAVE CAUSED THE LINE TO OVERFLOW.
  509 KNTSPC=0
      NEEDED=MRGLFT
      IF(NEEDED.GT.(LMTMID-LNGFTN))NEEDED=LMTMID-LNGFTN
      IF(NEEDED.LE.0)GO TO 511
      DO 510 I=1,NEEDED
      LNGMID=LNGMID+1
      MSKMID(LNGMID)=0
      LTRMID(LNGMID)=LTRSPA
      IF(LNGMID.EQ.NOWBAR)LTRMID(LNGMID)=LTRBAR
  510 CONTINUE
  511 IF(LNGFTN.LE.0)GO TO 512
      IF(LNGMID.GE.LMTMID)GO TO 522
      LNGMID=LNGMID+1
      LTRMID(LNGMID)=LTRFTN(LNGFTN)
      MSKMID(LNGMID)=MSKFTN(LNGFTN)
      LNGFTN=LNGFTN-1
      GO TO 511
  512 IF(KONECT.LT.0)INICLM=LNGMID
      GO TO 515
C
C     INSERT FOOTNOTE NUMBER INTO TEXT BEFORE FOOTNOTE
  513 LNGMID=LNGFTN
  514 MAJOR=MAJOR+4
  515 LNGWRK=0
      IF(KONECT.GE.0)GO TO 516
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=1H-
      IF(KNTFTN.EQ.KMPVAL)LTRWRK(LNGWRK)=1H,
      GO TO 517
  516 IF(LTRREF(1).EQ.LTRSPA)GO TO 517
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRREF(1)
  517 CALL RNONUM(MRKREF,KNTFTN,LTRWRK,LNGWRK,LMTWRK)
      IF(KONECT.GE.0)KMPVAL=KNTFTN+1
      IF(KONECT.GE.0)INICLM=LNGMID+LNGWRK
      IF(LTRREF(2).EQ.LTRSPA)GO TO 518
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRREF(2)
  518 IF((LNGMID+LNGWRK).GT.LMTMID)GO TO 522
      IF(NOWBAR.NE.0)IFABAR=NOWBAR
      MSKBIT=0
      IF(IFNREF.EQ.1)GO TO 519
      IF(IFNREF.NE.3)GO TO 520
  519 CALL RNOPAK(4,MSKBIT)
  520 DO 521 I=1,LNGWRK
      LNGMID=LNGMID+1
      LTRMID(LNGMID)=LTRWRK(I)
      MSKMID(LNGMID)=MSKBIT
  521 CONTINUE
      KMPPAG=KNTPAG
      KMPLIN=LOCPAG
      KMPCLM=LNGMID
  522 KONECT=0
      GO TO 543
  523 MAJOR=MAJOR+4
      GO TO 543
C
C     **********************
C     *                    *
C     *  FLOATING FIGURES  *
C     *                    *
C     **********************
C
C     .DEFER FIGURE, DETERMINE IF NEED NEW PAGE
  524 IF(IMINUS.EQ.0)IVALUE=1
      IF(IVALUE.LE.0)GO TO 531
C     IF(KDFRFG.GT.0)KDFRFG=KDFRFG+ISPACE
C     IVALUE=IVALUE+KDFRFG
C     KDFRFG=0
      NVALUE(1)=IVALUE
      IF(IFNOTE.NE.0)GO TO 527
      IF(LNGMID.LE.0)GO TO 530
      IF(NXTFIG.GT.0)GO TO 532
      IF(JDFRFG.GT.0)GO TO 532
      IF(NEWPAG.NE.0)GO TO 529
      IF(KNTTOP.LT.0)GO TO 529
      IF(IFPAGE.LE.0)GO TO 527
C     CHECK HOW MUCH ROOM REMAINS ON CURRENT PAGE
      IVALUE=1+ISPACE
      NVALUE(3)=IFNBGN
      NVALUE(4)=JFNBGN
      NVALUE(5)=IFNRDY
      NVALUE(6)=KNDLIN
      GO TO 537
C     CURRENT LINE WILL FIT CURRENT PAGE
  525 I=NVALUE(1)
      IF(KDFRFG.GT.0)I=I+KDFRFG+ISPACE
      IF((LFTOVR-IVALUE).LT.I)GO TO 532
C     CURRENT LINE AND FIGURE WILL FIT, BUT INSURE THAT
C     FOOTNOTES ON CURRENT LINE WOULD NOT PREVENT FIGURE
      IFNBGN=IFNRIT
      JFNBGN=JFNRIT
      IFNRDY=IFNTTL
      KNDLIN=ISPACE+KFNGAP
      KOMAND=0
      IVALUE=1+ISPACE
      GO TO 537
  526 I=NVALUE(1)
      IF(KDFRFG.GT.0)I=I+KDFRFG+ISPACE
      IF((LFTOVR-IVALUE).LT.I)GO TO 532
  527 MAJOR=MAJOR+2
      IF(KDFRFG.GT.0)KDFRFG=KDFRFG+ISPACE
      KDFRFG=KDFRFG+NVALUE(1)
      GO TO 543
C     CURRENT LINE WILL NOT FIT CURRENT PAGE
  528 IF((LFTOVR-IVALUE+ISPACE).GE.0)GO TO 532
C     GENERATE END OF PAGE, THEN TRY AGAIN
  529 NVALUE(2)=LNGMID
      LNGMID=0
      GO TO 543
C     THERE WAS A BREAK BEFORE COMMAND
  530 KOMAND=110
      MAJOR=MAJOR+2
      GO TO 122
C     ZERO ARGUMENT, CANCEL OPERATIONS
  531 MAJOR=MAJOR+2
      GO TO 543
C     FIGURE WILL NOT FIT ON CURRENT PAGE
  532 MAJOR=MAJOR+2
      IF(JDFRFG.GT.0)JDFRFG=JDFRFG+ISPACE
      JDFRFG=JDFRFG+NVALUE(1)
      GO TO 543
C
C     .DEFER FIGURE
C     AFTER FORCING THE NEW PAGE, CHECK IF ROOM ON PAGE
C     FIRST CALCULATE THE LINE POSITION OF TOP LINE ON PAGE
  533 LNGMID=NVALUE(2)
      LOCPAG=0
      ISKIP=-1
      IF(IFHEAD.EQ.0)GO TO 534
      I=0
      IF(LSTTTL(2).LE.LSTTTL(5))I=1
      IF(LSTTTL(7).LE.LSTTTL(10))I=1
      J=0
      IF(IFLSUB.GT.0)J=1
      IF(IFRSUB.GT.0)J=1
      IF(LSTTTL(12).LE.LSTTTL(15))J=1
      IF(LSTTTL(17).LE.LSTTTL(20))J=1
      NEEDED=MRGTOP+I+J
      IF(NEEDED.GT.MRGTOP)NEEDED=NEEDED+IGAPHI
      IF(NEEDED.LT.MINTOP)NEEDED=MINTOP
      IF(NEEDED.LE.0)GO TO 534
      LOCPAG=NEEDED
C     PREPARE TO CHECK HOW MUCH ROOM REMAINS ON THE PAGE
  534 IVALUE=1+NVALUE(1)+ISPACE
      NVALUE(3)=IFNBGN
      NVALUE(4)=JFNBGN
      NVALUE(5)=IFNRDY
      NVALUE(6)=KNDLIN
      IFNBGN=IFNRIT
      JFNBGN=JFNRIT
      IFNRDY=IFNTTL
      KNDLIN=ISPACE+KFNGAP
      GO TO 538
C     FIGURE WILL FIT ONTO CURRENT PAGE
  535 LOCPAG=0
      IF(KDFRFG.GT.0)KDFRFG=KDFRFG+ISPACE
      KDFRFG=KDFRFG+NVALUE(1)
      GO TO 543
C     FIGURE WILL NOT FIT ONTO NEW PAGE
  536 LOCPAG=0
      IF(JDFRFG.GT.0)JDFRFG=JDFRFG+ISPACE
      JDFRFG=JDFRFG+NVALUE(1)
      GO TO 543
C
C     TEST PAGE FOR THE DEFER FIGURE COMMAND
  537 IF(ISKIP.GT.0)IVALUE=IVALUE+ISKIP
  538 LFTOVR=LNGPAG-LOCPAG
      IF((LFTOVR-IVALUE).LT.0)GO TO 542
      IF(IFNRDY.LE.0)GO TO 541
      IF(IDEFER.GT.0)GO TO 541
      IF((LOCPAG+KNDLIN).GE.LNGPAG)GO TO 541
      LFTOVR=IFNRDY
      IF(IFNHAV.EQ.0)GO TO 540
      IF(IRECRD.NE.3)GO TO 540
      IF(JFNOPN.LT.0)GO TO 539
      IF(IFNRED.GE.IFNBGN)GO TO 540
      LFTOVR=LFTOVR-NXTFTN
      GO TO 540
  539 IF(JFNRED.GE.JFNBGN)GO TO 540
      LFTOVR=LFTOVR-NXTFTN
  540 I=KNDLIN
      IF(I.LT.(ISPACE+KFNGAP))I=ISPACE+KFNGAP
      LFTOVR=LNGPAG-LOCPAG-LFTOVR-IFNGAP-I
      IF((LFTOVR-IVALUE).LT.0)GO TO 542
C     LINES FIT CURRENT PAGE
  541 IFNBGN=NVALUE(3)
      JFNBGN=NVALUE(4)
      IFNRDY=NVALUE(5)
      KNDLIN=NVALUE(6)
      IF(KOMAND.EQ.0)GO TO 526
      IF(KOMAND.EQ.508)GO TO 525
      GO TO 535
C     LINES DO NOT FIT CURRENT PAGE
  542 IFNBGN=NVALUE(3)
      JFNBGN=NVALUE(4)
      IFNRDY=NVALUE(5)
      KNDLIN=NVALUE(6)
      IF(KOMAND.EQ.0)GO TO 532
      IF(KOMAND.EQ.508)GO TO 528
      GO TO 536
C
C     COMMAND COMPLETED
  543 RETURN
      END
      SUBROUTINE RNONUM(KONTRL,NUMBER,LETTER,KOUNT,MAX)
C     RENBR(/REPRESENT NUMBER AS LETTERS, ROMAN OR ARABIC)
C
C     DONALD E. BARTH, YALE SCHOOL OF MANAGEMENT
C
      DIMENSION LETTER(MAX),LTRABC(26),LWRABC(26),
     1LTRDGT(10),LTRROM(7),LWRROM(7)
      DATA LTRROM/1HI,1HV,1HX,1HL,1HC,1HD,1HM/
      DATA LWRROM/1Hi,1Hv,1Hx,1Hl,1Hc,1Hd,1Hm/
      DATA LTRABC /1HA,1HB,1HC,1HD,1HE,1HF,1HG,1HH,1HI,1HJ,
     1 1HK,1HL,1HM,1HN,1HO,1HP,1HQ,1HR,1HS,1HT,1HU,1HV,1HW,
     2 1HX,1HY,1HZ/
      DATA LWRABC /1Ha,1Hb,1Hc,1Hd,1He,1Hf,1Hg,1Hh,1Hi,1Hj,
     1 1Hk,1Hl,1Hm,1Hn,1Ho,1Hp,1Hq,1Hr,1Hs,1Ht,1Hu,1Hv,1Hw,
     2 1Hx,1Hy,1Hz/
      DATA LTRDGT /1H0,1H1,1H2,1H3,1H4,1H5,1H6,1H7,1H8,1H9/
C
C     DECIDE TYPE OF NUMBERING DESIRED
      IF(NUMBER.EQ.0)GO TO 18
      IF(KONTRL.LE.0)GO TO 20
      IF(KONTRL.LE.3)GO TO 10
      IF(KONTRL.GE.7)GO TO 10
C
C     ********************
C     *                  *
C     *  ROMAN NUMERALS  *
C     *                  *
C     ********************
C
C     DISECT NUMBER
      IF(NUMBER.GT.3999)GO TO 20
      IF(NUMBER.LE.0)GO TO 20
      INIUSD=KOUNT+1
      LFTOVR=NUMBER
      IROMAN=-1
      KASROM=KONTRL-4
      IF(KASROM.EQ.1)KASROM=-1
    1 IF(LFTOVR.LE.0)GO TO 20
      NXTDGT=LFTOVR
      LFTOVR=LFTOVR/10
      IF(KASROM.GT.0)KASROM=LFTOVR
      NXTDGT=NXTDGT-10*LFTOVR
      IROMAN=IROMAN+2
      JROMAN=0
      IF(NXTDGT.LE.3)GO TO 2
      JROMAN=IROMAN+1
      NXTDGT=NXTDGT-5
      IF(NXTDGT.NE.4)GO TO 2
      JROMAN=JROMAN+1
      NXTDGT=-1
C
C     MOVE PREVIOUS DIGITS TO RIGHT
    2 JJ=NXTDGT
      IF(NXTDGT.EQ.-1)JJ=1
      IF(JROMAN.NE.0)JJ=JJ+1
      KK=KOUNT
    3 IF(KK.LT.INIUSD)GO TO 4
      LL=KK+JJ
      LETTER(LL)=LETTER(KK)
      KK=KK-1
      GO TO 3
    4 KOUNT=KOUNT+JJ
C
C     INSERT INITIAL ONE'S CHARACTER
      IF(NXTDGT.NE.-1)GO TO 6
      IF(KK.GE.MAX)GO TO 19
      KK=KK+1
      IF(KASROM.NE.0)GO TO 5
      LETTER(KK)=LTRROM(IROMAN)
      KASROM=KONTRL-4
      GO TO 6
    5 LETTER(KK)=LWRROM(IROMAN)
C
C     INSERT FIVE'S OR TEN'S CHARACTER
    6 IF(JROMAN.EQ.0)GO TO 8
      IF(KK.GE.MAX)GO TO 19
      KK=KK+1
      IF(KASROM.NE.0)GO TO 7
      LETTER(KK)=LTRROM(JROMAN)
      KASROM=KONTRL-4
      GO TO 8
    7 LETTER(KK)=LWRROM(JROMAN)
C
C     INSERT UP TO 3 ONE'S CHARACTERS
    8 IF(NXTDGT.LE.0)GO TO 1
      IF(KK.GE.MAX)GO TO 19
      KK=KK+1
      NXTDGT=NXTDGT-1
      IF(KASROM.NE.0)GO TO 9
      LETTER(KK)=LTRROM(IROMAN)
      KASROM=KONTRL-4
      GO TO 8
    9 LETTER(KK)=LWRROM(IROMAN)
      GO TO 8
C
C     ************************************************
C     *                                              *
C     *  ARABIC, HEXADECIMAL OR ALPHABETIC NUMERALS  *
C     *                                              *
C     ************************************************
C
C     DISECT NUMBER
   10 INIUSD=KOUNT+1
      LFTOVR=NUMBER
      KASROM=KONTRL-7
      IF(KASROM.EQ.1)KASROM=-1
      IRADIX=10
      IF(KONTRL.EQ.2)IRADIX=8
      IF(KONTRL.EQ.3)IRADIX=16
      IF(KONTRL.GT.6)IRADIX=26
   11 IF(LFTOVR.LE.0)GO TO 20
      NXTDGT=LFTOVR
      LFTOVR=LFTOVR/IRADIX
      IF(KASROM.GT.0)KASROM=LFTOVR
      NXTDGT=NXTDGT-IRADIX*LFTOVR
C
C     INSERT DIGIT
      IF(KOUNT.GE.MAX)GO TO 19
      II=KOUNT
   12 IF(II.LT.INIUSD)GO TO 13
      LETTER(II+1)=LETTER(II)
      II=II-1
      GO TO 12
   13 KOUNT=KOUNT+1
      IF(IRADIX.EQ.26)GO TO 14
      IF(NXTDGT.GE.10)GO TO 16
      LETTER(INIUSD)=LTRDGT(NXTDGT+1)
      GO TO 11
   14 IF(NXTDGT.GT.0)GO TO 15
      NXTDGT=26
      LFTOVR=LFTOVR-1
   15 IF(KASROM.EQ.0)GO TO 17
      LETTER(INIUSD)=LWRABC(NXTDGT)
      GO TO 11
   16 NXTDGT=NXTDGT-9
   17 LETTER(INIUSD)=LTRABC(NXTDGT)
      GO TO 11
C
C     SPECIAL CASE FOR ZERO
   18 IF(KOUNT.GE.MAX)GO TO 20
      KOUNT=KOUNT+1
      LETTER(KOUNT)=LTRDGT(1)
      GO TO 20
C
C     RETURN TO CALLING PROGRAM
   19 KOUNT=INIUSD-1
   20 RETURN
      END
      SUBROUTINE RNOUND(ILETTR,NDXLFT,ILNGTH,NDXXTR,
     1LTRWRK,LNGWRK,LMTWRK,IFLINE)
C     RENBR(/UNDERSCORE LINE OF TEXT STORED AS CODES)
C
C     DONALD E. BARTH, YALE SCHOOL OF MANAGEMENT
C
      DIMENSION ILETTR(300),LTRWRK(LMTWRK)
      DATA LTRSPA,LTRUND/1H ,1H_/
      NDXCPY=NDXLFT
      LNGWRK=NDXXTR
      LNGUND=LNGWRK
      IFLINE=0
    1 IF(NDXCPY.GE.ILNGTH)GO TO 3
      IF(LNGUND.GE.LMTWRK)GO TO 3
      NDXCPY=NDXCPY+1
      I=ILETTR(NDXCPY)
      IF(I.LT.0)GO TO 3
      J=I/2
      I=I-(2*J)
      LNGUND=LNGUND+1
      IF(I.NE.0)GO TO 2
      LTRWRK(LNGUND)=LTRSPA
      GO TO 1
    2 IFLINE=1
      LTRWRK(LNGUND)=LTRUND
      LNGWRK=LNGUND
      GO TO 1
    3 RETURN
      END
      SUBROUTINE RNOCOD
C     RENBR(/CONVERT LETTERS TO NUMERIC CODES)
C
C     DONALD E. BARTH, YALE SCHOOL OF MANAGEMENT
C
      COMMON/RNOONE/I     ,IAPNDX,IBRFTN,IBYTE ,ICENTR,
     1ICHAPT,IDEBUG,IDEFER,IDFILE,IDFRFG,IDFRPG,IDISK ,
     2IFABAR,IFAUTO,IFENCE,IFFILL,IFFLAG,IFHEAD,IFLIST,
     3IFLOOP,IFLSUB,IFNATO,IFNBGN,IFNFIL,IFNGAP,
     4IFNGSP,IFNHAV,IFNIBR,IFNICN,IFNIDF,IFNIFA,IFNIIN,
     5IFNILF,IFNIND,IFNIRT,IFNISP,IFNJCN,IFNJDF,IFNJFL,
     6IFNJST,IFNKCN,IFNKDF,IFNKLM,IFNLBR,IFNLBS,IFNLOF,
     7IFNLSP,IFNMBR,IFNMFR,IFNMLF,IFNMNS,IFNMRT,
     8IFNNBR,IFNNIN,IFNNLF,IFNNOF,IFNNOT,IFNNRT,IFNNSK,
     9IFNNTF,IFNNTL,IFNNTR,IFNNTS,IFNNTT,IFNNT1,IFNNT2
      COMMON/RNOTWO/IFNNT3,IFNOFF,IFNOPN,IFNOTE,IFNPIN,
     1IFNPRD,IFNPSK,IFNPTS,IFNRBS,IFNRDY,IFNRED,IFNRIT,
     2IFNROF,IFNTTL,IFNULS,IFNUMB,IFPAGE,IFRSUB,IFSPLC,
     3IGAPHI,IGAPLO,IGROUP,IMINUS,INDENT,INDFTN,INIALL,
     4INIAPP,INIBAR,INICHA,INIFRM,INILIN,ININDX,ININXT,
     5INISPA,INITAL,INNOTE,INTIND,INTLFT,INTRIT,INTRVL,
     6IOFFST,IPEROD,IPGSHO,IQUOTE,IRANGE,IREVRS,IRTBAS,
     7IRTFTN,IRTOFF,IRUNIN,ISECTN,ISKFTN,ISKIP ,ISPACE,
     8ISTART,ISUBPG,ITLALL,ITLLIN,ITLNXT,ITLSPA,ITRMNL,
     9ITTY  ,IULSPC,IVALUE,IWIZRD,J     ,JCENTR,JDFRFG
      COMMON/RNOTHR/JDFRPG,JDISK ,JFILL ,JFNBGN,JFNGAP,
     1JFNOPN,JFNRED,JFNRIT,JGROUP,JMINUS,JOFFST,JRANGE,
     2JSECTN,JSKIP ,JSTIFY,JTTY  ,JVALUE,K     ,KAPITL,
     3KASALL,KASFLG,KASLCL,KCENTR,KDFRFG,KDISK ,KFNGAP,
     4KLMFIL,KLMMNS,KMINUS,KNDAPP,KNDCHA,KNDFIL,KNDLFT,
     5KNDLIN,KNDPAG,KNDRIT,KNDSPL,KNDSUB,KNDTRN,KNTARG,
     6KNTCOD,KNTFTN,KNTFXD,KNTLIN,KNTLOP,KNTLVL,KNTPAG,
     7KNTPNT,KNTRST,KNTSHO,KNTSPC,KNTSPL,KNTTOP,KNTXTR,
     8KOMAND,KOMENT,KONECT,KPYBGN,KPYKAS,KPYMID,KPYPRT,
     9KRANGE,KSKIP ,KVALUE,LCLBAR,LCLNDX,LCLSUP,KAPNDX
      COMMON/RNOFOU/LDISK ,LENGTH,LEVEL0,LEVEL1,LEVEL3,
     1LEVEL4,LFNGAP,LFTBAS,ILFFTN,LFTOFF,LFTRIT,LINFIG,
     2LINSPL,LITERL,LMTBGN,LMTCHA,LMTCOD,LMTFNR,LMTKAS,
     3LMTLST,LMTLVL,LMTMID,LMTNDX,LMTTAB,LMTTTL,LMTUNT,
     4LMTWRK,LNGBGN,LNGBOT,LNGCHA,LNGFNR,LNGFTN,LNGMID,
     5NXTFTN,LNGPAG,LNGSPL,LNGSRC,LNGTRN,LNGTTL,KNDNDX,
     6LOCABC,LOCATE,LOCPAG,LOCPNT,LOKSUP,LOWBFR,NSKIP ,
     7LRADJS,LRFORC,LSNSPL,LSNSRC,LSTAPP,LSTCHA,LSTELM,
     8LSTFRM,LSTSPL,LSTTRN,MAJOR ,MASTER,MAXBGN,MAXLIN,
     9MAXLOP,MAXSPL,MAXTAB,MAXWRD,MDISK ,MIDAPP,MIDCHA
      COMMON/RNOFIV/MINLVL,MINTOP,MOVBAC,MRGFAR,MRGLFT,
     1MRGRIT,MRGTOP,MRKAMP,MRKBAC,MRKBAR,MRKCAR,MRKDOL,
     2MRKDOT,MRKEFN,MRKEXC,MRKFTN,MRKLES,MRKNDX,MRKNUM,
     3MRKREF,MRKSBX,MRKSEM,MRKSUB,MRKSUP,MRKTTL,MRKTXT,
     4MRKUND,MSTLST,NDISK ,NDXDSK,NDXFOU,NDXHOW,NDXKNT,
     5NDXMAK,NDXONE,NDXOPN,NDXTHR,NDXTWO,NEEDED,NEWCHA,
     6NEWPAG,NOTFIL,NOTIND,NOTKLM,NOTLFT,NOTMNS,NOTONE,
     7NOTRIT,NOTSEM,NOTSKP,NOTSPC,NOTTHR,NOTTST,NOTTWO,
     8NOWBAR,NOWFTN,NOWIND,NOWLFT,NOWLST,NOWOFF,NOWPAG,
     9NOWPHW,NOWRIT,NOWSEC,NOWSHW,NOWSKP,NOWSPH,NOWSUB
      COMMON/RNOSIX/NOWTST,NULTTL,NUMFTN,NXTFIG,NXTHDR,
     1NXTLST,NXTLVL,NXTONE,NXTPAG,NXTSUB,KNDOUT,LNGWRK,
     2KAPFTN,KOFFST,IRECRD,KNTNDX,INIPAG,INIHIA,MAGNFY,
     3INIHIB,IFHALF,KTRMNL,ITTLLO,ISUBLO,LNGTOP,MAGFNT,
     4ITTLHI,ISUBHI,IFINDX,IXTRSS,JXTRSS,KXTRSS,MAGSPC,
     5MXTRSS,NXTRSS,IFORMR,JTRMNL,IFNREF,IFNNUM,KMPPAG,
     6KMPLIN,KMPCLM,KMPVAL,INICLM,MFNGAP,NFNGAP,MAGSAV,
     7MAGSHD,MAGHIH,MRKMAG,LMTSHD,LNGSHD,LFTSHD,IRISHD,
     8IHISHD,ILOSHD,KNTSHD,LFTSGN,IRISGN,NGLSHD,NETNGL,
     9NETSEP,NETWID,NETOFF,NETKNT,KNTEDT,LMTEDT,LMTBIG,
     1LNGBIG,NGLBIG,KNTBIG,NXTSKP,JBORDR,INIMAG,INIOBJ,
     2IBORDR
      COMMON/RNOEIG/INDLST(10)  ,KMDARG(250) ,KMDBRK(250) ,
     1 KNDLVL(6)   ,KNDTTL(16)  ,LOCTAB(32)  ,LSTMRG(10)  ,
     2 LSTRIT(10)  ,LSTSKP(10)  ,LSTSPC(10)  ,LSTTTL(80)  ,
     3 LSTTYP(10)  ,LSTVAL(10)  ,MCHPNT(1300),MSKBGN(300) ,
     4 MSKCHA(200) ,MSKFNR(200) ,MSKFTN(200) ,MSKMID(200) ,
     5 MSKTTL(450) ,NARGMT(44)  ,NBEGIN(19)  ,NMINUS(32)  ,
     6 NOTPNT(1300),NUMLVL(6)   ,NUMNDX(300) ,NUMTTL(11)  ,
     7 NVALUE(32)  ,NXTCMD(81)  ,NXTPNT(12)  ,NXTUNT(4)   ,
     8 MSKWRK(200) ,MTYSTR(4)   ,MAGEDT(50)
      COMMON/RNONIN/LTRAMP,LTRBAC,LTRBAR,LTRCAR,LTRCOM,
     1LTRDOL,LTRDOT,LTREFN,LTREXC,LTRFNC,LTRLES,
     2LTRMNS,LTRNDX,LTRNOW,LTRNUM,LTRPLS,LTRQUO,LTRRUL,
     3LTRSBX,LTRSEM,LTRSPA,LTRSUB,LTRSUP,LTRTAB,
     4LTRPUT,LTRTXT,LTRUND,LTR1ST,LTRMAG
      COMMON/RNOTEN/LTRABC(26)  ,LTRAPP(9)   ,LTRBGN(300) ,
     1 LTRCPT(8)   ,LTRCLS(10)  ,LTRCOD(70)  ,LTRDGT(10)  ,
     2 LTRFLG(18)  ,LTRFTN(200) ,LTRIND(5)   ,LTRLST(10,6),
     3 LTRMID(200) ,LTRONL(26)  ,LTRONU(26)  ,LTROPN(10)  ,
     4 LTRPAG(5)   ,LTRREF(4)   ,LTRSPL(200) ,LTRTWO(4)   ,
     5 LTRTYP(8)   ,LTRWRK(200) ,LWRABC(26)  ,LWRAPP(9)   ,
     6 LWRCHA(8)   ,LWRIND(5)   ,LWRONL(26)  ,LWRONU(26)  ,
     7 LWRTYP(8)   ,LTRTTL(450) ,LTRCHA(200) ,LTRFNR(200) ,
     8 LTRSHD(50)  ,LTRBIG(50)
C
      LFTNDX=KNTNDX
      JFIRST=IVALUE
    1 IF(JFIRST.GT.IMINUS)GO TO 10
      IF(KNTNDX.GE.LMTNDX)GO TO 10
      LTRNOW=LTRBGN(JFIRST)
      MSKBIT=MSKBGN(JFIRST)
      ITLFLG=0
      IF(KOMAND.EQ.503)GO TO 2
      CALL RNOUNP(2,MSKBIT)
      IF(MSKBIT.NE.0)ITLFLG=1
      IF(MRKSBX.LE.0)GO TO 2
      IF(LTRNOW.NE.LTRSBX)GO TO 2
      MSKBIT=MSKBGN(JFIRST)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 8
    2 IF(LTRNOW.EQ.LTRSPA)GO TO 6
      IF(LTRNOW.EQ.LTRTAB)GO TO 6
      DO 4 I=1,26
      IF(LTRNOW.NE.LTRABC(I))GO TO 3
      KODE=I+I
      IF(KAPNDX.LE.0)GO TO 7
      IF(KOMAND.NE.503)GO TO 7
      IF(KNTNDX.EQ.LFTNDX)GO TO 7
      MSKBIT=MSKBGN(JFIRST)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 7
      KODE=KODE+1
      GO TO 7
    3 IF(LTRNOW.NE.LWRABC(I))GO TO 4
      KODE=I+I+1
      IF(KAPNDX.LT.0)GO TO 7
      IF(KNTNDX.GT.LFTNDX)GO TO 7
      MSKBIT=MSKBGN(JFIRST)
      CALL RNOUNP(3,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 7
      KODE=KODE-1
      GO TO 7
    4 CONTINUE
      DO 5 I=1,KNTCOD
      IF(LTRNOW.NE.LTRCOD(I))GO TO 5
      KODE=53+I
      GO TO 7
    5 CONTINUE
      IF(KNTCOD.GE.LMTCOD)GO TO 9
      KNTCOD=KNTCOD+1
      LTRCOD(KNTCOD)=LTRNOW
      KODE=53+KNTCOD
      GO TO 7
    6 KODE=0
      MSKBIT=MSKBGN(JFIRST)
      CALL RNOUNP(2,MSKBIT)
      IF(MSKBIT.NE.0)ITLFLG=1
    7 KNTNDX=KNTNDX+1
      NUMNDX(KNTNDX)=(2*KODE)+ITLFLG
      GO TO 9
    8 IF(KNTNDX.EQ.LFTNDX)GO TO 9
      IF(NUMNDX(KNTNDX).LT.0)GO TO 9
      KNTNDX=KNTNDX+1
      NUMNDX(KNTNDX)=-1
    9 JFIRST=JFIRST+1
      GO TO 1
   10 RETURN
      END
      SUBROUTINE RNONAM(IDFILE)
C     RENBR(/GET 6 DIGIT NUMBER UNIQUE TO THIS JOB)
C
C     DONALD E. BARTH, YALE SCHOOL OF MANAGEMENT
C
C     IDFILE = RETURNED WITH 6  DIGIT NUMBER UNIQUE TO THIS
C              JOB
C
C     THE SECNDS ROUTINE IS FIRST CALLED TO OBTAIN THE TIME
C     AS  THE  NUMBER  OF SECONDS SINCE MIDNIGHT.  THE FILE
C     NAME IS THEN CONSTRUCTED FROM THE NUMBER OF TENTHS OF
C     SECONDS  SINCE  MIDNIGHT  PLUS 100000.  THE OFFSET IS
C     ADDED TO FORCE THE NUMBER TO CONSIST OF 6  CHARACTERS
C     WHEN WRITTEN AS A DECIMAL INTEGER.  THE MAXIMUM VALUE
C     INCLUDING THIS OFFSET IS 963999.
C
      IDFILE=100000.0+10.0*SECNDS(0.0)
      END
      SUBROUTINE RNOCHR(MRGLFT,IFBACK,IFMORE,ILETTR,ILNGTH,
     1    NUMNDX,JLNGTH,IDIFFR,NDXLFT,NDXXTR,JDIFFR)
C     RENBR(/CONVERT CODES TO LETTERS FOR USE IN INDEX)
C
C     DONALD E. BARTH, YALE SCHOOL OF MANAGEMENT
C
      DIMENSION ILETTR(300),NUMNDX(300)
      NDXXTR=0
      IF(MRGLFT.GT.0)NDXXTR=MRGLFT
      IDIFFR=0
      IF(IFBACK.GE.0)GO TO 9
      IF(ILNGTH.EQ.0)GO TO 2
      IF(ILETTR(1).EQ.NUMNDX(1))GO TO 2
      I=ILETTR(1)/2
      J=NUMNDX(1)/2
      IF(I.GT.53)GO TO 1
      IF(J.GT.53)GO TO 1
      I=I/2
      J=J/2
    1 IF(I.NE.J)IDIFFR=1
    2 INICHR=0
      IF(ILNGTH.LE.0)GO TO 7
      LMTCHR=0
    3 LMTCHR=LMTCHR+1
      IF(LMTCHR.GT.ILNGTH)GO TO 4
      IF(LMTCHR.GT.JLNGTH)GO TO 7
      IF(ILETTR(LMTCHR).NE.NUMNDX(LMTCHR))GO TO 7
      IF(ILETTR(LMTCHR).GE.0)GO TO 3
      INICHR=LMTCHR
      NDXXTR=NDXXTR+2
      GO TO 3
    4 IF(ILNGTH.GE.JLNGTH)GO TO 5
      IF(NUMNDX(ILNGTH+1).GE.0)GO TO 7
      GO TO 6
    5 IF(JDIFFR.EQ.0)GO TO 7
    6 INICHR=ILNGTH+1
      ILETTR(INICHR)=NUMNDX(INICHR)
      NDXXTR=NDXXTR+2
    7 LMTCHR=INICHR
      ILNGTH=INICHR
      NDXLFT=INICHR
    8 IF(IFBACK.GE.0)GO TO 12
      IF(LMTCHR.GE.JLNGTH)GO TO 14
      LMTCHR=LMTCHR+1
      ILETTR(LMTCHR)=NUMNDX(LMTCHR)
      GO TO 13
    9 IF(IFBACK.LE.0)GO TO 11
      LMTCHR=0
   10 LMTCHR=LMTCHR+1
      IF(LMTCHR.GT.IFBACK)GO TO 11
      IF(ILETTR(LMTCHR).GE.0)GO TO 10
      IFBACK=LMTCHR
      NDXXTR=NDXXTR+2
      GO TO 10
   11 LMTCHR=IFBACK
      NDXLFT=IFBACK
   12 IF(LMTCHR.GE.ILNGTH)GO TO 14
      LMTCHR=LMTCHR+1
   13 IF(ILETTR(LMTCHR).GE.0)GO TO 8
      IFMORE=1
      GO TO 15
   14 IFMORE=0
   15 IF(IFBACK.GE.0)GO TO 17
      ILNGTH=LMTCHR
   16 IF(LMTCHR.GE.JLNGTH)GO TO 19
      LMTCHR=LMTCHR+1
      IF(NUMNDX(LMTCHR).LT.0)IFMORE=IFMORE+1
      GO TO 16
   17 IFBACK=LMTCHR
   18 IF(LMTCHR.GE.ILNGTH)GO TO 19
      LMTCHR=LMTCHR+1
      IF(ILETTR(LMTCHR).LT.0)IFMORE=IFMORE+1
      GO TO 18
   19 RETURN
      END
      SUBROUTINE RNOLTR(MRGLFT,LTRWRK,LMTWRK,LNGWRK,
     1LTRABC,LWRABC,LTRCOD,LMTCOD,ILETTR,ILNGTH,LMTCHR)
C     RENBR(/CONVERT CODES TO LETTERS EXCEPT FOR IN INDEX)
C
C     DONALD E. BARTH, YALE SCHOOL OF MANAGEMENT
C
      DIMENSION LTRABC(26),LWRABC(26),LTRCOD(LMTCOD),
     1LTRWRK(LMTWRK),ILETTR(ILNGTH)
      DATA LTRSPA/1H /
      IF(MRGLFT.LE.0)GO TO 2
      DO 1 I=1,MRGLFT
      IF(LNGWRK.GE.LMTWRK)GO TO 6
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRSPA
    1 CONTINUE
    2 IF(LMTCHR.GE.ILNGTH)GO TO 6
      IF(LNGWRK.GE.LMTWRK)GO TO 6
      LMTCHR=LMTCHR+1
      KODE=ILETTR(LMTCHR)
      IF(KODE.LT.0)GO TO 2
      KODE=KODE/2
      LNGWRK=LNGWRK+1
      IF(KODE.GT.0)GO TO 3
      LTRWRK(LNGWRK)=LTRSPA
      GO TO 2
    3 IF(KODE.GT.53)GO TO 5
      I=KODE/2
      IF(KODE.NE.(2*I))GO TO 4
      LTRWRK(LNGWRK)=LTRABC(I)
      GO TO 2
    4 LTRWRK(LNGWRK)=LWRABC(I)
      GO TO 2
    5 LTRWRK(LNGWRK)=LTRCOD(KODE-53)
      GO TO 2
    6 RETURN
      END
      SUBROUTINE RNOCMP(NUMNDX,ILNGTH,JLETTR,JLNGTH,LMTNDX,
     1IDIFFR)
C     RENBR(/COMPAR AND FIND STRING LOWER IN ALPHABET)
C
C     DONALD E. BARTH, YALE SCHOOL OF MANAGEMENT
C
      DIMENSION NUMNDX(LMTNDX),JLETTR(LMTNDX)
      KOMPAR=ILNGTH
      IF(KOMPAR.GT.JLNGTH)KOMPAR=JLNGTH
      IF(KOMPAR.LE.0)GO TO 9
      INDEX=0
    1 INDEX=INDEX+1
      IF(INDEX.GT.KOMPAR)GO TO 5
      IABC=NUMNDX(INDEX)
      JABC=JLETTR(INDEX)
      IF(IABC.EQ.JABC)GO TO 1
      IF(IABC.LT.0)GO TO 10
      IF(JABC.LT.0)GO TO 11
C     107 IN FOLLOWING LINES IS MAXIMUM VALUE FOR LETTER
C     107 = 26*4 + 2 + 1 FOR Z, LOWER CASE, ITALIC
      IF(IABC.GT.107)GO TO 2
      IF(JABC.LE.107)GO TO 3
      GO TO 10
    2 IF(JABC.LE.107)GO TO 11
      IABC=IABC/2
      JABC=JABC/2
      GO TO 4
    3 IABC=IABC/4
      JABC=JABC/4
    4 IF(IABC.EQ.JABC)GO TO 1
      IF(IABC.LT.JABC)GO TO 10
      GO TO 11
    5 IF(ILNGTH.LT.JLNGTH)GO TO 11
      IF(ILNGTH.GT.JLNGTH)GO TO 10
      INDEX=0
    6 INDEX=INDEX+1
      IF(INDEX.GT.KOMPAR)GO TO 7
      IABC=NUMNDX(INDEX)/2
      JABC=JLETTR(INDEX)/2
      IF(IABC.EQ.JABC)GO TO 6
      IF(IABC.LT.JABC)GO TO 10
      GO TO 11
    7 INDEX=0
    8 INDEX=INDEX+1
      IF(INDEX.GT.KOMPAR)GO TO 9
      IABC=NUMNDX(INDEX)
      JABC=JLETTR(INDEX)
      IF(IABC.EQ.JABC)GO TO 8
      IF(IABC.LT.JABC)GO TO 10
      GO TO 11
    9 IDIFFR=0
      GO TO 12
   10 IDIFFR=1
      GO TO 12
   11 IDIFFR=-1
   12 RETURN
      END
      SUBROUTINE RNOPAK(LOCBIT,IVALUE)
C     RENBR(/PACK LETTER CHARACTERISTIC)
C     LOCBIT = LOCATION OF BIT
C            = 1, ON IF CHARACTER IS SPACE
C            = 2, ON IF CHARACTER IS ITALIC
C            = 3, ON IF CHARACTER IS QUOTED BY UNDERSCORE
C            = 4, ON IF CHARACTER IS SUPERSCRIPT
C            = 5, ON IF CHARACTER IS SUBSCRIPT
C     IVALUE = PACKED VALUE IN WHICH BIT IS TO BE TURNED ON
      DIMENSION MSKBIT(10)
      DATA MSKBIT/1,2,4,8,16,32,64,128,256,512/
      IF(IVALUE.LE.0)GO TO 1
      JVALUE=IVALUE/MSKBIT(LOCBIT)
      IF(JVALUE.LE.0)GO TO 1
      KVALUE=JVALUE/2
      LVALUE=JVALUE-(2*KVALUE)
      IF(LVALUE.NE.0)GO TO 2
    1 IVALUE=MSKBIT(LOCBIT)+IVALUE
    2 RETURN
      END
      SUBROUTINE RNOUNP(LOCBIT,IVALUE)
C     RENBR(/UNPACK LETTER CHARACTERISTIC)
C     LOCBIT = LOCATION OF BIT TO BE SAMPLED
C     IVALUE = INPUT CONTAINING PACKED VALUE TO BE SAMPLED
C            = RETURNED WITH VALUE OF BIT INDICATED BY
C              LOCBIT
      DIMENSION MSKBIT(10)
      DATA MSKBIT/1,2,4,8,16,32,64,128,256,512/
      IF(IVALUE.LE.0)GO TO 1
      JVALUE=IVALUE/MSKBIT(LOCBIT)
      IF(JVALUE.LE.0)GO TO 1
      KVALUE=JVALUE/2
      IVALUE=JVALUE-(2*KVALUE)
      GO TO 2
    1 IVALUE=0
    2 RETURN
      END
      SUBROUTINE RNOLIN
C     RENBR(/OUTPUT A SINGLE LINE)
C
C     DONALD E. BARTH, YALE SCHOOL OF MANAGEMENT
C
C     KTRMNL = 0, ULTIMATE   OUTPUT   DEVICE   CANNOT    DO
C              HALF-LINE FEEDS.
C            = 1, OUTPUT DEVICE USED FOR DRAFTS  CANNOT  DO
C              HALF-LINE    FEEDS,    BUT   DOCUMENT   WILL
C              ULTIMATELY  BE  PRODUCED  ON  OUTPUT  DEVICE
C              WHICH CAN DO HALF-LINE FEEDS.
C            = 2, OUTPUT DEVICE CAN DO HALF-LINE  FEEDS  TO
C              POSITION  LOWER  ON  PAGE,  BUT  CANNOT THEN
C              RETURN TO HIGHER POSITION.
C            = 3, OUTPUT DEVICE CAN DO HALF-LINE  FEEDS  IN
C              BOTH DIRECTIONS.
C
C     KNDOUT = 1, GENERATE ORDINARY PRINTING LINE ON PAGE
C            = 2, GENERATE BLANK LINE WHICH CAN CONTAIN
C                 CHANGE BAR.
C            = 3, GENERATE COMPLETELY BLANK LINE.  THIS WILL
C                 NEVER CONTAIN CHANGE BARS.
C            = 4, GENERATE TITLE CONTAINED IN LTRWRK AND IN
C                 MSKWRK.  THIS WILL NEVER CONTAIN CHANGE BARS.
C            = 5, SIMILAR TO =4, BUT CAN CONTAIN CHANGE BARS.
C            = 6, FORCE OUT FINAL BLANK LINE IF ONE IS BEING
C                 HELD FOR POSSIBLE SUPERSCRIPTS ON NEXT LINE.
C
      COMMON/RNOONE/I     ,IAPNDX,IBRFTN,IBYTE ,ICENTR,
     1ICHAPT,IDEBUG,IDEFER,IDFILE,IDFRFG,IDFRPG,IDISK ,
     2IFABAR,IFAUTO,IFENCE,IFFILL,IFFLAG,IFHEAD,IFLIST,
     3IFLOOP,IFLSUB,IFNATO,IFNBGN,IFNFIL,IFNGAP,
     4IFNGSP,IFNHAV,IFNIBR,IFNICN,IFNIDF,IFNIFA,IFNIIN,
     5IFNILF,IFNIND,IFNIRT,IFNISP,IFNJCN,IFNJDF,IFNJFL,
     6IFNJST,IFNKCN,IFNKDF,IFNKLM,IFNLBR,IFNLBS,IFNLOF,
     7IFNLSP,IFNMBR,IFNMFR,IFNMLF,IFNMNS,IFNMRT,
     8IFNNBR,IFNNIN,IFNNLF,IFNNOF,IFNNOT,IFNNRT,IFNNSK,
     9IFNNTF,IFNNTL,IFNNTR,IFNNTS,IFNNTT,IFNNT1,IFNNT2
      COMMON/RNOTWO/IFNNT3,IFNOFF,IFNOPN,IFNOTE,IFNPIN,
     1IFNPRD,IFNPSK,IFNPTS,IFNRBS,IFNRDY,IFNRED,IFNRIT,
     2IFNROF,IFNTTL,IFNULS,IFNUMB,IFPAGE,IFRSUB,IFSPLC,
     3IGAPHI,IGAPLO,IGROUP,IMINUS,INDENT,INDFTN,INIALL,
     4INIAPP,INIBAR,INICHA,INIFRM,INILIN,ININDX,ININXT,
     5INISPA,INITAL,INNOTE,INTIND,INTLFT,INTRIT,INTRVL,
     6IOFFST,IPEROD,IPGSHO,IQUOTE,IRANGE,IREVRS,IRTBAS,
     7IRTFTN,IRTOFF,IRUNIN,ISECTN,ISKFTN,ISKIP ,ISPACE,
     8ISTART,ISUBPG,ITLALL,ITLLIN,ITLNXT,ITLSPA,ITRMNL,
     9ITTY  ,IULSPC,IVALUE,IWIZRD,J     ,JCENTR,JDFRFG
      COMMON/RNOTHR/JDFRPG,JDISK ,JFILL ,JFNBGN,JFNGAP,
     1JFNOPN,JFNRED,JFNRIT,JGROUP,JMINUS,JOFFST,JRANGE,
     2JSECTN,JSKIP ,JSTIFY,JTTY  ,JVALUE,K     ,KAPITL,
     3KASALL,KASFLG,KASLCL,KCENTR,KDFRFG,KDISK ,KFNGAP,
     4KLMFIL,KLMMNS,KMINUS,KNDAPP,KNDCHA,KNDFIL,KNDLFT,
     5KNDLIN,KNDPAG,KNDRIT,KNDSPL,KNDSUB,KNDTRN,KNTARG,
     6KNTCOD,KNTFTN,KNTFXD,KNTLIN,KNTLOP,KNTLVL,KNTPAG,
     7KNTPNT,KNTRST,KNTSHO,KNTSPC,KNTSPL,KNTTOP,KNTXTR,
     8KOMAND,KOMENT,KONECT,KPYBGN,KPYKAS,KPYMID,KPYPRT,
     9KRANGE,KSKIP ,KVALUE,LCLBAR,LCLNDX,LCLSUP,KAPNDX
      COMMON/RNOFOU/LDISK ,LENGTH,LEVEL0,LEVEL1,LEVEL3,
     1LEVEL4,LFNGAP,LFTBAS,ILFFTN,LFTOFF,LFTRIT,LINFIG,
     2LINSPL,LITERL,LMTBGN,LMTCHA,LMTCOD,LMTFNR,LMTKAS,
     3LMTLST,LMTLVL,LMTMID,LMTNDX,LMTTAB,LMTTTL,LMTUNT,
     4LMTWRK,LNGBGN,LNGBOT,LNGCHA,LNGFNR,LNGFTN,LNGMID,
     5NXTFTN,LNGPAG,LNGSPL,LNGSRC,LNGTRN,LNGTTL,KNDNDX,
     6LOCABC,LOCATE,LOCPAG,LOCPNT,LOKSUP,LOWBFR,NSKIP ,
     7LRADJS,LRFORC,LSNSPL,LSNSRC,LSTAPP,LSTCHA,LSTELM,
     8LSTFRM,LSTSPL,LSTTRN,MAJOR ,MASTER,MAXBGN,MAXLIN,
     9MAXLOP,MAXSPL,MAXTAB,MAXWRD,MDISK ,MIDAPP,MIDCHA
      COMMON/RNOFIV/MINLVL,MINTOP,MOVBAC,MRGFAR,MRGLFT,
     1MRGRIT,MRGTOP,MRKAMP,MRKBAC,MRKBAR,MRKCAR,MRKDOL,
     2MRKDOT,MRKEFN,MRKEXC,MRKFTN,MRKLES,MRKNDX,MRKNUM,
     3MRKREF,MRKSBX,MRKSEM,MRKSUB,MRKSUP,MRKTTL,MRKTXT,
     4MRKUND,MSTLST,NDISK ,NDXDSK,NDXFOU,NDXHOW,NDXKNT,
     5NDXMAK,NDXONE,NDXOPN,NDXTHR,NDXTWO,NEEDED,NEWCHA,
     6NEWPAG,NOTFIL,NOTIND,NOTKLM,NOTLFT,NOTMNS,NOTONE,
     7NOTRIT,NOTSEM,NOTSKP,NOTSPC,NOTTHR,NOTTST,NOTTWO,
     8NOWBAR,NOWFTN,NOWIND,NOWLFT,NOWLST,NOWOFF,NOWPAG,
     9NOWPHW,NOWRIT,NOWSEC,NOWSHW,NOWSKP,NOWSPH,NOWSUB
      COMMON/RNOSIX/NOWTST,NULTTL,NUMFTN,NXTFIG,NXTHDR,
     1NXTLST,NXTLVL,NXTONE,NXTPAG,NXTSUB,KNDOUT,LNGWRK,
     2KAPFTN,KOFFST,IRECRD,KNTNDX,INIPAG,INIHIA,MAGNFY,
     3INIHIB,IFHALF,KTRMNL,ITTLLO,ISUBLO,LNGTOP,MAGFNT,
     4ITTLHI,ISUBHI,IFINDX,IXTRSS,JXTRSS,KXTRSS,MAGSPC,
     5MXTRSS,NXTRSS,IFORMR,JTRMNL,IFNREF,IFNNUM,KMPPAG,
     6KMPLIN,KMPCLM,KMPVAL,INICLM,MFNGAP,NFNGAP,MAGSAV,
     7MAGSHD,MAGHIH,MRKMAG,LMTSHD,LNGSHD,LFTSHD,IRISHD,
     8IHISHD,ILOSHD,KNTSHD,LFTSGN,IRISGN,NGLSHD,NETNGL,
     9NETSEP,NETWID,NETOFF,NETKNT,KNTEDT,LMTEDT,LMTBIG,
     1LNGBIG,NGLBIG,KNTBIG,NXTSKP,JBORDR,INIMAG,INIOBJ,
     2IBORDR
      COMMON/RNOEIG/INDLST(10)  ,KMDARG(250) ,KMDBRK(250) ,
     1 KNDLVL(6)   ,KNDTTL(16)  ,LOCTAB(32)  ,LSTMRG(10)  ,
     2 LSTRIT(10)  ,LSTSKP(10)  ,LSTSPC(10)  ,LSTTTL(80)  ,
     3 LSTTYP(10)  ,LSTVAL(10)  ,MCHPNT(1300),MSKBGN(300) ,
     4 MSKCHA(200) ,MSKFNR(200) ,MSKFTN(200) ,MSKMID(200) ,
     5 MSKTTL(450) ,NARGMT(44)  ,NBEGIN(19)  ,NMINUS(32)  ,
     6 NOTPNT(1300),NUMLVL(6)   ,NUMNDX(300) ,NUMTTL(11)  ,
     7 NVALUE(32)  ,NXTCMD(81)  ,NXTPNT(12)  ,NXTUNT(4)   ,
     8 MSKWRK(200) ,MTYSTR(4)   ,MAGEDT(50)
      COMMON/RNONIN/LTRAMP,LTRBAC,LTRBAR,LTRCAR,LTRCOM,
     1LTRDOL,LTRDOT,LTREFN,LTREXC,LTRFNC,LTRLES,
     2LTRMNS,LTRNDX,LTRNOW,LTRNUM,LTRPLS,LTRQUO,LTRRUL,
     3LTRSBX,LTRSEM,LTRSPA,LTRSUB,LTRSUP,LTRTAB,
     4LTRPUT,LTRTXT,LTRUND,LTR1ST,LTRMAG
      COMMON/RNOTEN/LTRABC(26)  ,LTRAPP(9)   ,LTRBGN(300) ,
     1 LTRCPT(8)   ,LTRCLS(10)  ,LTRCOD(70)  ,LTRDGT(10)  ,
     2 LTRFLG(18)  ,LTRFTN(200) ,LTRIND(5)   ,LTRLST(10,6),
     3 LTRMID(200) ,LTRONL(26)  ,LTRONU(26)  ,LTROPN(10)  ,
     4 LTRPAG(5)   ,LTRREF(4)   ,LTRSPL(200) ,LTRTWO(4)   ,
     5 LTRTYP(8)   ,LTRWRK(200) ,LWRABC(26)  ,LWRAPP(9)   ,
     6 LWRCHA(8)   ,LWRIND(5)   ,LWRONL(26)  ,LWRONU(26)  ,
     7 LWRTYP(8)   ,LTRTTL(450) ,LTRCHA(200) ,LTRFNR(200) ,
     8 LTRSHD(50)  ,LTRBIG(50)
C
      DIMENSION LTROUT(200),LTRHFL(2),LTRHRL(2),LTRUP (2),
     1LTRDWN(2)
C
C     MAXOUT = DIMENSION OF LTROUT ARRAY USED BY THIS ROUTINE
C              FOR CONSTRUCTION OF EACH LINE IN TURN.
C
      DATA MAXOUT/200/
C
C     LTRHFL = CHARACTER SEQUENCE WHICH ON DIABLO TERMINALS
C              MOVES CARRIAGE HALF WAY TO NEXT LINE ON PAGE.
C              USED FOR ALL SUBSCRIPTS AND MOST SUBSCRIPTS.
C              DIMENSIONED AT MAXHFL.
C     LTRHRL = CHARACTER SEQUENCE WHICH ON DIABLO TERMINALS
C              MOVES CARRIAGE HALF WAY BACK TO PREVIOUS LINE.
C              USED ONLY IF THE FIRST LINE ON PAGE BEARS
C              SUPERSCRIPTS.  DIMENSIONED AT MAXHRL.
C
      DATA LTRHFL/"155004020100,1HU/
      DATA LTRHRL/"155004020100,1HD/
      DATA MAXHFL,MAXHRL/2,2/
C
C     NON-FUNCTIONAL INSTRUCTIONS FOR USE IN TESTING ONLY
      DATA LTRUP /1H$,1HU/
      DATA LTRDWN/1H$,1HD/
      DATA MAXUP ,MAXDWN/2,2/
C
      IF(KTRMNL.EQ.0)GO TO 1
      GO TO(51,102,145),KTRMNL
C
C     *****************************************************
C     *                                                   *
C     *  TEXT IS TO BE FORMATTED FOR DEVICE WHICH CANNOT  *
C     *  PERFORM HALF-LINE FEED.                          *
C     *  PAGES WILL BE NORMAL SIZE.                       *
C     *  SUPERSCRIPT OR SUBSCRIPT WILL BE SIMULATED BY    *
C     *  DOUBLE SPACING, REDUCING OTHER TEXT WHICH CAN    *
C     *  APPEAR ON PAGE.                                  *
C     *  KTRMNL = 1 SHOULD BE USED INSTEAD IF AN OUTPUT   *
C     *  DEVICE WHICH CANNOT HALF-LINE SPACE IS BEING     *
C     *  USED TO OBTAIN DRAFT OF DOCUMENT WHICH WILL      *
C     *  ULTIMATELY BE PRINTED ON LETTER QUALITY PRINTER  *
C     *                                                   *
C     *****************************************************
C
    1 GO TO(3,2,2,5,5,12),KNDOUT
C
C     OUTPUT LINE OF FIGURE
    2 LNGWRK=0
      GO TO 5
C
C     COPY LINE OF TEXT INTO LTRWRK
    3 LNGWRK=0
      IF(LNGMID.LE.0)GO TO 5
      DO 4 I=1,LNGMID
      IF(LNGWRK.GE.LMTWRK)GO TO 5
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRMID(I)
      MSKWRK(LNGWRK)=MSKMID(I)
    4 CONTINUE
C
C     IHALF = 0, NOTHING SPECIAL DONE
C           = 1, LAST LINE WAS EMPTY LINE
C           = -1, LAST LINE WAS SUBSCRIPT
C
C
C     DETERMINE WHETHER LINE CONTAINS LETTER MODIFICATIONS
C     TYPE 2 = UNDERLINE
C     TYPE 4 = SUPERSCRIPT
C     TYPE 5 = SUBSCRIPT
    5 KNTSUP=0
      KNTSUB=0
      KNTUND=0
      IF(LNGWRK.LE.0)GO TO 9
      DO 8 I=1,LNGWRK
      MSKBIT=MSKWRK(I)
      IF(MSKBIT.EQ.0)GO TO 8
      IF(KNTUND.NE.0)GO TO 6
      CALL RNOUNP(2,MSKBIT)
      IF(MSKBIT.NE.0)KNTUND=I
    6 IF(KNTSUP.NE.0)GO TO 7
      MSKBIT=MSKWRK(I)
      CALL RNOUNP(4,MSKBIT)
      IF(MSKBIT.NE.0)KNTSUP=I
    7 IF(KNTSUB.NE.0)GO TO 8
      MSKBIT=MSKWRK(I)
      CALL RNOUNP(5,MSKBIT)
      IF(MSKBIT.NE.0)KNTSUB=I
    8 CONTINUE
    9 CONTINUE
      IF(KNTSUP.NE.0)GO TO 10
      IF(IFHALF.GT.0)GO TO 13
      GO TO 19
   10 IF(IFHALF.GT.0)GO TO 11
      LOCPAG=LOCPAG+1
      GO TO 19
   11 IF(INIPAG.NE.0)GO TO 13
      INIPAG=MTYSTR(1)
      IFHALF=0
      GO TO 19
C
C     DETERMINE IF RESERVED LINE WAITING
   12 IF(IFHALF.GT.0)GO TO 13
      IFHALF=0
      GO TO 50
C
C     GENERATE PREVIOUS BLANK LINE IF NO SUPERSCRIPTS NOW
   13 MOVLIN=MTYSTR(1)
      KNTOUT=0
      KNTPRT=0
      J=MTYSTR(2)
      IF(J.LE.0)GO TO 16
      DO 14 I=1,J
      IF(KNTOUT.GE.MAXOUT)GO TO 15
      KNTOUT=KNTOUT+1
      LTROUT(KNTOUT)=LTRSPA
   14 CONTINUE
   15 J=MTYSTR(3)
      IF(J.LE.0)GO TO 16
      IF(MTYSTR(4).EQ.3)GO TO 16
      IF(MTYSTR(4).EQ.4)GO TO 16
      IF(J.GT.KNTOUT)GO TO 16
      LTROUT(J)=LTRBAR
      KNTPRT=J
   16 CONTINUE
      IF(KRANGE.LE.0)GO TO 18
      IF(KNTPRT.GT.0)GO TO 17
      IF(MOVLIN.LT.0)WRITE(JDISK,36)
      IF(MOVLIN.EQ.0)WRITE(JDISK,37)LTR1ST
      IF(MOVLIN.GT.0)WRITE(JDISK,38)
      GO TO 18
   17 IF(MOVLIN.LT.0)WRITE(JDISK,36)(LTROUT(I),I=1,KNTPRT)
      IF(MOVLIN.EQ.0)WRITE(JDISK,37)LTR1ST,(LTROUT(I),I=1,KNTPRT)
      IF(MOVLIN.GT.0)WRITE(JDISK,38)(LTROUT(I),I=1,KNTPRT)
   18 IFHALF=0
      IF(KNDOUT.EQ.6)GO TO 50
C
C     STORE NEW BLANK LINE
   19 IF(IFHALF.EQ.0)GO TO 20
      IF(LNGWRK.GT.0)GO TO 22
      IF(INIPAG.NE.0)GO TO 21
      IF(IFHALF.GE.0)LOCPAG=LOCPAG+1
      IFHALF=0
      GO TO 50
   20 IF(LNGWRK.GT.0)GO TO 22
   21 LOCPAG=LOCPAG+1
      MTYSTR(1)=INIPAG
      MTYSTR(2)=IOFFST
      MTYSTR(3)=INIBAR
      MTYSTR(4)=KNDOUT
      IFHALF=1
      INIPAG=0
      GO TO 50
   22 IFHALF=0
C
C     GENERATE SUPERSCRIPT CHARACTERS
      IF(KNTSUP.EQ.0)GO TO 23
      NORMAL=1
      GO TO 25
C
C     GENERATE NORMAL CHARACTERS
   23 NORMAL=0
      LOCPAG=LOCPAG+1
      GO TO 25
C
C     GENERATE SUBSCRIPT CHARACTERS
   24 IF(KNTSUB.EQ.0)GO TO 50
      LOCPAG=LOCPAG+1
      IFHALF=-1
      NORMAL=-1
C
C     OUTPUT PRINTING CHARACTERS ON LINE
   25 MOVLIN=INIPAG
      INIPAG=0
      KNTOUT=0
      KNTPRT=0
      IF(IOFFST.LE.0)GO TO 28
      DO 26 I=1,IOFFST
      IF(KNTOUT.GE.MAXOUT)GO TO 27
      KNTOUT=KNTOUT+1
      LTROUT(KNTOUT)=LTRSPA
   26 CONTINUE
   27 IF(INIBAR.LE.0)GO TO 28
      IF(KNDOUT.EQ.3)GO TO 28
      IF(KNDOUT.EQ.4)GO TO 28
      IF(INIBAR.GT.KNTOUT)GO TO 28
      LTROUT(INIBAR)=LTRBAR
      KNTPRT=INIBAR
   28 IF(LNGWRK.LE.0)GO TO 34
      DO 33 I=1,LNGWRK
      IF(KNTOUT.GE.MAXOUT)GO TO 34
      KNTOUT=KNTOUT+1
      MSKBIT=MSKWRK(I)
      IF(NORMAL.EQ.0)GO TO 29
      IF(NORMAL.GT.0)GO TO 30
      CALL RNOUNP(5,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 31
      GO TO 32
   29 IF(MSKBIT.EQ.0)GO TO 31
      CALL RNOUNP(4,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 32
      MSKBIT=MSKWRK(I)
      CALL RNOUNP(5,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 32
      GO TO 31
   30 CALL RNOUNP(4,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 31
      GO TO 32
   31 LTROUT(KNTOUT)=LTRWRK(I)
      IF(LTROUT(KNTOUT).NE.LTRSPA)KNTPRT=KNTOUT
      GO TO 33
   32 LTROUT(KNTOUT)=LTRSPA
   33 CONTINUE
   34 IF(KRANGE.LE.0)GO TO 49
      IF(KNTPRT.GT.0)GO TO 35
      IF(MOVLIN.LT.0)WRITE(JDISK,36)
      IF(MOVLIN.EQ.0)WRITE(JDISK,37)LTR1ST
      IF(MOVLIN.GT.0)WRITE(JDISK,38)
      GO TO 39
   35 IF(MOVLIN.LT.0)WRITE(JDISK,36)(LTROUT(I),I=1,KNTPRT)
      IF(MOVLIN.EQ.0)WRITE(JDISK,37)LTR1ST,(LTROUT(I),I=1,KNTPRT)
      IF(MOVLIN.GT.0)WRITE(JDISK,38)(LTROUT(I),I=1,KNTPRT)
   36 FORMAT(1H+,300A1)
   37 FORMAT(1A1,300A1)
   38 FORMAT(1H1,300A1)
C
C     OUTPUT UNDERLINE CHARACTERS
   39 IF(KNTUND.EQ.0)GO TO 49
      IF(LNGWRK.EQ.0)GO TO 49
      KNTOUT=0
      KNTPRT=0
      IF(IOFFST.EQ.0)GO TO 41
      DO 40 I=1,IOFFST
      IF(KNTOUT.GE.MAXOUT)GO TO 47
      KNTOUT=KNTOUT+1
      LTROUT(KNTOUT)=LTRSPA
   40 CONTINUE
   41 DO 46 I=1,LNGWRK
      IF(KNTOUT.GE.MAXOUT)GO TO 47
      KNTOUT=KNTOUT+1
      MSKBIT=MSKWRK(I)
      IF(MSKBIT.EQ.0)GO TO 45
      CALL RNOUNP(2,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 45
      MSKBIT=MSKWRK(I)
      IF(NORMAL.EQ.0)GO TO 42
      IF(NORMAL.GT.0)GO TO 43
      CALL RNOUNP(5,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 44
      GO TO 45
   42 CALL RNOUNP(4,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 45
      MSKBIT=MSKWRK(I)
      CALL RNOUNP(5,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 45
      GO TO 44
   43 CALL RNOUNP(4,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 44
      GO TO 45
   44 LTROUT(KNTOUT)=LTRRUL
      KNTPRT=KNTOUT
      GO TO 46
   45 LTROUT(KNTOUT)=LTRSPA
   46 CONTINUE
   47 IF(KNTPRT.LE.0)GO TO 49
      WRITE(JDISK,48)(LTROUT(I),I=1,KNTPRT)
   48 FORMAT(1H+,300A1)
   49 CONTINUE
C
C     GET NEXT HALF LINE OF CURRENT LINE
      IF(NORMAL.GT.0)GO TO 23
      IF(NORMAL.EQ.0)GO TO 24
C
C     RETURN TO CALLING PROGRAM
   50 GO TO 185
C
C     *****************************************************
C     *                                                   *
C     *  PRODUCE DRAFT WITHOUT HALF-LINE SPACING OF TEXT  *
C     *  LATER TO BE PRINTED ON LETTER QUALITY PRINTER.   *
C     *  PAGES WILL BE LONGER BUT HAVE SAME CONTENTS AS   *
C     *  IF HALF-LINE SPACING WERE AVAILABLE              *
C     *                                                   *
C     *****************************************************
C
   51 IF(KNDOUT.EQ.6)GO TO 60
      IF(KRANGE.LE.0)GO TO 100
      GO TO(53,52,52,55,55),KNDOUT
C
C     OUTPUT LINE OF FIGURE
   52 LNGWRK=0
      GO TO 55
C
C     COPY LINE OF TEXT INTO LTRWRK
   53 LNGWRK=0
      IF(LNGMID.LE.0)GO TO 55
      DO 54 I=1,LNGMID
      IF(LNGWRK.GE.LMTWRK)GO TO 55
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRMID(I)
      MSKWRK(LNGWRK)=MSKMID(I)
   54 CONTINUE
C
C     IHALF = 0, NOTHING SPECIAL DONE
C           = 1, LAST LINE WAS EMPTY LINE
C           = -1, LAST LINE WAS SUBSCRIPT
C
C
C     DETERMINE WHETHER LINE CONTAINS LETTER MODIFICATIONS
C     TYPE 2 = UNDERLINE
C     TYPE 4 = SUPERSCRIPT
C     TYPE 5 = SUBSCRIPT
   55 KNTSUP=0
      KNTSUB=0
      KNTUND=0
      IF(LNGWRK.LE.0)GO TO 59
      DO 58 I=1,LNGWRK
      MSKBIT=MSKWRK(I)
      IF(MSKBIT.EQ.0)GO TO 58
      IF(KNTUND.NE.0)GO TO 56
      CALL RNOUNP(2,MSKBIT)
      IF(MSKBIT.NE.0)KNTUND=I
   56 IF(KNTSUP.NE.0)GO TO 57
      MSKBIT=MSKWRK(I)
      CALL RNOUNP(4,MSKBIT)
      IF(MSKBIT.NE.0)KNTSUP=I
   57 IF(KNTSUB.NE.0)GO TO 58
      MSKBIT=MSKWRK(I)
      CALL RNOUNP(5,MSKBIT)
      IF(MSKBIT.NE.0)KNTSUB=I
   58 CONTINUE
   59 CONTINUE
      GO TO 62
C
C     DETERMINE IF RESERVED LINE WAITING
   60 IF(KRANGE.LE.0)GO TO 61
      IF(IFHALF.GT.0)GO TO 63
   61 IFHALF=0
      GO TO 101
C
C     GENERATE PREVIOUS BLANK LINE IF NO SUPERSCRIPTS NOW
   62 IF(IFHALF.LE.0)GO TO 69
      IF(INIPAG.NE.0)GO TO 63
      IF(KNTSUP.NE.0)GO TO 68
   63 MOVLIN=MTYSTR(1)
      KNTOUT=0
      KNTPRT=0
      J=MTYSTR(2)
      IF(J.LE.0)GO TO 66
      DO 64 I=1,J
      IF(KNTOUT.GE.MAXOUT)GO TO 65
      KNTOUT=KNTOUT+1
      LTROUT(KNTOUT)=LTRSPA
   64 CONTINUE
   65 J=MTYSTR(3)
      IF(J.LE.0)GO TO 66
      IF(MTYSTR(4).EQ.3)GO TO 66
      IF(MTYSTR(4).EQ.4)GO TO 66
      IF(J.GT.KNTOUT)GO TO 66
      LTROUT(J)=LTRBAR
      KNTPRT=J
   66 CONTINUE
      IF(KNTPRT.GT.0)GO TO 67
      IF(MOVLIN.LT.0)WRITE(JDISK,86)
      IF(MOVLIN.EQ.0)WRITE(JDISK,87)LTR1ST
      IF(MOVLIN.GT.0)WRITE(JDISK,88)
      GO TO 68
   67 IF(MOVLIN.LT.0)WRITE(JDISK,86)(LTROUT(I),I=1,KNTPRT)
      IF(MOVLIN.EQ.0)WRITE(JDISK,87)LTR1ST,(LTROUT(I),I=1,KNTPRT)
      IF(MOVLIN.GT.0)WRITE(JDISK,88)(LTROUT(I),I=1,KNTPRT)
   68 IFHALF=0
      IF(KNDOUT.EQ.6)GO TO 101
C
C     STORE NEW BLANK LINE
   69 IF(IFHALF.EQ.0)GO TO 70
      IFHALF=0
      IF(LNGWRK.GT.0)GO TO 72
      IF(INIPAG.NE.0)GO TO 71
      GO TO 100
   70 IF(LNGWRK.GT.0)GO TO 72
   71 IFHALF=1
      MTYSTR(1)=INIPAG
      MTYSTR(2)=IOFFST
      MTYSTR(3)=INIBAR
      MTYSTR(4)=KNDOUT
      INIPAG=0
      GO TO 100
   72 IF(KNTSUB.NE.0)IFHALF=-1
C
C     GENERATE SUPERSCRIPT CHARACTERS
      IF(KNTSUP.EQ.0)GO TO 73
      NORMAL=1
      GO TO 75
C
C     GENERATE NORMAL CHARACTERS
   73 NORMAL=0
      GO TO 75
C
C     GENERATE SUBSCRIPT CHARACTERS
   74 IF(KNTSUB.EQ.0)GO TO 100
      NORMAL=-1
C
C     OUTPUT PRINTING CHARACTERS ON LINE
   75 MOVLIN=INIPAG
      INIPAG=0
      KNTOUT=0
      KNTPRT=0
      IF(IOFFST.LE.0)GO TO 78
      DO 76 I=1,IOFFST
      IF(KNTOUT.GE.MAXOUT)GO TO 77
      KNTOUT=KNTOUT+1
      LTROUT(KNTOUT)=LTRSPA
   76 CONTINUE
   77 IF(INIBAR.LE.0)GO TO 78
      IF(KNDOUT.EQ.3)GO TO 78
      IF(KNDOUT.EQ.4)GO TO 78
      IF(INIBAR.GT.KNTOUT)GO TO 78
      LTROUT(INIBAR)=LTRBAR
      KNTPRT=INIBAR
   78 IF(LNGWRK.LE.0)GO TO 84
      DO 83 I=1,LNGWRK
      IF(KNTOUT.GE.MAXOUT)GO TO 84
      KNTOUT=KNTOUT+1
      MSKBIT=MSKWRK(I)
      IF(NORMAL.EQ.0)GO TO 79
      IF(NORMAL.GT.0)GO TO 80
      CALL RNOUNP(5,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 81
      GO TO 82
   79 IF(MSKBIT.EQ.0)GO TO 81
      CALL RNOUNP(4,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 82
      MSKBIT=MSKWRK(I)
      CALL RNOUNP(5,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 82
      GO TO 81
   80 CALL RNOUNP(4,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 81
      GO TO 82
   81 LTROUT(KNTOUT)=LTRWRK(I)
      IF(LTROUT(KNTOUT).NE.LTRSPA)KNTPRT=KNTOUT
      GO TO 83
   82 LTROUT(KNTOUT)=LTRSPA
   83 CONTINUE
   84 IF(KNTPRT.GT.0)GO TO 85
      IF(MOVLIN.LT.0)WRITE(JDISK,86)
      IF(MOVLIN.EQ.0)WRITE(JDISK,87)LTR1ST
      IF(MOVLIN.GT.0)WRITE(JDISK,88)
      GO TO 89
   85 IF(MOVLIN.LT.0)WRITE(JDISK,86)(LTROUT(I),I=1,KNTPRT)
      IF(MOVLIN.EQ.0)WRITE(JDISK,87)LTR1ST,(LTROUT(I),I=1,KNTPRT)
      IF(MOVLIN.GT.0)WRITE(JDISK,88)(LTROUT(I),I=1,KNTPRT)
   86 FORMAT(1H+,300A1)
   87 FORMAT(1A1,300A1)
   88 FORMAT(1H1,300A1)
C
C     OUTPUT UNDERLINE CHARACTERS
   89 IF(KNTUND.EQ.0)GO TO 99
      IF(LNGWRK.EQ.0)GO TO 99
      KNTOUT=0
      KNTPRT=0
      IF(IOFFST.EQ.0)GO TO 91
      DO 90 I=1,IOFFST
      IF(KNTOUT.GE.MAXOUT)GO TO 97
      KNTOUT=KNTOUT+1
      LTROUT(KNTOUT)=LTRSPA
   90 CONTINUE
   91 DO 96 I=1,LNGWRK
      IF(KNTOUT.GE.MAXOUT)GO TO 97
      KNTOUT=KNTOUT+1
      MSKBIT=MSKWRK(I)
      IF(MSKBIT.EQ.0)GO TO 95
      CALL RNOUNP(2,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 95
      MSKBIT=MSKWRK(I)
      IF(NORMAL.EQ.0)GO TO 92
      IF(NORMAL.GT.0)GO TO 93
      CALL RNOUNP(5,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 94
      GO TO 95
   92 CALL RNOUNP(4,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 95
      MSKBIT=MSKWRK(I)
      CALL RNOUNP(5,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 95
      GO TO 94
   93 CALL RNOUNP(4,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 94
      GO TO 95
   94 LTROUT(KNTOUT)=LTRRUL
      KNTPRT=KNTOUT
      GO TO 96
   95 LTROUT(KNTOUT)=LTRSPA
   96 CONTINUE
   97 IF(KNTPRT.LE.0)GO TO 99
      WRITE(JDISK,98)(LTROUT(I),I=1,KNTPRT)
   98 FORMAT(1H+,300A1)
   99 CONTINUE
C
C     GET NEXT HALF LINE OF CURRENT LINE
      IF(NORMAL.GT.0)GO TO 73
      IF(NORMAL.EQ.0)GO TO 74
C
C     LINE COMPLETED
  100 LOCPAG=LOCPAG+1
      GO TO 101
C
C     RETURN TO CALLING PROGRAM
  101 GO TO 185
C
C     *****************************************************
C     *                                                   *
C     *  DIABLO TERMINAL WITH UNI-DIRECTION FORM TRACTOR  *
C     *                                                   *
C     *  OUTPUT DEVICE CAN HALF-LINE SPACE TO LOWER       *
C     *  POSITION ON PAGE, BUT NOT TO HIGHER POSITION.    *
C     *                                                   *
C     *  EACH OUTPUT PAGE WILL START WITH 1 HALF LINE     *
C     *  TO ALLOW TITLES TO BEAR SUPERSCRIPTS.            *
C     *                                                   *
C     *****************************************************
C
  102 IF(KNDOUT.EQ.6)GO TO 144
      IF(KRANGE.LE.0)GO TO 143
      GO TO(104,103,103,106,106),KNDOUT
C
C     OUTPUT LINE OF FIGURE
  103 LNGWRK=0
      GO TO 106
C
C     COPY LINE OF TEXT INTO LTRWRK
  104 LNGWRK=0
      IF(LNGMID.LE.0)GO TO 106
      DO 105 I=1,LNGMID
      IF(LNGWRK.GE.LMTWRK)GO TO 106
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRMID(I)
      MSKWRK(LNGWRK)=MSKMID(I)
  105 CONTINUE
C
C     DETERMINE WHETHER LINE CONTAINS LETTER MODIFICATIONS
C     TYPE 2 = UNDERLINE
C     TYPE 4 = SUPERSCRIPT
C     TYPE 5 = SUBSCRIPT
  106 KNTSUP=0
      KNTSUB=0
      KNTUND=0
      IF(LNGWRK.LE.0)GO TO 110
      DO 109 I=1,LNGWRK
      MSKBIT=MSKWRK(I)
      IF(MSKBIT.EQ.0)GO TO 109
      IF(KNTUND.NE.0)GO TO 107
      CALL RNOUNP(2,MSKBIT)
      IF(MSKBIT.NE.0)KNTUND=I
  107 IF(KNTSUP.NE.0)GO TO 108
      MSKBIT=MSKWRK(I)
      CALL RNOUNP(4,MSKBIT)
      IF(MSKBIT.NE.0)KNTSUP=I
  108 IF(KNTSUB.NE.0)GO TO 109
      MSKBIT=MSKWRK(I)
      CALL RNOUNP(5,MSKBIT)
      IF(MSKBIT.NE.0)KNTSUB=I
  109 CONTINUE
  110 CONTINUE
C
C     GENERATE SUPERSCRIPT CHARACTERS
      IF(INIPAG.NE.0)GO TO 111
      IF(KNTSUP.EQ.0)GO TO 112
  111 NORMAL=1
      GO TO 114
C
C     GENERATE NORMAL CHARACTERS
  112 NORMAL=0
      GO TO 114
C
C     GENERATE SUBSCRIPT CHARACTERS
  113 IF(KNTSUB.EQ.0)GO TO 143
      NORMAL=-1
C
C     DETERMINE IF FULL OR HALF LINE FEED NEEDED
  114 MOVLIN=0
      IF(IFHALF.NE.NORMAL)MOVLIN=-1
      IF(INIPAG.NE.0)MOVLIN=INIPAG
      MOVWRK=0
      IF(INIPAG.NE.0)GO TO 118
      IF(IFHALF.EQ.-NORMAL)GO TO 118
C
C     INSERT HALF FORWARD LINE CONTROL CHARACTERS
      IF(IDEBUG.NE.0)GO TO 116
      DO 115 I=1,MAXHFL
      MOVWRK=MOVWRK+1
      LTROUT(MOVWRK)=LTRHFL(I)
  115 CONTINUE
      GO TO 118
C
C     INSERT DUMMY HALF LINE FEED IF TESTING
  116 DO 117 I=1,MAXUP
      MOVWRK=MOVWRK+1
      LTROUT(MOVWRK)=LTRUP(I)
  117 CONTINUE
C
C     OUTPUT PRINTING CHARACTERS ON LINE
  118 INIPAG=0
      KNTOUT=MOVWRK
      KNTPRT=MOVWRK
      IF(IOFFST.LE.0)GO TO 121
      DO 119 I=1,IOFFST
      IF(KNTOUT.GE.MAXOUT)GO TO 120
      KNTOUT=KNTOUT+1
      LTROUT(KNTOUT)=LTRSPA
  119 CONTINUE
  120 IF(INIBAR.LE.0)GO TO 121
      IF(KNDOUT.EQ.3)GO TO 121
      IF(KNDOUT.EQ.4)GO TO 121
      IF(INIBAR.GT.KNTOUT)GO TO 121
      LTROUT(INIBAR)=LTRBAR
      KNTPRT=INIBAR
  121 IF(LNGWRK.LE.0)GO TO 127
      DO 126 I=1,LNGWRK
      IF(KNTOUT.GE.MAXOUT)GO TO 127
      KNTOUT=KNTOUT+1
      MSKBIT=MSKWRK(I)
      IF(NORMAL.EQ.0)GO TO 122
      IF(NORMAL.GT.0)GO TO 123
      CALL RNOUNP(5,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 124
      GO TO 125
  122 IF(MSKBIT.EQ.0)GO TO 124
      CALL RNOUNP(4,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 125
      MSKBIT=MSKWRK(I)
      CALL RNOUNP(5,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 125
      GO TO 124
  123 CALL RNOUNP(4,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 124
      GO TO 125
  124 LTROUT(KNTOUT)=LTRWRK(I)
      IF(LTROUT(KNTOUT).NE.LTRSPA)KNTPRT=KNTOUT
      GO TO 126
  125 LTROUT(KNTOUT)=LTRSPA
  126 CONTINUE
  127 IF(KNTPRT.GT.0)GO TO 128
      IF(MOVLIN.LT.0)WRITE(JDISK,129)
      IF(MOVLIN.EQ.0)WRITE(JDISK,130)LTR1ST
      IF(MOVLIN.GT.0)WRITE(JDISK,131)
      GO TO 132
  128 IF(MOVLIN.LT.0)WRITE(JDISK,129)(LTROUT(I),I=1,KNTPRT)
      IF(MOVLIN.EQ.0)WRITE(JDISK,130)LTR1ST,(LTROUT(I),I=1,KNTPRT)
      IF(MOVLIN.GT.0)WRITE(JDISK,131)(LTROUT(I),I=1,KNTPRT)
  129 FORMAT(1H+,300A1)
  130 FORMAT(1A1,300A1)
  131 FORMAT(1H1,300A1)
C
C     OUTPUT UNDERLINE CHARACTERS
  132 IF(KNTUND.EQ.0)GO TO 142
      IF(LNGWRK.EQ.0)GO TO 142
      KNTOUT=0
      KNTPRT=0
      IF(IOFFST.EQ.0)GO TO 134
      DO 133 I=1,IOFFST
      IF(KNTOUT.GE.MAXOUT)GO TO 140
      KNTOUT=KNTOUT+1
      LTROUT(KNTOUT)=LTRSPA
  133 CONTINUE
  134 DO 139 I=1,LNGWRK
      IF(KNTOUT.GE.MAXOUT)GO TO 140
      KNTOUT=KNTOUT+1
      MSKBIT=MSKWRK(I)
      IF(MSKBIT.EQ.0)GO TO 138
      CALL RNOUNP(2,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 138
      MSKBIT=MSKWRK(I)
      IF(NORMAL.EQ.0)GO TO 135
      IF(NORMAL.GT.0)GO TO 136
      CALL RNOUNP(5,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 137
      GO TO 138
  135 CALL RNOUNP(4,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 138
      MSKBIT=MSKWRK(I)
      CALL RNOUNP(5,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 138
      GO TO 137
  136 CALL RNOUNP(4,MSKBIT)
      IF(MSKBIT.NE.0)GO TO 137
      GO TO 138
  137 LTROUT(KNTOUT)=LTRRUL
      KNTPRT=KNTOUT
      GO TO 139
  138 LTROUT(KNTOUT)=LTRSPA
  139 CONTINUE
  140 IF(KNTPRT.LE.0)GO TO 142
      WRITE(JDISK,141)(LTROUT(I),I=1,KNTPRT)
  141 FORMAT(1H+,300A1)
  142 CONTINUE
C
C     GET NEXT HALF LINE OF CURRENT LINE
      IFHALF=NORMAL
      IF(NORMAL.GT.0)GO TO 112
      IF(NORMAL.EQ.0)GO TO 113
C
C     LINE COMPLETED
  143 LOCPAG=LOCPAG+1
      GO TO 144
C
C     RETURN TO CALLING PROGRAM
  144 GO TO 185
C
C     *****************************************************
C     *                                                   *
C     *  DIABLO TERMINAL WITH BI-DIRECTIONAL FORM TRACTOR *
C     *                                                   *
C     *  OUTPUT DEVICE CAN HALF-LINE SPACE TO POSITIONS   *
C     *  EITHER LOWER OR HIGHER ON PAGE.                  *
C     *                                                   *
C     *****************************************************
C
  145 IF(KNDOUT.EQ.6)GO TO 185
      IF(KRANGE.LE.0)GO TO 184
      GO TO(147,146,146,149,149),KNDOUT
C
C     OUTPUT LINE OF FIGURE
  146 LNGWRK=0
      GO TO 149
C
C     COPY LINE OF TEXT INTO LTRWRK
  147 LNGWRK=0
      IF(LNGMID.LE.0)GO TO 149
      DO 148 I=1,LNGMID
      IF(LNGWRK.GE.LMTWRK)GO TO 149
      LNGWRK=LNGWRK+1
      LTRWRK(LNGWRK)=LTRMID(I)
      MSKWRK(LNGWRK)=MSKMID(I)
  148 CONTINUE
C
C     PREPARE TO OUTPUT PRINTING CHARACTERS ON LINE
  149 MOVLIN=INIPAG
      INIPAG=0
      DO 183 IPASS=1,2
      KNTOUT=0
      KNTPRT=0
C
C     APPLY OFFSET, IF ANY
      IF(IOFFST.LE.0)GO TO 152
      DO 150 I=1,IOFFST
      IF(KNTOUT.GE.MAXOUT)GO TO 151
      KNTOUT=KNTOUT+1
      LTROUT(KNTOUT)=LTRSPA
  150 CONTINUE
  151 IF(IPASS.EQ.2)GO TO 152
      IF(INIBAR.LE.0)GO TO 152
      IF(KNDOUT.EQ.3)GO TO 152
      IF(KNDOUT.EQ.4)GO TO 152
      IF(INIBAR.GT.KNTOUT)GO TO 152
      LTROUT(INIBAR)=LTRBAR
      KNTPRT=INIBAR
  152 INDEX=1
      NOWHIH=0
C
C     GET NEXT CHARACTER TO BE REPRESENTED
  153 NEWHIH=0
      IF(INDEX.LE.LNGWRK)GO TO 154
      IF(NOWHIH.NE.0)GO TO 161
      GO TO 177
C
C     IF OFF LINE, CHECK IF CAN RETURN TO LINE
  154 IF(NOWHIH.EQ.0)GO TO 158
      IF(NOWHIH.GT.0)GO TO 156
      IF(IDEBUG.NE.0)GO TO 155
      IF((KNTOUT+MAXHRL).GE.MAXOUT)GO TO 161
      GO TO 158
  155 IF((KNTOUT+MAXDWN).GE.MAXOUT)GO TO 161
      GO TO 158
  156 IF(IDEBUG.NE.0)GO TO 157
      IF((KNTOUT+MAXHFL).GE.MAXOUT)GO TO 161
      GO TO 158
  157 IF((KNTOUT+MAXUP).GE.MAXOUT)GO TO 161
      GO TO 158
C
C    CHECK IF SUB OR SUPERSCRIPT STATE CHANGES
  158 IF(IPASS.EQ.2)GO TO 159
      IF(LTRWRK(INDEX).EQ.LTRSPA)GO TO 174
      GO TO 160
  159 MSKBIT=MSKWRK(INDEX)
      IF(MSKBIT.EQ.0)GO TO 176
      CALL RNOUNP(2,MSKBIT)
      IF(MSKBIT.EQ.0)GO TO 176
  160 MSKBIT=MSKWRK(INDEX)
      IF(MSKBIT.EQ.0)GO TO 161
      CALL RNOUNP(4,MSKBIT)
      IF(MSKBIT.NE.0)NEWHIH=1
      MSKBIT=MSKWRK(INDEX)
      CALL RNOUNP(5,MSKBIT)
      IF(MSKBIT.NE.0)NEWHIH=-1
  161 IF(NOWHIH.EQ.NEWHIH)GO TO 174
C
C     IF ON LINE, CHECK IF CAN RETURN TO LINE
      IF(NOWHIH.NE.0)GO TO 163
      IF(IDEBUG.NE.0)GO TO 162
      IF((KNTOUT+MAXHRL+MAXHFL).GE.MAXOUT)GO TO 177
      GO TO 163
  162 IF((KNTOUT+MAXDWN+MAXUP).GE.MAXOUT)GO TO 177
  163 IF(NOWHIH.GT.NEWHIH)GO TO 168
C
C     FROM SUBSCRIPT TO LINE OR FROM LINE TO SUPERSCRIPT
      IF(IDEBUG.NE.0)GO TO 165
      IF((KNTOUT+MAXHRL).GT.MAXOUT)GO TO 177
      DO 164 J=1,MAXHRL
      KNTOUT=KNTOUT+1
      LTROUT(KNTOUT)=LTRHRL(J)
  164 CONTINUE
      GO TO 167
  165 IF((KNTOUT+MAXDWN).GT.MAXOUT)GO TO 177
      DO 166 J=1,MAXDWN
      KNTOUT=KNTOUT+1
      LTROUT(KNTOUT)=LTRDWN(J)
  166 CONTINUE
  167 NOWHIH=NOWHIH+1
      GO TO 173
C
C     FROM SUPERSCRIPT TO LINE OR FROM LINE TO SUBSCRIPT
  168 IF(IDEBUG.NE.0)GO TO 170
      IF((KNTOUT+MAXHFL).GT.MAXOUT)GO TO 177
      DO 169 J=1,MAXHFL
      KNTOUT=KNTOUT+1
      LTROUT(KNTOUT)=LTRHFL(J)
  169 CONTINUE
      GO TO 172
  170 IF((KNTOUT+MAXUP).GT.MAXOUT)GO TO 177
      DO 171 J=1,MAXUP
      KNTOUT=KNTOUT+1
      LTROUT(KNTOUT)=LTRUP(J)
  171 CONTINUE
  172 NOWHIH=NOWHIH-1
  173 KNTPRT=KNTOUT
      IF(INDEX.LE.LNGWRK)GO TO 161
      GO TO 177
C
C     INSERT THE CHARACTER ITSELF
  174 IF(KNTOUT.GE.MAXOUT)GO TO 177
      KNTOUT=KNTOUT+1
      IF(IPASS.EQ.2)GO TO 175
      LTROUT(KNTOUT)=LTRWRK(INDEX)
      IF(LTROUT(KNTOUT).NE.LTRSPA)KNTPRT=KNTOUT
      INDEX=INDEX+1
      GO TO 153
  175 LTROUT(KNTOUT)=LTRRUL
      KNTPRT=KNTOUT
      INDEX=INDEX+1
      GO TO 153
  176 IF(KNTOUT.GE.MAXOUT)GO TO 177
      KNTOUT=KNTOUT+1
      LTROUT(KNTOUT)=LTRSPA
      INDEX=INDEX+1
      GO TO 153
C
C     OUTPUT THE PRINTING CHARACTERS ON THE LINE
  177 IF(IPASS.EQ.2)GO TO 182
      IF(KNTPRT.GT.0)GO TO 178
      IF(MOVLIN.LT.0)WRITE(JDISK,179)
      IF(MOVLIN.EQ.0)WRITE(JDISK,180)LTR1ST
      IF(MOVLIN.GT.0)WRITE(JDISK,181)
      GO TO 183
  178 IF(MOVLIN.LT.0)WRITE(JDISK,179)(LTROUT(I),I=1,KNTPRT)
      IF(MOVLIN.EQ.0)WRITE(JDISK,180)LTR1ST,(LTROUT(I),I=1,KNTPRT)
      IF(MOVLIN.GT.0)WRITE(JDISK,181)(LTROUT(I),I=1,KNTPRT)
  179 FORMAT(1H+,300A1)
  180 FORMAT(1A1,300A1)
  181 FORMAT(1H1,300A1)
      GO TO 183
  182 IF(KNTPRT.GT.0)WRITE(JDISK,179)(LTROUT(I),I=1,KNTPRT)
  183 CONTINUE
C
C     LINE COMPLETED
  184 LOCPAG=LOCPAG+1
      GO TO 185
C
C     RETURN TO CALLING PROGRAM
  185 RETURN
      END
      SUBROUTINE RNOLOW(LSTTTL,IGAPLO,KTRMNL,LNGBOT,ITTLLO,
     1ISUBLO)
C     RENBR(/CALCULATE TITLE AND SUBTITLE POSITIONS)
C
C     DONALD E. BARTH, YALE SCHOOL OF MANAGEMENT
C
      DIMENSION LSTTTL(80)
      LNGBOT=0
      ITTLLO=-1
      IF(LSTTTL(21).NE.0)ITTLLO=0
      IF(LSTTTL(26).NE.0)ITTLLO=0
      ISUBLO=-1
      IF(LSTTTL(31).NE.0)ISUBLO=0
      IF(LSTTTL(36).NE.0)ISUBLO=0
      IF(ITTLLO.GE.0)GO TO 1
      IF(ISUBLO.LT.0)GO TO 8
      IF(ISUBLO.LT.IGAPLO)ISUBLO=IGAPLO
      GO TO 2
    1 IF(ITTLLO.LT.IGAPLO)ITTLLO=IGAPLO
    2 LNGBOT=ITTLLO+ISUBLO+2
      IF(KTRMNL.NE.0)GO TO 8
C     ITTLLO = -1, NO TITLE AT BOTTOM OF PAGE
C            = 0 OR GREATER, NUMBER OF BLANK LINES ABOVE
C              TITLE AT BOTTOM OF PAGE.
C     ISUBLO = -1, NO SUBTITLE AT BOTTOM OF PAGE
C            = 0 OR GREATER, NUMBER OF BLANK LINES ABOVE
C              SUBTITLE, EITHER AFTER BOTTOM OF ORDINARY
C              TEXT OR AFTER TITLE IF THERE IS ONE.
      IF(LSTTTL(21).NE.0)GO TO 3
      IF(LSTTTL(26).NE.0)GO TO 3
      IF(LSTTTL(31).NE.0)GO TO 4
      IF(LSTTTL(36).NE.0)GO TO 4
      ITTLLO=-1
      ISUBLO=-1
      LNGBOT=0
      GO TO 8
    3 IF(LSTTTL(31).NE.0)GO TO 5
      IF(LSTTTL(36).NE.0)GO TO 5
C
C     TITLE ONLY
      ITTLLO=0
      IF(LSTTTL(21).EQ.2)ITTLLO=1
      IF(LSTTTL(21).EQ.3)ITTLLO=1
      IF(LSTTTL(26).EQ.2)ITTLLO=1
      IF(LSTTTL(26).EQ.3)ITTLLO=1
      IF(ITTLLO.LT.IGAPLO)ITTLLO=IGAPLO
      ISUBLO=-1
      LNGBOT=ITTLLO+1
      I=0
      IF(LSTTTL(21).EQ.3)I=1
      IF(LSTTTL(21).EQ.4)I=1
      IF(LSTTTL(26).EQ.3)I=1
      IF(LSTTTL(26).EQ.4)I=1
      LNGBOT=LNGBOT+I
      GO TO 8
C
C     SUBTITLE ONLY
    4 ITTLLO=-1
      ISUBLO=0
      IF(LSTTTL(31).EQ.2)ISUBLO=1
      IF(LSTTTL(31).EQ.3)ISUBLO=1
      IF(LSTTTL(36).EQ.2)ISUBLO=1
      IF(LSTTTL(36).EQ.3)ISUBLO=1
      IF(ISUBLO.LT.IGAPLO)ISUBLO=IGAPLO
      LNGBOT=ISUBLO+1
      I=0
      IF(LSTTTL(31).EQ.3)I=1
      IF(LSTTTL(31).EQ.4)I=1
      IF(LSTTTL(36).EQ.3)I=1
      IF(LSTTTL(36).EQ.4)I=1
      LNGBOT=LNGBOT+I
      GO TO 8
C
C     BOTH TITLE AND SUBTITLE
    5 ITTLLO=0
      IF(LSTTTL(21).EQ.2)ITTLLO=1
      IF(LSTTTL(21).EQ.3)ITTLLO=1
      IF(LSTTTL(26).EQ.2)ITTLLO=1
      IF(LSTTTL(26).EQ.3)ITTLLO=1
      IF(ITTLLO.LT.IGAPLO)ITTLLO=IGAPLO
      ISUBLO=0
      I=0
      IF(LSTTTL(21).EQ.0)GO TO 6
      IF(LSTTTL(31).EQ.0)GO TO 6
      IF(LSTTTL(21).EQ.3)I=1
      IF(LSTTTL(21).EQ.4)I=1
      IF(LSTTTL(31).EQ.2)I=I+1
      IF(LSTTTL(31).EQ.3)I=I+1
    6 ISUBLO=I
      I=0
      IF(LSTTTL(26).EQ.0)GO TO 7
      IF(LSTTTL(36).EQ.0)GO TO 7
      IF(LSTTTL(26).EQ.3)I=1
      IF(LSTTTL(26).EQ.4)I=1
      IF(LSTTTL(36).EQ.2)I=I+1
      IF(LSTTTL(36).EQ.3)I=I+1
    7 IF(ISUBLO.LT.I)ISUBLO=I
      LNGBOT=ITTLLO+ISUBLO+2
      I=0
      IF(LSTTTL(31).EQ.3)I=1
      IF(LSTTTL(31).EQ.4)I=1
      IF(LSTTTL(36).EQ.3)I=1
      IF(LSTTTL(36).EQ.4)I=1
      LNGBOT=LNGBOT+I
    8 RETURN
      END
      SUBROUTINE RNOHIH(LSTTTL,MRGTOP,KTRMNL,LNGTOP,ITTLHI,
     1ISUBHI,IGAPHI,MINTOP,IFLSUB,IFRSUB)
C     RENBR(/CALCULATE TITLE AND SUBTITLE POSITIONS)
C
C     DONALD E. BARTH, YALE SCHOOL OF MANAGEMENT
C
      DIMENSION LSTTTL(80)
      LNGTOP=0
      ITTLHI=-1
      IF(LSTTTL(1).NE.0)ITTLHI=0
      IF(LSTTTL(6).NE.0)ITTLHI=0
      ISUBHI=-1
      IF(LSTTTL(11).NE.0)ISUBHI=0
      IF(LSTTTL(16).NE.0)ISUBHI=0
      IF(IFLSUB.GT.0)ISUBHI=0
      IF(IFRSUB.GT.0)ISUBHI=0
      IF(ITTLHI.GE.0)GO TO 1
      IF(ISUBHI.LT.0)GO TO 8
      IF(ISUBHI.LT.MRGTOP)ISUBHI=MRGTOP
      GO TO 2
    1 IF(ITTLHI.LT.MRGTOP)ITTLHI=MRGTOP
    2 LNGTOP=ITTLHI+ISUBHI+IGAPHI+2
      IF(KTRMNL.NE.0)GO TO 8
C     ITTLHI = -1, NO TITLE AT BOTTOM OF PAGE
C            = 0 OR GREATER, NUMBER OF BLANK LINES ABOVE
C              TITLE AT BOTTOM OF PAGE.
C     ISUBHI = -1, NO SUBTITLE AT BOTTOM OF PAGE
C            = 0 OR GREATER, NUMBER OF BLANK LINES ABOVE
C              SUBTITLE, EITHER AFTER BOTTOM OF ORDINARY
C              TEXT OR AFTER TITLE IF THERE IS ONE.
      IF(LSTTTL(1).NE.0)GO TO 3
      IF(LSTTTL(6).NE.0)GO TO 3
      IF(LSTTTL(11).NE.0)GO TO 4
      IF(LSTTTL(16).NE.0)GO TO 4
      IF(IFLSUB.GT.0)GO TO 4
      IF(IFRSUB.GT.0)GO TO 4
      ITTLHI=-1
      ISUBHI=-1
      LNGTOP=0
      GO TO 8
    3 IF(LSTTTL(11).NE.0)GO TO 5
      IF(LSTTTL(16).NE.0)GO TO 5
      IF(IFLSUB.GT.0)GO TO 5
      IF(IFRSUB.GT.0)GO TO 5
C
C     TITLE ONLY
      ITTLHI=0
      IF(LSTTTL(1).EQ.2)ITTLHI=1
      IF(LSTTTL(1).EQ.3)ITTLHI=1
      IF(LSTTTL(6).EQ.2)ITTLHI=1
      IF(LSTTTL(6).EQ.3)ITTLHI=1
      IF(ITTLHI.LT.MRGTOP)ITTLHI=MRGTOP
      ISUBHI=-1
      LNGTOP=ITTLHI+1
      I=0
      IF(LSTTTL(1).EQ.3)I=1
      IF(LSTTTL(1).EQ.4)I=1
      IF(LSTTTL(6).EQ.3)I=1
      IF(LSTTTL(6).EQ.4)I=1
      IF(I.LT.IGAPHI)I=IGAPHI
      LNGTOP=LNGTOP+I
      GO TO 8
C
C     SUBTITLE ONLY
    4 ITTLHI=-1
      ISUBHI=0
      IF(LSTTTL(11).EQ.2)ISUBHI=1
      IF(LSTTTL(11).EQ.3)ISUBHI=1
      IF(LSTTTL(16).EQ.2)ISUBHI=1
      IF(LSTTTL(16).EQ.3)ISUBHI=1
      IF(ISUBHI.LT.MRGTOP)ISUBHI=MRGTOP
      LNGTOP=ISUBHI+1
      I=0
      IF(LSTTTL(11).EQ.3)I=1
      IF(LSTTTL(11).EQ.4)I=1
      IF(LSTTTL(16).EQ.3)I=1
      IF(LSTTTL(16).EQ.4)I=1
      IF(I.LT.IGAPHI)I=IGAPHI
      LNGTOP=LNGTOP+I
      GO TO 8
C
C     BOTH TITLE AND SUBTITLE
    5 ITTLHI=0
      IF(LSTTTL(1).EQ.2)ITTLHI=1
      IF(LSTTTL(1).EQ.3)ITTLHI=1
      IF(LSTTTL(6).EQ.2)ITTLHI=1
      IF(LSTTTL(6).EQ.3)ITTLHI=1
      IF(ITTLHI.LT.MRGTOP)ITTLHI=MRGTOP
      ISUBHI=0
      I=0
      IF(LSTTTL(1).EQ.0)GO TO 6
      IF(LSTTTL(11).EQ.0)GO TO 6
      IF(LSTTTL(1).EQ.3)I=1
      IF(LSTTTL(1).EQ.4)I=1
      IF(LSTTTL(11).EQ.2)I=I+1
      IF(LSTTTL(11).EQ.3)I=I+1
    6 ISUBHI=I
      I=0
      IF(LSTTTL(6).EQ.0)GO TO 7
      IF(LSTTTL(16).EQ.0)GO TO 7
      IF(LSTTTL(6).EQ.3)I=1
      IF(LSTTTL(6).EQ.4)I=1
      IF(LSTTTL(16).EQ.2)I=I+1
      IF(LSTTTL(16).EQ.3)I=I+1
    7 IF(ISUBHI.LT.I)ISUBHI=I
      LNGTOP=ITTLHI+ISUBHI+2
      I=0
      IF(LSTTTL(11).EQ.3)I=1
      IF(LSTTTL(11).EQ.4)I=1
      IF(LSTTTL(16).EQ.3)I=1
      IF(LSTTTL(16).EQ.4)I=1
      IF(I.LT.IGAPHI)I=IGAPHI
      LNGTOP=LNGTOP+I
    8 IF(LNGTOP.LT.MINTOP)LNGTOP=MINTOP
      RETURN
      END