Google
 

Trailing-Edge - PDP-10 Archives - decus_20tap5_198111 - decus/20-0147/format.for
There are 6 other files named format.for in the archive. Click here to see a list.
      BLOCK DATA
C     RENBR(FORMAT/DECISION TREE FOR COMMAND RECOGNITION)
C
C     DONALD E. BARTH, HARVARD BUSINESS SCHOOL
C
C     THE DECISION TREE WHICH IS DEFINED BY THIS BLOCK DATA
C     ROUTINE IS USED BY THE FORMAT PROGRAM FOR RECOGNIZING
C     COMMANDS.   THIS  DECISION  TREE  WAS PRODUCED BY THE
C     KEYWRD PROGRAM WHICH WAS WRITTEN BY THE SAME AUTHOR.
C
      COMMON/FMTONE/I     ,IBYTE ,ICENTR,IDISK ,IFFILL,
     1IFFLAG,IFQUOT,IGROUP,IHEADR,IMACRO,IMINUS,INDENT,
     2INICLM,INIKPY,INILED,INILIN,INILNG,ININUM,INISPC,
     3INISPL,INITAL,INSERT,INTRVL,IOFFST,IPASS ,IREVRS,
     4ISKIP ,ISPACE,ISTART,ITRAIL,ITTY  ,IVALUE,IWIDTH,
     5J     ,JDISK ,JGROUP,JMINUS,JSKIP ,JSTIFY,JTTY  ,
     6JVALUE,K     ,KASALL,KASFLG,KASLCL,KDISK ,KMINUS,
     7KNTARG,KNTLIN,KNTPNT,KNTQOT,KNTSPC,KNTXTR,KOMAND,
     8KOMENT,KONVRT,KPYBGN,KPYKAS,KPYKLM,KPYKNT,KPYLNG,
     9KPYMID,KPYPRE,KPYPRT,KPYSPL,KPYUSD,KPYWID,KVALUE
      COMMON/FMTTWO/LEDING,LENGTH,LFTDGT,LFTOVR,LITERL,
     1LMTBGN,LMTEND,LMTKAS,LMTLNG,LMTMID,LMTPRE,LMTSPL,
     2LMTTEM,LNGBGN,LNGEND,LNGMID,LNGTEM,LOCABC,LOCATE,
     3LOCPNT,LOWBFR,MASTER,MAXBGN,MAXEND,MAXLIN,MAXLNG,
     4MAXPRE,MAXPRT,MAXSPL,MAXWRD,MOVBAC,MRGFAR,MRGLFT,
     5MRGRIT,MRKBAC,MRKBLA,MRKCAR,MRKDOL,MRKDOT,MRKEXC,
     6MRKLES,MRKLIN,MRKNUM,MRKSEM,MRKUND,NEEDED,NOWIND,
     7NOWLFT,NOWLIN,NOWLNG,NOWOFF,NOWRIT,NOWSKP,NOWSPL,
     8NXTBGN,NXTLST
      COMMON/FMTTHR/KMDARG(63)  ,KMDBRK(63)  ,LNGDEF(50)  ,
     1 MCHPNT(224) ,MSKBGN(300) ,MSKDEF(500) ,MSKMID(300) ,
     2 MSKPRE(80)  ,NOTPNT(224) ,MSKTEM(300)
      COMMON/FMTFOU/LTRBAC,LTRBLA,LTRCAR,LTRCOM,LTRDOL,
     1LTRDOT,LTREXC,LTRHHH,LTRLES,LTRMNS,LTRNOW,LTRNUM,
     2LTRPLS,LTRQUO,LTRRIG,LTRSEM,LTRSLA,LTRSPA,LTRTAB,
     3LTRUND,LTRXXX,LWRHHH,LTRNXT
      COMMON/FMTFIV/LTRABC(26)  ,LTRBGN(300) ,LTRDEF(500) ,
     1 LTRDGT(10)  ,LTREND(72)  ,LTRFLG(9)   ,LTRMID(300) ,
     2 LTRONL(26)  ,LTRONU(26)  ,LTRPRE(80)  ,LTRTWO(5)   ,
     3 LWRABC(26)  ,LWRONL(26)  ,LWRONU(26)  ,LTRTEM(300)
C
C     COMMAND 1 IS FOR ALL AMBIGUOUS ABBREVIATIONS OF WHICH
C     LEFT CHARACTERS HAVE BEEN DEFINED AS ANOTHER COMMAND
C     1 PR
C     2 B
C     2 BLANK
C     3 BREAK
C     4 CENTER
C     4 CENTRE
C     5 END OF FILE
C     6 F
C     6 FILL
C     7 FL
C     7 FLAGS ALL
C     8 FLAGS C
C     8 FLAGS CAPITALIZE
C     9 CARRIAGE
C     10 FLAGS CONTROL
C     11 FLAGS LOWER CASE
C     12 FLAGS QUOTE
C     13 FLAGS SPACE
C     14 FLAGS UPPER CASE
C     15 FORMAT
C     16 I
C     16 IN
C     16 INDENT
C     17 INPUT WIDTH
C     18 INSERT
C     19 JUSTIFY
C     20 LEFT MARGIN
C     21 LENGTH
C     22 LOWER CASE
C     23 NO F
C     23 NO FILL
C     24 NO FL
C     24 NO FLAGS ALL
C     25 NO FLAGS C
C     25 NO FLAGS CAPITALIZE
C     26 NO CARRIAGE
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 NO JUSTIFY
C     33 NO TRAILING
C     34 OFFSET
C     35 OUTPUT WIDTH
C     36 P
C     36 PARAGRAPH
C     37 PREFACE
C     38 PROGRAM
C     39 RESET
C     40 RIGHT MARGIN
C     41 S
C     41 SKIP
C     42 SPACING
C     43 TRAILING
C     44 UPPER CASE
C     45 US
C     45 USE
C     46 FLAGS INSERT
C     47 FLAGS REMARK
C     48 FLAGS FENCE
C     49 NO FLAGS INSERT
C     50 NO FLAGS REMARK
C     51 NO FLAGS FENCE
C     52 LEADING
C     53 NO LEADING
C     54 EJECT
C     55 USE H
C     56 COPY
C     57 MASK
C     58 NO PREFACE
C     59 NO MASK
C     60 NO COPY
C     61 NO INSERT
C     62 NO OFFSET
C     63 BEGIN
C
C     FINAL STORAGE USED= 224, MOST USED= 1910, LIMIT= 3000
C
C     CHECKSUMS 2001,5530,2831,8763,3925
C
C     COUNT     1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
C     COMMAND   2 63  2  2  2  3  3  3  0  9  4  4  4  4  4
C     LETTER   -B  E  L  A  N  R  E  A -C  A  E  N  T  E  R
C     SUCCESS   2194  4  5142  7  8142 10 73 12 13 14 15  0
C     FAILURE   9  3  6  0  0  0  0  0 18 11 17  0  0 16  0
C
C     COUNT    16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
C     COMMAND   4 56  0 54 54 54  5  5  5  5  5  5  5  6  6
C     LETTER    R  O -E  J  E  C  N  D -O  F -F  I  L -F  I
C     SUCCESS 223 79 19 20 21185 23 24 25 26 27 28223 30 87
C     FAILURE   0  0 29 22  0  0 24 24  0 26  0  0  0 50 31
C
C     COUNT    31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
C     COMMAND   7  0  0  0 15 15 15 15  7  8  8 10 48 46 11
C     LETTER    L  A  G  S  O  R  M  A -A -C  A  O -F -I -L
C     SUCCESS  32 33 34 39 36 37 38185 87 41 90 98104124108
C     FAILURE  35 39 39 39 39  0  0  0 40 43 42  0 44 45 46
C
C     COUNT    46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
C     COMMAND  12 47 13 14 16 16 16 16 16 17 18 17 19  0  0
C     LETTER   -Q -R -S -U -I  N  D  E  N  P  S -W -J -L  E
C     SUCCESS 111115120122 51 52 53 54185155126159129 60 61
C     FAILURE  47 48 49  0 58 57 55  0  0 56 57  0 59 68 65
C
C     COUNT    61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
C     COMMAND  52 20 21 21 22 22 20 57  0  0  0 26  0  0  0
C     LETTER    A  F  N  G  O -C -M -M -N  O -C  A  R  R  I
C     SUCCESS 138189 64161109221192140 70 71 72 73 74 75 76
C     FAILURE  62 63 67  0 66 67  0 69149 71 80 78  0  0  0
C
C     COUNT    76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
C     COMMAND   0  0 60  0 23 23 24  0  0  0 24  0 25 25  0
C     LETTER    A  G  O  P -F  I  L  A  G  S -A  L -C  A  P
C     SUCCESS  77223 79134 81 87 83 84 85 86 87102 89 90 91
C     FAILURE   0  0  0  0123 82 86 86 86 86 88  0103 97  0
C
C     COUNT    91 92 93 94 95 96 97 98 99100101102103104105
C     COMMAND   0  0  0  0  0  0 27  0  0  0  0  0 51  0  0
C     LETTER    I  T  A  L  I  Z  O  N  T  R  O  L -F  E  N
C     SUCCESS  92 93 94 95 96223 98 99100101102  0104105175
C     FAILURE   0  0  0  0  0  0  0  0  0  0  0  0106  0  0
C
C     COUNT   106107108109110111112113114115116117118119120
C     COMMAND  49 28  0  0 29  0  0  0 50  0  0  0  0 30  0
C     LETTER   -I -L  O  W -Q  U  O  T -R  E  M  A  R -S  P
C     SUCCESS 124108109215111112113223115116117118142120174
C     FAILURE 107110217217114  0  0  0119  0  0  0  0121  0
C
C     COUNT   121122123124125126127128129130131132133134135
C     COMMAND  31  0 61  0  0  0  0 32  0  0  0  0  0  0 53
C     LETTER   -U  P -I  N  S  E  R -J  U  S  T  I  F  Y -L
C     SUCCESS 122214124125126127185129130131132133134  0136
C     FAILURE   0217128  0  0  0  0135  0  0  0  0  0  0139
C
C     COUNT   136137138139140141142143144145146147148149150
C     COMMAND  53 53  0 59  0  0  0 62 62 58 58 58 33  0 34
C     LETTER    E  A  D -M  A  S  K -O  F -P  R  E -T -O  F
C     SUCCESS 137138209140141142  0144151146147173205150151
C     FAILURE   0  0  0143  0  0  0145  0148  0  0  0162152
C
C     COUNT   151152153154155156157158159160161162163164165
C     COMMAND   0 35 35 35  0  0  0 35  0  0  0 36 36 36 36
C     LETTER    F  U  T  P  U  T -W -W  I  D  T -P  A  R  A
C     SUCCESS 183153154155156157159159160161170163164165166
C     FAILURE   0158157157157157  0  0  0  0  0181171  0  0
C
C     COUNT   166167168169170171172173174175176177178179180
C     COMMAND  36 36 36 36  0  1 37  0  0  0 38 38 38 38 38
C     LETTER    G  R  A  P  H  R  E  F  A  C  O  G  R  A  M
C     SUCCESS 167168169170  0172173174175223177178179180  0
C     FAILURE   0  0  0  0  0  0176  0  0  0  0  0  0  0  0
C
C     COUNT   181182183184185186187188189190191192193194195
C     COMMAND   0 39  0  0  0 40 40 40  0  0 40  0  0  0  0
C     LETTER   -R  E  S  E  T  I  G  H  T -M -M  A  R  G  I
C     SUCCESS 182183184185  0187188189190192192193194195196
C     FAILURE 197186  0  0  0191190190190  0  0  0  0  0  0
C
C     COUNT   196197198199200201202203204205206207208209210
C     COMMAND   0 41 41 41 41 42 42 42 43  0  0  0  0  0  0
C     LETTER    N -S  K  I  P  P  A  C -T  R  A  I  L  I  N
C     SUCCESS   0198199200  0202203209205206207208209210211
C     FAILURE   0204201  0  0  0  0  0212  0  0  0  0  0  0
C
C     COUNT   211212213214215216217218219220221222223224
C     COMMAND   0  0 44  0  0  0  0 45 45 44  0  0  0 55
C     LETTER    G -U  P  P  E  R -C  S  E -C  A  S  E -H
C     SUCCESS   0213214215216217221219224221222223  0  0
C     FAILURE   0  0218217217217  0220224224  0  0  0  0
C
C     DIMENSION MCHPNT(224)
      DIMENSION MCHPN1(113),MCH114(111)
      EQUIVALENCE (MCHPN1(1),MCHPNT(1)),
     1(MCH114(1),MCHPNT(114))
C     DIMENSION NOTPNT(224)
      DIMENSION NOTPN1(98),NOTP99(97),NOT196(29)
      EQUIVALENCE (NOTPN1(1),NOTPNT(1)),
     1(NOTP99(1),NOTPNT(99)),(NOT196(1),NOTPNT(196))
      DATA KNTPNT,KNTXTR/  224,    0/
      DATA MCHPN1/452,14369,454,455,592,682,683,817,10,
     12098,912,913,914,915,900,1123,12679,19,12170,12171,
     212335,1148,1149,1150,1151,1152,1153,1348,1380,1437,
     31607,33,34,39,3411,3412,3413,3560,1662,1841,1890,
     42348,10904,10474,2583,2811,10690,3045,3272,3651,3652,
     53653,3654,3785,3980,4176,3984,4404,60,61,11838,4689,
     64789,4886,5059,5171,4692,12965,70,71,72,5923,74,75,
     776,77,223,13579,134,5256,5262,5483,84,85,86,5487,102,
     85714,5715,91,92,93,94,95,96,223,6173,99,100,101,102,
     90,11579,105,175,11149,6408,109,215,6636,112,113,223/
      DATA MCH114/11365,116,117,118,142,6870,174,7097,214,
     113849,125,126,127,185,7329,130,131,132,133,134,0,
     212061,12062,12063,209,13415,141,142,0,14094,14101,
     313196,13197,13223,7630,150,7801,183,8028,8029,8030,
     4156,157,159,8034,160,161,170,8263,8264,8265,8266,
     58267,8268,8269,8270,0,397,8498,174,175,223,8727,8728,
     68729,8730,8550,182,8958,184,185,0,9187,9188,9189,190,
     7192,9192,193,194,195,196,0,9423,9424,9425,9225,9652,
     89653,9659,9880,206,207,208,209,210,211,0,213,10114,
     9215,216,217,221,10344,10349,10121,222,223,0,12375/
      DATA NOTPN1/-459,1128,2706,225,3150,4050,1125,225,
     1-693,236,1142,3150,4500,1141,4050,4050,3375,-1154,
     22272,1125,675,3174,924,-3375,1376,-1350,2025,2700,
     3-1400,2056,2735,264,1614,4314,3414,4050,2925,225,
     4-265,-718,267,3375,-1394,-2070,-2746,-3872,-4098,
     5-4324,-4725,-2083,3207,955,1125,3150,3656,4332,-5175,
     6-2309,-2768,1190,287,1413,3217,1575,3441,-742,-2925,
     7-2994,-3299,3446,-755,303,4050,4050,2025,225,1575,
     83375,3600,-1473,2107,2786,311,1661,4361,-313,2700,
     9-778,322,3600,2025,4500,225,2700,2025,5850,3375,3150/
      DATA NOTP99/4500,4050,3375,2700,-1456,1125,3150,
     1-2132,-2810,3592,5392,-3939,4725,3375,4500,-4169,
     21125,2925,225,4050,-4396,3600,-4725,3817,-2153,3150,
     34275,1125,4050,-2385,4725,4275,4500,2025,1350,5625,
     4-2839,1125,225,900,-3068,225,4275,2475,-3520,1350,
     5-3748,4050,1125,-4500,-3537,1502,1350,4883,4657,3757,
     64882,4657,-5175,-5175,2025,900,4500,-3781,396,4050,
     7225,1575,4050,225,3600,1800,4050,1301,1350,225,675,
     83375,1575,4050,225,2925,-4247,1311,4275,1125,4500,
     92216,1765,1990,4690,-2925,-2925,225,4050,1575,2025/
      DATA NOT196/3150,-4479,2676,2025,3600,3600,225,675,
     1-4712,4050,225,2025,2700,2025,3150,1575,-4725,3818,
     23817,1342,4267,-675,4495,1349,-899,225,4275,1125,
     3-1800/
C
C     KMDARG = -2 OR LESS, CHARACTER OR TEXT STRING
C              ARGUMENT WHICH CANNOT EXTEND ACROSS NORMAL
C              END OF COMMAND.  VALUE IS 1 LESS THAN
C              NEGATIVE OF MAXIMUM NUMBER OF CHARACTERS IN
C              STRING
C              CHARACTERS
C            = -1, NO ARGUMENT ALLOWED
C              = 0, TEXT STRING ARGUMENT WHICH CAN EXTEND
C              ACROSS NORMAL END OF COMMAND CHARACTERS
C            = 1 OR GREATER, NUMBER OF NUMERIC ARGUMENTS
C
C     DATA       /   ,BLA,BRE,CEN,EOF,FIL,FAL,FCA,CAR,FCO,
C    1            FLC,FQU,FSP,FUC,FOR,IND,IWI,INS,JUS,LMA,
C    2            LEN,LCA,NFI,NFA,NFC,NCA,NFC,NFL,NFQ,NFS,
C    3            NFU,NJU,NTR,OFF,OWI,PAR,PRE,PRO,RES,RMA,
C    4            SKI,SPA,TRA,UCA,USE,FIN,FRE,FFE,NFI,NFR,
C    5            NFF,LEA,NLE,EJE,USH,COP,MAS,NPR,NMA,NCO,
C                 NIN,NOF,BEG/
      DATA KMDARG/  0,  1, -1,  1, -1, -1, -1, -2, -3, -2,
     1             -2, -2, -2, -2,  2,  1,  1,  0, -1,  1,
     2              1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
     3             -1, -1, -1,  1,  1,  3,  0,  2, -1,  1,
     4              1,  1, -1, -1, -2, -2, -2, -2, -1, -1,
     5             -1, -1, -1, -1, -1,  2,  0, -1, -1, -1,
     6             -1, -1,  2/
C
C     KMDBRK = 0, APPLY COMMAND WITHOUT BREAKING TEXT.
C              NEXT TEXT WILL BE APPENDED TO CURRENT LINE
C            = 1, TERMINATE CURRENT LINE.  OUTPUT CURRENT
C              STATEMENT.  EXIT
C            = 2 THRU 4, TERMINATE CURRENT LINE.  OUTPUT
C              CURRENT STATEMENT.  FOLLOWING TEXT WILL BE
C              PLACED IN NEW FORMAT STATEMENT
C            = 1, END OF FILE COMMAND
C            = 2, RESTORE COMMAND
C            = 3, BEGIN COMMAND
C            = 4, FORMAT OR PROGRAM COMMAND
C            = 5, TERMINATE CURRENT LINE.  FOLLOWING TEXT
C              WILL BE APPENDED TO CURRENT FORMAT STATEMENT
C              ALL BLANK LINES ARE FORCED INTO OUTPUT
C            = 6, TERMINATE CURRENT LINE.  FOLLOWING TEXT
C              WILL BE APPENDED TO CURRENT FORMAT STATEMENT
C              BLANK LINES ARE NOT FORCED INTO OUTPUT
C
C     DATA       /   ,BLA,BRE,CEN,EOF,FIL,FAL,FCA,CAR,FCO,
C    1            FLC,FQU,FSP,FUC,FOR,IND,IWI,INS,JUS,LMA,
C    2            LEN,LCA,NFI,NFA,NFC,NCA,NFC,NFL,NFQ,NFS,
C    3            NFU,NJU,NTR,OFF,OWI,PAR,PRE,PRO,RES,RMA,
C    4            SKI,SPA,TRA,UCA,USE,FIN,FRE,FFE,NFI,NFR,
C    5            NFF,LEA,NLE,EJE,USH,COP,MAS,NPR,NMA,NCO,
C                 NIN,NOF,BEG/
      DATA KMDBRK/  0,  6,  6,  6,  1,  6,  0,  0,  0,  0,
     1              0,  0,  0,  0,  4,  6,  0,  0,  6,  6,
     2              0,  0,  6,  0,  0,  0,  0,  0,  0,  0,
     3              0,  6,  0,  6,  0,  6,  0,  4,  2,  6,
     4              6,  6,  0,  0,  0,  0,  0,  0,  0,  0,
     5              0,  0,  0,  5,  0,  6,  0,  0,  0,  6,
     6              0,  6,  3/
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 ,1H	/
      DATA LTRCOM,LTRHHH,LTRRIG,LTRSLA,LTRXXX,LWRHHH/
     1     1H,   ,1HH   ,1H)   ,1H/   ,1HX   ,1Hh   /
      DATA LTRFLG/1H;,1H<,1H.,1H$,1H\,1H_,1H!,1H#,1H^/
C
C     2 SPACES ARE NEEDED TO RIGHT OF FOLLOWING IN FILL MODE.
C     THESE VARIABLES ARE NOT REFERENCED OTHERWISE.
      DATA LTRTWO/1H;,1H:,1H!,1H.,1H?/
C
C     ARRAY DIMENSIONS
      DATA LMTBGN,LMTMID,LMTEND,LMTPRE,LMTTEM/
     1300,300,72,80,300/
      DATA LMTSPL,LMTLNG/500,50/
C
C     DEFINE DEVICE UNIT NUMBERS
      DATA IDISK,JDISK,KDISK,ITTY,JTTY/1,20,21,5,5/
      END
C     RENBR(FORMAT/CONSTRUCTS FORTRAN FORMAT STATEMENTS)
C
C     DONALD E. BARTH, HARVARD BUSINESS SCHOOL
C
      COMMON/FMTONE/I     ,IBYTE ,ICENTR,IDISK ,IFFILL,
     1IFFLAG,IFQUOT,IGROUP,IHEADR,IMACRO,IMINUS,INDENT,
     2INICLM,INIKPY,INILED,INILIN,INILNG,ININUM,INISPC,
     3INISPL,INITAL,INSERT,INTRVL,IOFFST,IPASS ,IREVRS,
     4ISKIP ,ISPACE,ISTART,ITRAIL,ITTY  ,IVALUE,IWIDTH,
     5J     ,JDISK ,JGROUP,JMINUS,JSKIP ,JSTIFY,JTTY  ,
     6JVALUE,K     ,KASALL,KASFLG,KASLCL,KDISK ,KMINUS,
     7KNTARG,KNTLIN,KNTPNT,KNTQOT,KNTSPC,KNTXTR,KOMAND,
     8KOMENT,KONVRT,KPYBGN,KPYKAS,KPYKLM,KPYKNT,KPYLNG,
     9KPYMID,KPYPRE,KPYPRT,KPYSPL,KPYUSD,KPYWID,KVALUE
      COMMON/FMTTWO/LEDING,LENGTH,LFTDGT,LFTOVR,LITERL,
     1LMTBGN,LMTEND,LMTKAS,LMTLNG,LMTMID,LMTPRE,LMTSPL,
     2LMTTEM,LNGBGN,LNGEND,LNGMID,LNGTEM,LOCABC,LOCATE,
     3LOCPNT,LOWBFR,MASTER,MAXBGN,MAXEND,MAXLIN,MAXLNG,
     4MAXPRE,MAXPRT,MAXSPL,MAXWRD,MOVBAC,MRGFAR,MRGLFT,
     5MRGRIT,MRKBAC,MRKBLA,MRKCAR,MRKDOL,MRKDOT,MRKEXC,
     6MRKLES,MRKLIN,MRKNUM,MRKSEM,MRKUND,NEEDED,NOWIND,
     7NOWLFT,NOWLIN,NOWLNG,NOWOFF,NOWRIT,NOWSKP,NOWSPL,
     8NXTBGN,NXTLST
      COMMON/FMTTHR/KMDARG(63)  ,KMDBRK(63)  ,LNGDEF(50)  ,
     1 MCHPNT(224) ,MSKBGN(300) ,MSKDEF(500) ,MSKMID(300) ,
     2 MSKPRE(80)  ,NOTPNT(224) ,MSKTEM(300)
      COMMON/FMTFOU/LTRBAC,LTRBLA,LTRCAR,LTRCOM,LTRDOL,
     1LTRDOT,LTREXC,LTRHHH,LTRLES,LTRMNS,LTRNOW,LTRNUM,
     2LTRPLS,LTRQUO,LTRRIG,LTRSEM,LTRSLA,LTRSPA,LTRTAB,
     3LTRUND,LTRXXX,LWRHHH,LTRNXT
      COMMON/FMTFIV/LTRABC(26)  ,LTRBGN(300) ,LTRDEF(500) ,
     1 LTRDGT(10)  ,LTREND(72)  ,LTRFLG(9)   ,LTRMID(300) ,
     2 LTRONL(26)  ,LTRONU(26)  ,LTRPRE(80)  ,LTRTWO(5)   ,
     3 LWRABC(26)  ,LWRONL(26)  ,LWRONU(26)  ,LTRTEM(300)
C
      MASTER=0
C
C     ASK USER FOR FILE NAMES AND OPEN THESE FILES
C     MASTER = 0, FIRST TIME USER ASKED TO SPECIFY FILES
C            = 1, SECOND AND SUBSEQUENT TIME USER ASKED TO
C              SPECIFY FILES
    1 CALL FMTASK(MASTER,ITTY,JTTY,IDISK,JDISK,KDISK)
C     MASTER = -1, NOT FIRST TIME FMTASK CALLED, BUT USER
C              HAS SPECIFIED THAT ANOTHER FILE BE PROCESSED
C            = 0, FIRST TIME FMTASK WAS CALLED
C            = 1, MASTER WAS INPUT SET TO 1, AND NO
C              FILES WERE SPECIFIED BY USER.
      IF(MASTER.GT.0)GO TO 7
C
C     INITIALIZE OR RESET VARIABLES
C     MASTER = 0, INITIALIZE EVERYTHING INCLUDING SORTED
C              ALPHABETS
C            = -1, INITIALIZE EVERYTHING EXCEPT ALPHABETS
C              WHICH ARE NEVER CHANGED DURING EXECUTION.
C              DISCARD REST OF CURRENT INPUT LINE
C            = 2, INITIALIZE EVERYTHING EXCEPT ALPHABETS
C              WHICH ARE NEVER CHANGED DURING EXECUTION.
C              RETAIN THE REST OF CURRENT INPUT LINE
C            = 3, PREPARE FOR NEW SEQUENCE OF FORMAT
C              STATEMENTS
C            = 4, PREPARE FOR A NEW FORMAT STATEMENT IN
C              CURRENT SEQUENCE
    2 CALL FMTNEW
C
C     GET NEXT COMMAND OR NEXT LINE OF TEXT
C     MASTER = NE.7, GET NEXT COMMAND OR NEW LINE OF TEXT
C            = 7, GET REST OF TEXTUAL ARGUMENT OF COMMAND
    3 CALL FMTGET
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.1)GO TO 4
C
C     IDENTIFY DOT COMMAND AND EVALUATE ITS ARGUMENTS
C     MASTER = INPUT VALUE IS IGNORED
      CALL FMTHOW
C     MASTER = 0, APPLY COMMAND WITHOUT BREAKING TEXT.
C              NEXT TEXT WILL BE APPENDED TO CURRENT LINE
C            = 1, TERMINATE CURRENT LINE.  OUTPUT CURRENT
C              STATEMENT.  EXIT
C            = 2 3 OR 4, TERMINATE CURRENT LINE.  OUTPUT
C              CURRENT STATEMENT.  FOLLOWING TEXT WILL BE
C              PLACED IN NEW FORMAT STATEMENT
C            = 2, RESTORE COMMAND
C            = 3, BEGIN COMMAND
C            = 4, FORMAT OR PROGRAM COMMAND
C            = 5, TERMINATE CURRENT LINE.  FOLLOWING TEXT
C              WILL BE APPENDED TO CURRENT FORMAT STATEMENT
C            = 6, BREAK COMMAND FORCING BLANK LINES
C            = 7, NEED REST OF TEXTUAL ARGUMENT OF COMMAND
C            = 8, ILLEGAL COMMAND OR ILLEGAL ARGUMENT
      IF(MASTER.GE.7)GO TO 3
      IF(MASTER.EQ.0)GO TO 5
C
C     COPY LINE OF TEXT INTO FORMAT STATEMENT OUTPUT
C     MASTER = 0, LINE HAS FILLED, COMMAND WAS NOT ISSUED.
C              MOVE LINE INTO CURRENT FORMAT STATEMENT.
C              DO NOT CHANGE DIRECTION OF BLANK FILL.
C            = 1 THRU 4, MOVE LINE INTO CURRENT FORMAT
C              STATEMENT, DUMP CURRENT FORMAT STATEMENT,
C              AND SET DIRECTION OF BLANK FILL TO BE FROM
C              RIGHT
C            = 5, MOVE LINE INTO CURRENT FORMAT STATEMENT
C              AND SET DIRECTION OF BLANK FILL TO BE FROM
C              RIGHT.  FORCE OUT BLANK LINES
C            = 6, MOVE LINE INTO CURRENT FORMAT STATEMENT
C              AND SET DIRECTION OF BLANK FILL TO BE FROM
C              RIGHT.  DO NOT FORCE OUT BLANK LINES
    4 CALL FMTPUT
C     MASTER = RETURNED UNCHANGED
      IF(MASTER.EQ.0)GO TO 3
      IF(MASTER.EQ.1)GO TO 6
C
C     APPLY DOT COMMAND
C     MASTER = NOT USED, AND RETURNED UNCHANGED
    5 CALL FMTSET
C     MASTER = 0, COMMANDS WHICH DO NOT MOVE CURRENT LINE
C              TO FORMAT STATEMENT
C            = 1, END OF FILE COMMAND
C            = 2, RESTORE COMMAND
C            = 3, BEGIN COMMAND
C            = 4, FORMAT OR PROGRAM COMMAND
C            = 5 OR 6, COMMANDS WHICH CAUSE A LINE BREAK
C              BUT DO NOT DUMP CURRENT FORMAT STATEMENT
      IF(MASTER.EQ.0)GO TO 3
      IF(MASTER.GE.5)GO TO 3
      IF(MASTER.GT.1)GO TO 2
C
C     CLOSE OUTPUT FILES WHEN DONE
    6 CALL FMTEND(JDISK,KDISK)
      GO TO 1
    7 STOP
      END
      SUBROUTINE FMTNEW
C     RENBR(/RETURN CONDITIONS TO ORIGINAL SETTINGS)
C
C     DONALD E. BARTH, HARVARD BUSINESS SCHOOL
C
      COMMON/FMTONE/I     ,IBYTE ,ICENTR,IDISK ,IFFILL,
     1IFFLAG,IFQUOT,IGROUP,IHEADR,IMACRO,IMINUS,INDENT,
     2INICLM,INIKPY,INILED,INILIN,INILNG,ININUM,INISPC,
     3INISPL,INITAL,INSERT,INTRVL,IOFFST,IPASS ,IREVRS,
     4ISKIP ,ISPACE,ISTART,ITRAIL,ITTY  ,IVALUE,IWIDTH,
     5J     ,JDISK ,JGROUP,JMINUS,JSKIP ,JSTIFY,JTTY  ,
     6JVALUE,K     ,KASALL,KASFLG,KASLCL,KDISK ,KMINUS,
     7KNTARG,KNTLIN,KNTPNT,KNTQOT,KNTSPC,KNTXTR,KOMAND,
     8KOMENT,KONVRT,KPYBGN,KPYKAS,KPYKLM,KPYKNT,KPYLNG,
     9KPYMID,KPYPRE,KPYPRT,KPYSPL,KPYUSD,KPYWID,KVALUE
      COMMON/FMTTWO/LEDING,LENGTH,LFTDGT,LFTOVR,LITERL,
     1LMTBGN,LMTEND,LMTKAS,LMTLNG,LMTMID,LMTPRE,LMTSPL,
     2LMTTEM,LNGBGN,LNGEND,LNGMID,LNGTEM,LOCABC,LOCATE,
     3LOCPNT,LOWBFR,MASTER,MAXBGN,MAXEND,MAXLIN,MAXLNG,
     4MAXPRE,MAXPRT,MAXSPL,MAXWRD,MOVBAC,MRGFAR,MRGLFT,
     5MRGRIT,MRKBAC,MRKBLA,MRKCAR,MRKDOL,MRKDOT,MRKEXC,
     6MRKLES,MRKLIN,MRKNUM,MRKSEM,MRKUND,NEEDED,NOWIND,
     7NOWLFT,NOWLIN,NOWLNG,NOWOFF,NOWRIT,NOWSKP,NOWSPL,
     8NXTBGN,NXTLST
      COMMON/FMTTHR/KMDARG(63)  ,KMDBRK(63)  ,LNGDEF(50)  ,
     1 MCHPNT(224) ,MSKBGN(300) ,MSKDEF(500) ,MSKMID(300) ,
     2 MSKPRE(80)  ,NOTPNT(224) ,MSKTEM(300)
      COMMON/FMTFOU/LTRBAC,LTRBLA,LTRCAR,LTRCOM,LTRDOL,
     1LTRDOT,LTREXC,LTRHHH,LTRLES,LTRMNS,LTRNOW,LTRNUM,
     2LTRPLS,LTRQUO,LTRRIG,LTRSEM,LTRSLA,LTRSPA,LTRTAB,
     3LTRUND,LTRXXX,LWRHHH,LTRNXT
      COMMON/FMTFIV/LTRABC(26)  ,LTRBGN(300) ,LTRDEF(500) ,
     1 LTRDGT(10)  ,LTREND(72)  ,LTRFLG(9)   ,LTRMID(300) ,
     2 LTRONL(26)  ,LTRONU(26)  ,LTRPRE(80)  ,LTRTWO(5)   ,
     3 LWRABC(26)  ,LWRONL(26)  ,LWRONU(26)  ,LTRTEM(300)
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 8
      KNTLIN=0
      LNGBGN=0
      KPYBGN=0
      MAXBGN=132
      LMTKAS=132
C
C     ***************************************************
C     *                                                 *
C     *  REDEFINE CONDITIONS WHICH COMMANDS CAN CHANGE  *
C     *                                                 *
C     ***************************************************
C
    8 IF(MASTER.GT.2)GO TO 9
C
C     NO ACTIVE COMMAND
      KOMAND=0
C
C     .INPUT WIDTH 132
      NXTBGN=132
C
C     .UPPER CASE
      KASLCL=0
      KASALL=0
C
C     .NO MASK
      LNGTEM=0
C
C     .NO COPY
      KPYWID=0
      KPYKNT=0
C
C     .NO LEADING
      IHEADR=-2
C
C     .NO FILL
      IFFILL=1
C
C     .INDENT 0
      INDENT=0
C
C     NO .CENTER
      ICENTR=0
C
C     .PARAGRAPH 5,-1
      NOWIND=5
      NOWSKP=-1
C
C     .OFFSET 1
      NOWOFF=1
      IOFFST=NOWOFF
C
C     .LEFT MARGIN 0
      NOWLFT=0
      MRGLFT=IOFFST+NOWLFT
C
C     .RIGHT MARGIN 60
      NOWRIT=60
      MRGFAR=NOWRIT
      MRGRIT=IOFFST+NOWRIT
C
C     .SPACING 1
      ISPACE=0
C
C     .OUTPUT WIDTH 72
      MAXEND=72
C
C     .LENGTH 20
      MAXLIN=20
C
C     .JUSTIFY
      JSTIFY=1
      IREVRS=1
C
C     .BEGIN 1,1
      INITAL=1
      INTRVL=1
      MOVBAC=INTRVL
C
C     .NO TRAILING
      ITRAIL=0
C
C     .USE H
      IFQUOT=0
      LTRQUO=LTRHHH
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)
      MRKSEM=1
      MRKLES=0
      MRKDOT=1
      MRKBLA=0
      MRKDOL=1
      MRKBAC=1
      MRKUND=1
      MRKEXC=1
      MRKNUM=1
      MRKCAR=1
      IFFLAG=1
C
C     *****************************************************
C     *                                                   *
C     *  PREPARE FOR A NEW SEQUENCE OF OUTPUT STATEMENTS  *
C     *                                                   *
C     *****************************************************
C
    9 IF(MASTER.GT.3)GO TO 10
C
C     .NO INSERT
      MAXSPL=0
      MAXLNG=0
      NOWSPL=0
      NOWLNG=1
C
C     .NO PREFIX
      MAXPRE=0
C
C     NO .PROGRAM
      LITERL=0
C
C     .LEADING OR .NO LEADING
      ISKIP=IHEADR
C
C     ****************************************
C     *                                      *
C     *  PREPARE FOR A NEW OUTPUT STATEMENT  *
C     *                                      *
C     ****************************************
C
   10 LNGMID=0
      KPYMID=0
      NOWLIN=MAXLIN-1
      MRKLIN=0
      LNGEND=0
      LEDING=13
      RETURN
      END
      SUBROUTINE FMTGET
C     RENBR(/GET NEXT LINE OF TEXT)
C
C     DONALD E. BARTH, HARVARD BUSINESS SCHOOL
C
      COMMON/FMTONE/I     ,IBYTE ,ICENTR,IDISK ,IFFILL,
     1IFFLAG,IFQUOT,IGROUP,IHEADR,IMACRO,IMINUS,INDENT,
     2INICLM,INIKPY,INILED,INILIN,INILNG,ININUM,INISPC,
     3INISPL,INITAL,INSERT,INTRVL,IOFFST,IPASS ,IREVRS,
     4ISKIP ,ISPACE,ISTART,ITRAIL,ITTY  ,IVALUE,IWIDTH,
     5J     ,JDISK ,JGROUP,JMINUS,JSKIP ,JSTIFY,JTTY  ,
     6JVALUE,K     ,KASALL,KASFLG,KASLCL,KDISK ,KMINUS,
     7KNTARG,KNTLIN,KNTPNT,KNTQOT,KNTSPC,KNTXTR,KOMAND,
     8KOMENT,KONVRT,KPYBGN,KPYKAS,KPYKLM,KPYKNT,KPYLNG,
     9KPYMID,KPYPRE,KPYPRT,KPYSPL,KPYUSD,KPYWID,KVALUE
      COMMON/FMTTWO/LEDING,LENGTH,LFTDGT,LFTOVR,LITERL,
     1LMTBGN,LMTEND,LMTKAS,LMTLNG,LMTMID,LMTPRE,LMTSPL,
     2LMTTEM,LNGBGN,LNGEND,LNGMID,LNGTEM,LOCABC,LOCATE,
     3LOCPNT,LOWBFR,MASTER,MAXBGN,MAXEND,MAXLIN,MAXLNG,
     4MAXPRE,MAXPRT,MAXSPL,MAXWRD,MOVBAC,MRGFAR,MRGLFT,
     5MRGRIT,MRKBAC,MRKBLA,MRKCAR,MRKDOL,MRKDOT,MRKEXC,
     6MRKLES,MRKLIN,MRKNUM,MRKSEM,MRKUND,NEEDED,NOWIND,
     7NOWLFT,NOWLIN,NOWLNG,NOWOFF,NOWRIT,NOWSKP,NOWSPL,
     8NXTBGN,NXTLST
      COMMON/FMTTHR/KMDARG(63)  ,KMDBRK(63)  ,LNGDEF(50)  ,
     1 MCHPNT(224) ,MSKBGN(300) ,MSKDEF(500) ,MSKMID(300) ,
     2 MSKPRE(80)  ,NOTPNT(224) ,MSKTEM(300)
      COMMON/FMTFOU/LTRBAC,LTRBLA,LTRCAR,LTRCOM,LTRDOL,
     1LTRDOT,LTREXC,LTRHHH,LTRLES,LTRMNS,LTRNOW,LTRNUM,
     2LTRPLS,LTRQUO,LTRRIG,LTRSEM,LTRSLA,LTRSPA,LTRTAB,
     3LTRUND,LTRXXX,LWRHHH,LTRNXT
      COMMON/FMTFIV/LTRABC(26)  ,LTRBGN(300) ,LTRDEF(500) ,
     1 LTRDGT(10)  ,LTREND(72)  ,LTRFLG(9)   ,LTRMID(300) ,
     2 LTRONL(26)  ,LTRONU(26)  ,LTRPRE(80)  ,LTRTWO(5)   ,
     3 LWRABC(26)  ,LWRONL(26)  ,LWRONU(26)  ,LTRTEM(300)
C
C     READ NEXT LINE FROM INPUT FILE
      IF(MASTER.EQ.7)GO TO 4
      MASTER=0
      KASFLG=0
    1 IF(KPYBGN.LT.LNGBGN)GO TO 43
      IF(LMTKAS.LT.MAXBGN)GO TO 3
      MAXBGN=NXTBGN
      KNTLIN=KNTLIN+1
      READ(IDISK,2,END=66)(LTRBGN(I),I=1,MAXBGN)
    2 FORMAT(300A1)
      LMTKAS=0
      KPYKAS=0
      LNGBGN=0
      KPYPRT=0
      KPYBGN=0
    3 ISTART=KPYKAS+1
C
C     GET REST OF TEXTUAL ARGUMENT OF DOT COMMAND
    4 KOMENT=0
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
    5 LMTKAS=LMTKAS+1
      IF(LMTKAS.GT.MAXBGN)GO TO 42
      LTRNOW=LTRBGN(LMTKAS)
      IF(KOMENT.EQ.0)GO TO 9
      IF(MRKSEM.LE.0)GO TO 6
      IF(LTRNOW.EQ.LTRSEM)GO TO 41
    6 IF(KOMENT.GT.0)GO TO 9
      IF(MRKDOT.LE.0)GO TO 7
      IF(LTRNOW.EQ.LTRDOT)GO TO 40
    7 IF(MRKEXC.LE.0)GO TO 9
      IF(LTRNOW.EQ.LTREXC)GO TO 8
      GO TO 9
    8 KOMENT=1
      GO TO 27
    9 IF(LTRNOW.EQ.LTRSPA)GO TO 31
      IF(LTRNOW.EQ.LTRTAB)GO TO 30
      IF(MRKNUM.LE.0)GO TO 10
      IF(LTRNOW.EQ.LTRNUM)GO TO 32
   10 IF(MRKUND.LE.0)GO TO 11
      IF(LTRNOW.EQ.LTRUND)GO TO 33
   11 IF(MRKCAR.LE.0)GO TO 12
      IF(LTRNOW.EQ.LTRCAR)GO TO 36
   12 IF(MRKBAC.LE.0)GO TO 13
      IF(LTRNOW.EQ.LTRBAC)GO TO 38
   13 IF(MRKLES.LE.0)GO TO 14
      IF(LTRNOW.EQ.LTRLES)GO TO 29
   14 IF(KASLCL.LT.0)GO TO 15
      IF(KASLCL.GT.0)GO TO 21
C     KASFLG = 0, NOT IN LESS THAN WORD CAPITALIZATION
C            = 1, IN RANGE OF LESS THAN WORD CAPITALIZATION
      IF(KASFLG.NE.0)GO TO 21
      IF(KASALL.EQ.0)GO TO 27
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.
   15 KASLCL=0
      IF(LTRNOW.GT.LTRONU(18))GO TO 17
      IF(LTRNOW.GT.LTRONU(9))GO TO 16
      IF(LTRNOW.LT.LTRONU(1))GO TO 27
      NXTLST=3
      GO TO 18
   16 NXTLST=12
      GO TO 18
   17 IF(LTRNOW.GT.LTRONU(26))GO TO 27
      NXTLST=20
   18 IF(LTRNOW.LE.LTRONU(NXTLST))GO TO 19
      NXTLST=NXTLST+3
      IF(LTRNOW.GT.LTRONU(NXTLST))NXTLST=NXTLST+3
   19 IF(LTRNOW.EQ.LTRONU(NXTLST))GO TO 20
      NXTLST=NXTLST-1
      IF(LTRNOW.EQ.LTRONU(NXTLST))GO TO 20
      NXTLST=NXTLST-1
      IF(LTRNOW.NE.LTRONU(NXTLST))GO TO 27
   20 KPYKAS=KPYKAS+1
      IF(KOMENT.LE.0)LNGBGN=KPYKAS
      KPYPRT=KPYKAS
      LTRBGN(KPYKAS)=LWRONU(NXTLST)
      MSKBGN(KPYKAS)=-1
      GO TO 5
C
C     ATTEMPT TO CONVERT TO UPPER CASE
   21 KASLCL=0
      IF(LTRNOW.GT.LWRONL(18))GO TO 23
      IF(LTRNOW.GT.LWRONL(9))GO TO 22
      IF(LTRNOW.LT.LWRONL(1))GO TO 27
      NXTLST=3
      GO TO 24
   22 NXTLST=12
      GO TO 24
   23 IF(LTRNOW.GT.LWRONL(26))GO TO 27
      NXTLST=20
   24 IF(LTRNOW.LE.LWRONL(NXTLST))GO TO 25
      NXTLST=NXTLST+3
      IF(LTRNOW.GT.LWRONL(NXTLST))NXTLST=NXTLST+3
   25 IF(LTRNOW.EQ.LWRONL(NXTLST))GO TO 26
      NXTLST=NXTLST-1
      IF(LTRNOW.EQ.LWRONL(NXTLST))GO TO 26
      NXTLST=NXTLST-1
      IF(LTRNOW.NE.LWRONL(NXTLST))GO TO 27
   26 KPYKAS=KPYKAS+1
      IF(KOMENT.LE.0)LNGBGN=KPYKAS
      KPYPRT=KPYKAS
      LTRBGN(KPYKAS)=LTRONL(NXTLST)
      MSKBGN(KPYKAS)=-1
      GO TO 5
C
C     MAINTAIN CASE OF PRINTING CHARACTER
   27 KASLCL=0
      KPYKAS=KPYKAS+1
      IF(KOMENT.LE.0)LNGBGN=KPYKAS
      KPYPRT=KPYKAS
      LTRBGN(KPYKAS)=LTRNOW
      MSKBGN(KPYKAS)=-1
      IF(MRKDOL.LE.0)GO TO 28
      IF(LTRNOW.EQ.LTRDOL)MSKBGN(KPYKAS)=-2
   28 IF(KPYKAS.GT.ISTART)GO TO 5
      IF(MRKDOT.LE.0)GO TO 5
      IF(LTRNOW.EQ.LTRDOT)KOMENT=-1
      GO TO 5
C
C     LESS THAN SIGN MAY INDICATE FLAGGED UPPER CASE
   29 KASFLG=1-KASFLG
      GO TO 5
C
C     SPACE, OR CONVERT TAB TO SPACE
   30 IF(LITERL.NE.0)GO TO 27
   31 KASFLG=0
      KASLCL=0
      KPYKAS=KPYKAS+1
      LTRBGN(KPYKAS)=LTRSPA
      MSKBGN(KPYKAS)=0
      GO TO 5
C
C     TREAT NUMBER SIGN LIKE UNDERSCORE AND SPACE
   32 LTRBGN(LMTKAS)=LTRSPA
      GO TO 34
C
C     MAINTAIN CHARACTER FOLLOWING UNDERSCORE
   33 LMTKAS=LMTKAS+1
   34 KASLCL=0
      KPYKAS=KPYKAS+1
      IF(KOMENT.LE.0)LNGBGN=KPYKAS
      KPYPRT=KPYKAS
      MSKBGN(KPYKAS)=1
      IF(LMTKAS.GT.MAXBGN)GO TO 35
      LTRBGN(KPYKAS)=LTRBGN(LMTKAS)
      GO TO 5
   35 LTRBGN(KPYKAS)=LTRSPA
      GO TO 42
C
C     NEXT CHARACTER IS TO BE UPPER CASE
   36 IF(LMTKAS.GE.MAXBGN)GO TO 37
      IF(MRKCAR.LE.0)GO TO 37
      IF(LTRBGN(LMTKAS+1).NE.LTRCAR)GO TO 37
      LMTKAS=LMTKAS+1
      KASALL=0
      KASLCL=0
      GO TO 5
   37 KASLCL=1
      GO TO 5
C
C     NEXT CHARACTER IS TO BE LOWER CASE
   38 IF(LMTKAS.GE.MAXBGN)GO TO 39
      IF(MRKBAC.LE.0)GO TO 39
      IF(LTRBGN(LMTKAS+1).NE.LTRBAC)GO TO 39
      LMTKAS=LMTKAS+1
      KASALL=1
      KASLCL=0
      GO TO 5
   39 KASLCL=-1
      GO TO 5
   40 LMTKAS=LMTKAS-1
      GO TO 42
   41 KPYKAS=KPYKAS+1
      KPYPRT=KPYKAS
      LTRBGN(KPYKAS)=LTRNOW
      MSKBGN(KPYKAS)=-1
      GO TO 42
   42 KASLCL=0
C
C     ***************************************************
C     *                                                 *
C     *  2ND PASS, WRAP AND JUSTIFY LTRBGN INTO LTRMID  *
C     *                                                 *
C     ***************************************************
C
C     BRANCH IF COMMAND OR IF IN NOFILL MODE
   43 IF(MASTER.GT.0)GO TO 67
      IF(KOMENT.NE.0)GO TO 65
      IF(ISKIP.GT.0)GO TO 64
      IF(LITERL.NE.0)GO TO 62
      IF(ICENTR.NE.0)GO TO 59
      IF(IFFILL.EQ.0)GO TO 59
C
C     INSERT NEXT WORD INTO LTRMID ARRAY
   44 KPYBGN=KPYBGN+1
      IF(KPYBGN.GT.LNGBGN)GO TO 1
      IF(MSKBGN(KPYBGN).EQ.0)GO TO 44
      KPYBGN=KPYBGN-1
      MAXWRD=KPYBGN
      LENGTH=0
   45 MAXWRD=MAXWRD+1
      IF(MAXWRD.GT.LNGBGN)GO TO 46
      IF(MSKBGN(MAXWRD).EQ.0)GO TO 46
      LENGTH=LENGTH+1
      GO TO 45
   46 IF(LNGMID.LE.0)GO TO 50
      NEEDED=1
C     MSKMID = -2, DOLLAR SIGN NOT IN RANGE OF UNDERSCORE
C            = -1, INITIAL SPACES AND ALL PRINTING
C              CHARACTERS NOT IN RANGE OF UNDERSCORE
C            = 0, SPACES BETWEEN WORDS
C            = 1, CHARACTERS RIGHT OF UNDERSCORE
      IF(MSKMID(LNGMID).GT.0)GO TO 48
      LTRNOW=LTRMID(LNGMID)
      DO 47 I=1,5
      IF(LTRNOW.NE.LTRTWO(I))GO TO 47
      NEEDED=2
      GO TO 48
   47 CONTINUE
   48 IF((LNGMID+NEEDED+LENGTH).GT.MRGRIT)GO TO 54
      DO 49 I=1,NEEDED
      LNGMID=LNGMID+1
      LTRMID(LNGMID)=LTRSPA
   49 MSKMID(LNGMID)=-1
      MSKMID(LNGMID)=0
      KNTSPC=KNTSPC+1
      GO TO 52
   50 NEEDED=MRGLFT+INDENT
      INDENT=0
      IF(LENGTH.GT.LMTMID)LENGTH=LMTMID
      IF(NEEDED.GT.(LMTMID-LENGTH))NEEDED=LMTMID-LENGTH
      KNTSPC=0
      IF(NEEDED.LE.0)GO TO 52
      DO 51 I=1,NEEDED
      LNGMID=LNGMID+1
      MSKMID(LNGMID)=-1
      LTRMID(LNGMID)=LTRSPA
   51 CONTINUE
   52 DO 53 I=1,LENGTH
      KPYBGN=KPYBGN+1
      LNGMID=LNGMID+1
      LTRMID(LNGMID)=LTRBGN(KPYBGN)
      MSKMID(LNGMID)=MSKBGN(KPYBGN)
   53 CONTINUE
      GO TO 1
C
C     JUSTIFY TEXT WHEN LINE OVERFLOWS
   54 IREVRS=-IREVRS
      IF(LNGMID.GE.MRGRIT)GO TO 67
      IF(KNTSPC.LE.0)GO TO 67
      IF(JSTIFY.EQ.0)GO TO 67
      IGROUP=(MRGRIT-LNGMID)/KNTSPC
      JGROUP=MRGRIT-LNGMID-(KNTSPC*IGROUP)
      IF(IREVRS.GT.0)JGROUP=JGROUP-KNTSPC-1
      J=MRGRIT
   55 IF(MSKMID(LNGMID).NE.0)GO TO 57
      JGROUP=JGROUP+IREVRS
      NEEDED=IGROUP
      IF(JGROUP.GE.0)NEEDED=IGROUP+1
      IF(NEEDED.LE.0)GO TO 57
      DO 56 I=1,NEEDED
      LTRMID(J)=LTRSPA
      MSKMID(J)=0
   56 J=J-1
      IF(J.LE.LNGMID)GO TO 58
   57 LTRMID(J)=LTRMID(LNGMID)
      MSKMID(J)=MSKMID(LNGMID)
      J=J-1
      LNGMID=LNGMID-1
      GO TO 55
   58 LNGMID=MRGRIT
      GO TO 67
C
C     DIRECT COPY OF CHARACTERS IN NOFILL MODE
   59 IF(LNGBGN.LT.ISTART)GO TO 64
      LNGMID=1
      KPYMID=0
      NEEDED=MRGLFT+INDENT
      INDENT=0
      IF(ICENTR.LT.0)NEEDED=MRGLFT+
     1((MRGRIT-MRGLFT-LNGBGN+ISTART-1)/2)
      IF(ICENTR.GT.0)NEEDED=IOFFST+
     1((ICENTR-LNGBGN+ISTART-1)/2)
      ICENTR=0
      IF(NEEDED.LE.0)GO TO 61
      DO 60 I=1,NEEDED
      IF(KPYMID.GE.LMTMID)GO TO 61
      KPYMID=KPYMID+1
      MSKMID(KPYMID)=-1
      LTRMID(KPYMID)=LTRSPA
   60 CONTINUE
   61 IF(KPYBGN.GE.LNGBGN)GO TO 67
      IF(KPYMID.GE.LMTMID)GO TO 67
      KPYBGN=KPYBGN+1
      KPYMID=KPYMID+1
      LTRMID(KPYMID)=LTRBGN(KPYBGN)
      MSKMID(KPYMID)=MSKBGN(KPYBGN)
      IF(MSKMID(KPYMID).NE.0)LNGMID=KPYMID
      GO TO 61
C
C     OUTPUT TEXT IN PROGRAM (NOT FORMAT) MODE
   62 KPYBGN=ISTART-1
      IF(LNGBGN.GT.KPYBGN)GO TO 67
      WRITE(JDISK,63)
   63 FORMAT(1X)
      GO TO 1
C
C     SIMULATE LINES IN RANGE OF SKIP COMMAND
   64 LNGMID=0
      GO TO 67
   65 MASTER=2
      GO TO 67
   66 MASTER=1
   67 RETURN
      END
      SUBROUTINE FMTHOW
C     RENBR(/EVALUATE COMMAND)
C
C     DONALD E. BARTH, HARVARD BUSINESS SCHOOL
C
      COMMON/FMTONE/I     ,IBYTE ,ICENTR,IDISK ,IFFILL,
     1IFFLAG,IFQUOT,IGROUP,IHEADR,IMACRO,IMINUS,INDENT,
     2INICLM,INIKPY,INILED,INILIN,INILNG,ININUM,INISPC,
     3INISPL,INITAL,INSERT,INTRVL,IOFFST,IPASS ,IREVRS,
     4ISKIP ,ISPACE,ISTART,ITRAIL,ITTY  ,IVALUE,IWIDTH,
     5J     ,JDISK ,JGROUP,JMINUS,JSKIP ,JSTIFY,JTTY  ,
     6JVALUE,K     ,KASALL,KASFLG,KASLCL,KDISK ,KMINUS,
     7KNTARG,KNTLIN,KNTPNT,KNTQOT,KNTSPC,KNTXTR,KOMAND,
     8KOMENT,KONVRT,KPYBGN,KPYKAS,KPYKLM,KPYKNT,KPYLNG,
     9KPYMID,KPYPRE,KPYPRT,KPYSPL,KPYUSD,KPYWID,KVALUE
      COMMON/FMTTWO/LEDING,LENGTH,LFTDGT,LFTOVR,LITERL,
     1LMTBGN,LMTEND,LMTKAS,LMTLNG,LMTMID,LMTPRE,LMTSPL,
     2LMTTEM,LNGBGN,LNGEND,LNGMID,LNGTEM,LOCABC,LOCATE,
     3LOCPNT,LOWBFR,MASTER,MAXBGN,MAXEND,MAXLIN,MAXLNG,
     4MAXPRE,MAXPRT,MAXSPL,MAXWRD,MOVBAC,MRGFAR,MRGLFT,
     5MRGRIT,MRKBAC,MRKBLA,MRKCAR,MRKDOL,MRKDOT,MRKEXC,
     6MRKLES,MRKLIN,MRKNUM,MRKSEM,MRKUND,NEEDED,NOWIND,
     7NOWLFT,NOWLIN,NOWLNG,NOWOFF,NOWRIT,NOWSKP,NOWSPL,
     8NXTBGN,NXTLST
      COMMON/FMTTHR/KMDARG(63)  ,KMDBRK(63)  ,LNGDEF(50)  ,
     1 MCHPNT(224) ,MSKBGN(300) ,MSKDEF(500) ,MSKMID(300) ,
     2 MSKPRE(80)  ,NOTPNT(224) ,MSKTEM(300)
      COMMON/FMTFOU/LTRBAC,LTRBLA,LTRCAR,LTRCOM,LTRDOL,
     1LTRDOT,LTREXC,LTRHHH,LTRLES,LTRMNS,LTRNOW,LTRNUM,
     2LTRPLS,LTRQUO,LTRRIG,LTRSEM,LTRSLA,LTRSPA,LTRTAB,
     3LTRUND,LTRXXX,LWRHHH,LTRNXT
      COMMON/FMTFIV/LTRABC(26)  ,LTRBGN(300) ,LTRDEF(500) ,
     1 LTRDGT(10)  ,LTREND(72)  ,LTRFLG(9)   ,LTRMID(300) ,
     2 LTRONL(26)  ,LTRONU(26)  ,LTRPRE(80)  ,LTRTWO(5)   ,
     3 LWRABC(26)  ,LWRONL(26)  ,LWRONU(26)  ,LTRTEM(300)
C
      KPYBGN=KPYKAS
      IF(KOMENT.EQ.0)GO TO 25
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(LOCPNT.EQ.1)GO TO 30
      IF(KOMAND.LE.1)GO TO 28
      IF(KMDARG(KOMAND).EQ.0)GO TO 24
      IF(KMDARG(KOMAND).LT.0)GO TO 17
C
C     EVALUATE NUMBER TO RIGHT OF SWITCH
      KNTARG=0
    8 KVALUE=0
      KMINUS=0
    9 LOCATE=LOCATE+1
      IF(LOCATE.GT.LNGBGN)GO TO 13
      LTRNOW=LTRBGN(LOCATE)
      IF(LTRNOW.EQ.LTRSPA)GO TO 11
      IF(LTRNOW.EQ.LTRCOM)GO TO 12
      DO 10 I=1,10
      IF(LTRNOW.NE.LTRDGT(I))GO TO 10
      IF(KMINUS.EQ.0)KMINUS=1
      IF(KVALUE.LT.10000)KVALUE=(10*KVALUE)+I-1
      GO TO 9
   10 CONTINUE
      IF(KMINUS.NE.0)GO TO 13
      IF(LTRNOW.EQ.LTRMNS)KMINUS=-2
      IF(LTRNOW.EQ.LTRPLS)KMINUS=-1
      IF(KMINUS.EQ.0)GO TO 28
      GO TO 9
   11 IF(KMINUS.EQ.0)GO TO 9
   12 LOCATE=LOCATE+1
   13 IF(KMINUS.EQ.-2)KVALUE=-KVALUE
      KNTARG=KNTARG+1
      IF(KMINUS.EQ.0)GO TO 14
      IF(KNTARG.GT.KMDARG(KOMAND))GO TO 28
   14 IF(KNTARG.GT.2)GO TO 16
      IF(KNTARG.EQ.2)GO TO 15
      IMINUS=KMINUS
      IVALUE=KVALUE
      GO TO 16
   15 JMINUS=KMINUS
      JVALUE=KVALUE
   16 IF(LOCATE.GT.LNGBGN)GO TO 31
      LOCATE=LOCATE-1
      GO TO 8
C
C     FIND START OF TEXT STRING WHICH CANNOT EXTEND ACROSS
C     NORMAL END OF COMMAND CHARACTERS
   17 J=LOCATE+1
      LOCATE=LNGBGN+1
      KNTARG=0
      IF(J.GT.LNGBGN)GO TO 23
      LTRNOW=LTRBGN(J)
      IF(LTRNOW.EQ.LTRSPA)GO TO 19
      DO 18 I=1,26
      IF(LTRNOW.EQ.LTRABC(I))GO TO 28
      IF(LTRNOW.EQ.LWRABC(I))GO TO 28
   18 CONTINUE
      J=J-1
   19 I=1
   20 J=J+1
      IF(J.GT.LNGBGN)GO TO 22
      IF(MSKBGN(J).EQ.0)GO TO 20
      IF(MSKBGN(J).GT.0)GO TO 21
      IF(LTRBGN(J).NE.LTRCOM)GO TO 21
      IF(I.EQ.0)GO TO 19
      KNTARG=KNTARG+1
      IF(KNTARG.EQ.2)LOWBFR=LNGBGN+1
      GO TO 20
   21 KNTARG=KNTARG+1
      IF(KNTARG.EQ.1)LOCATE=J
      IF(KNTARG.EQ.2)LOWBFR=J
      I=0
      GO TO 20
   22 IF(I.EQ.0)GO TO 23
      KNTARG=KNTARG+1
      IF(KNTARG.EQ.2)LOWBFR=LNGBGN+1
   23 IF((-KNTARG).LE.KMDARG(KOMAND))GO TO 28
      GO TO 31
C
C     CONVERT CASE OF LETTERS IN REST OF TEXTUAL ARGUMENT
   24 LNGBGN=KPYPRT
      MASTER=7
      GO TO 32
C
C     INSURE SPACE FOLLOWS COMMAND WITH TEXTUAL ARGUMENT
   25 LOCATE=LOCATE+1
      IF(LOCATE.GT.LNGBGN)GO TO 31
      LTRNOW=LTRBGN(LOCATE)
      IF(LTRNOW.EQ.LTRSPA)GO TO 27
      DO 26 I=1,26
      IF(LTRNOW.EQ.LTRABC(I))GO TO 28
      IF(LTRNOW.EQ.LWRABC(I))GO TO 28
   26 CONTINUE
      GO TO 31
   27 LOCATE=LOCATE+1
      GO TO 31
C
C     REPORT ILLEGAL COMMAND TO USER
   28 WRITE(ITTY,29)KNTLIN,(LTRBGN(I),I=ISTART,LNGBGN)
   29 FORMAT(6H (Line,1I5,18H) Unknown command ,300A1)
   30 KOMAND=0
      MASTER=8
      GO TO 32
C
C     DETERMINE WHETHER LEGAL COMMAND REQUIRES BREAK
   31 MASTER=KMDBRK(KOMAND)
C
C     RETURN TO CALLING PROGRAM
   32 RETURN
      END
      SUBROUTINE FMTPUT
C     RENBR(/COPY LINE OF TEXT INTO FORMAT STATEMENT)
C
C     DONALD E. BARTH, HARVARD BUSINESS SCHOOL
C
      COMMON/FMTONE/I     ,IBYTE ,ICENTR,IDISK ,IFFILL,
     1IFFLAG,IFQUOT,IGROUP,IHEADR,IMACRO,IMINUS,INDENT,
     2INICLM,INIKPY,INILED,INILIN,INILNG,ININUM,INISPC,
     3INISPL,INITAL,INSERT,INTRVL,IOFFST,IPASS ,IREVRS,
     4ISKIP ,ISPACE,ISTART,ITRAIL,ITTY  ,IVALUE,IWIDTH,
     5J     ,JDISK ,JGROUP,JMINUS,JSKIP ,JSTIFY,JTTY  ,
     6JVALUE,K     ,KASALL,KASFLG,KASLCL,KDISK ,KMINUS,
     7KNTARG,KNTLIN,KNTPNT,KNTQOT,KNTSPC,KNTXTR,KOMAND,
     8KOMENT,KONVRT,KPYBGN,KPYKAS,KPYKLM,KPYKNT,KPYLNG,
     9KPYMID,KPYPRE,KPYPRT,KPYSPL,KPYUSD,KPYWID,KVALUE
      COMMON/FMTTWO/LEDING,LENGTH,LFTDGT,LFTOVR,LITERL,
     1LMTBGN,LMTEND,LMTKAS,LMTLNG,LMTMID,LMTPRE,LMTSPL,
     2LMTTEM,LNGBGN,LNGEND,LNGMID,LNGTEM,LOCABC,LOCATE,
     3LOCPNT,LOWBFR,MASTER,MAXBGN,MAXEND,MAXLIN,MAXLNG,
     4MAXPRE,MAXPRT,MAXSPL,MAXWRD,MOVBAC,MRGFAR,MRGLFT,
     5MRGRIT,MRKBAC,MRKBLA,MRKCAR,MRKDOL,MRKDOT,MRKEXC,
     6MRKLES,MRKLIN,MRKNUM,MRKSEM,MRKUND,NEEDED,NOWIND,
     7NOWLFT,NOWLIN,NOWLNG,NOWOFF,NOWRIT,NOWSKP,NOWSPL,
     8NXTBGN,NXTLST
      COMMON/FMTTHR/KMDARG(63)  ,KMDBRK(63)  ,LNGDEF(50)  ,
     1 MCHPNT(224) ,MSKBGN(300) ,MSKDEF(500) ,MSKMID(300) ,
     2 MSKPRE(80)  ,NOTPNT(224) ,MSKTEM(300)
      COMMON/FMTFOU/LTRBAC,LTRBLA,LTRCAR,LTRCOM,LTRDOL,
     1LTRDOT,LTREXC,LTRHHH,LTRLES,LTRMNS,LTRNOW,LTRNUM,
     2LTRPLS,LTRQUO,LTRRIG,LTRSEM,LTRSLA,LTRSPA,LTRTAB,
     3LTRUND,LTRXXX,LWRHHH,LTRNXT
      COMMON/FMTFIV/LTRABC(26)  ,LTRBGN(300) ,LTRDEF(500) ,
     1 LTRDGT(10)  ,LTREND(72)  ,LTRFLG(9)   ,LTRMID(300) ,
     2 LTRONL(26)  ,LTRONU(26)  ,LTRPRE(80)  ,LTRTWO(5)   ,
     3 LWRABC(26)  ,LWRONL(26)  ,LWRONU(26)  ,LTRTEM(300)
C
      IF(MASTER.EQ.0)GO TO 1
      IREVRS=1
      IF(LNGMID.EQ.0)GO TO 95
      GO TO 2
    1 IF(LITERL.NE.0)GO TO 79
C
C     INSERT CARRIAGE CONTROL REQUESTED BY .CARRIAGE
    2 IF(LNGMID.LE.0)GO TO 18
      I=LNGMID
      GO TO 4
    3 IF(MRKBLA.EQ.0)GO TO 18
      LNGMID=1
      MSKMID(1)=-1
      LTRMID(1)=LTRSPA
      I=0
    4 KPYLNG=NOWLNG
      KPYSPL=NOWSPL
      KPYKLM=LNGMID
C
C     INSERT TEMPLATE REQUESTED BY .MASK
      IF(LNGTEM.LE.0)GO TO 10
    5 IF(LNGMID.GE.IOFFST)GO TO 6
      IF(LNGMID.GE.LMTMID)GO TO 11
      LNGMID=LNGMID+1
      LTRMID(LNGMID)=LTRSPA
      MSKMID(LNGMID)=0
      GO TO 5
    6 J=IOFFST
      DO 9 I=1,LNGTEM
      J=J+1
      IF(J.GT.LMTMID)GO TO 11
      IF(LNGMID.GE.J)GO TO 7
      LNGMID=J
      GO TO 8
    7 IF(LTRMID(J).NE.LTRSPA)GO TO 9
      IF(MSKMID(J).GT.0)GO TO 9
    8 LTRMID(J)=LTRTEM(I)
      MSKMID(J)=MSKTEM(I)
    9 CONTINUE
      GO TO 11
C
C     COPY LINE OF TEXT IF REQUESTED BY .COPY
   10 IF(I.LE.IOFFST)GO TO 16
   11 KPYKLM=LNGMID
      KPYUSD=KPYWID
      IF(KPYUSD.LT.(LNGMID-IOFFST))KPYUSD=LNGMID-IOFFST
      I=IOFFST+KPYUSD
      J=I
      IF(J.GT.LNGMID)J=LNGMID
      L=KPYKNT
      K=LNGMID
   12 IF(L.LE.0)GO TO 16
      L=L-1
   13 IF(K.GE.I)GO TO 14
      IF(LNGMID.GE.LMTMID)GO TO 16
      K=K+1
      LNGMID=LNGMID+1
      MSKMID(LNGMID)=0
      LTRMID(LNGMID)=LTRSPA
      GO TO 13
   14 K=IOFFST
   15 IF(K.GE.J)GO TO 12
      IF(LNGMID.GE.LMTMID)GO TO 16
      K=K+1
      LNGMID=LNGMID+1
      MSKMID(LNGMID)=MSKMID(K)
      LTRMID(LNGMID)=LTRMID(K)
      GO TO 15
   16 IF(MRKBLA.EQ.0)GO TO 18
      IF(MSKMID(1).GE.0)GO TO 17
      IF(LTRMID(1).NE.LTRSPA)GO TO 17
      LTRMID(1)=LTRBLA
      MSKMID(1)=1
   17 LTRBLA=LTRNXT
      IF(MRKBLA.GT.0)MRKBLA=0
C
C     PREPARE TO GENERATE NEW OUTPUT LINE
   18 KPYMID=0
      IPASS=0
   19 INICLM=LNGEND
      INILIN=NOWLIN
      INILED=LEDING
      INISPL=NOWSPL
      INILNG=NOWLNG
      INIKPY=KPYKLM
   20 LFTOVR=MAXEND-LEDING-LNGEND
C
C     TEST FOR INITIAL FIELD DESCRIPTION
      IF(KPYMID.GE.LNGMID)GO TO 23
      INISPC=KPYMID+1
      IF(MSKMID(INISPC).EQ.-2)GO TO 48
C
C     TEST FOR INITIAL MULTIPLE SPACES
      INSERT=0
   21 IF(LTRMID(INISPC).NE.LTRSPA)GO TO 22
      INSERT=INSERT+1
      INISPC=INISPC+1
      IF(INISPC.LE.LNGMID)GO TO 21
      GO TO 63
   22 IF(INSERT.GE.3)GO TO 63
C
C     SEARCH FOR EMBEDDED OR RIGHTMOST SPACES
   23 MAXPRT=KPYMID
   24 MAXPRT=MAXPRT+1
      IF(MAXPRT.GT.LNGMID)GO TO 27
      IF(LTRMID(MAXPRT).NE.LTRSPA)GO TO 24
      INISPC=MAXPRT
   25 INISPC=INISPC+1
      IF(INISPC.GT.LNGMID)GO TO 26
      IF(LTRMID(INISPC).EQ.LTRSPA)GO TO 25
      INSERT=INISPC-MAXPRT
      IF(INSERT.GE.6)GO TO 27
      MAXPRT=INISPC
      GO TO 24
   26 INSERT=INISPC-MAXPRT
      IF(INSERT.GE.3)GO TO 27
      MAXPRT=INISPC
   27 MAXPRT=MAXPRT-1
      IF(KPYMID.GE.MAXPRT)GO TO 45
      IF(IFQUOT.NE.0)GO TO 37
C
C     DETERMINE LENGTH OF LINE IN H NOTATION WHICH WILL FIT
      IF(LFTOVR.LT.4)GO TO 72
      INSERT=MAXPRT-KPYMID
      IF(INSERT.GT.9)GO TO 28
      IF(INSERT.GT.(LFTOVR-3))INSERT=LFTOVR-3
      GO TO 29
   28 IF(INSERT.LE.(LFTOVR-4))GO TO 29
      INSERT=LFTOVR-3
      IF(INSERT.GE.10)INSERT=INSERT-1
C
C     DETERMINE IF FIELD DESCRIPTION APPEARS IN TEXT
   29 KONVRT=KPYMID
   30 IF(KONVRT.GE.(KPYMID+INSERT))GO TO 31
      KONVRT=KONVRT+1
      IF(MSKMID(KONVRT).NE.-2)GO TO 30
      INSERT=KONVRT-KPYMID-1
C
C     INSERT LINE IN H NOTATION
   31 IF(IPASS.NE.0)GO TO 32
      KPYMID=KPYMID+INSERT
      LNGEND=LNGEND+INSERT+3
      IF(INSERT.GE.10)LNGEND=LNGEND+1
      GO TO 70
   32 LFTDGT=INSERT
      ININUM=LNGEND+1
   33 LNGEND=LNGEND+1
      I=LFTDGT
      LFTDGT=LFTDGT/10
      I=I-(10*LFTDGT)
      J=LNGEND
   34 IF(J.LE.ININUM)GO TO 35
      LTREND(J)=LTREND(J-1)
      J=J-1
      GO TO 34
   35 LTREND(ININUM)=LTRDGT(I+1)
      IF(LFTDGT.GT.0)GO TO 33
      LNGEND=LNGEND+1
      LTREND(LNGEND)=LTRQUO
      DO 36 I=1,INSERT
      KPYMID=KPYMID+1
      LNGEND=LNGEND+1
   36 LTREND(LNGEND)=LTRMID(KPYMID)
      GO TO 69
C
C     DETERMINE LENGTH OF LINE IN ' NOTATION WHICH WILL FIT
   37 IF(LFTOVR.LT.4)GO TO 72
      KONVRT=KPYMID
      KNTQOT=0
   38 INSERT=MAXPRT+KNTQOT-KPYMID
      IF(INSERT.GT.(LFTOVR-3))INSERT=LFTOVR-3
   39 KONVRT=KONVRT+1
      IF(KONVRT.GT.(KPYMID+INSERT-KNTQOT))GO TO 42
      IF(MSKMID(KONVRT).NE.-2)GO TO 40
      INSERT=KONVRT-1-KPYMID+KNTQOT
      GO TO 42
   40 IF(LTRMID(KONVRT).NE.LTRQUO)GO TO 39
      IF((KONVRT-KPYMID+KNTQOT).LT.(LFTOVR-3))GO TO 41
      INSERT=INSERT-1
      IF(INSERT.LE.0)GO TO 72
      GO TO 42
   41 KNTQOT=KNTQOT+1
      GO TO 38
C
C     INSERT LINE IN ' NOTATION
   42 IF(IPASS.NE.0)GO TO 43
      KPYMID=KPYMID+INSERT-KNTQOT
      LNGEND=LNGEND+3+INSERT
      GO TO 70
   43 LNGEND=LNGEND+1
      LTREND(LNGEND)=LTRQUO
      INSERT=INSERT-KNTQOT
      DO 44 I=1,INSERT
      KPYMID=KPYMID+1
      LNGEND=LNGEND+1
      LTREND(LNGEND)=LTRMID(KPYMID)
      IF(LTRMID(KPYMID).NE.LTRQUO)GO TO 44
      LNGEND=LNGEND+1
      LTREND(LNGEND)=LTRQUO
   44 CONTINUE
      LNGEND=LNGEND+1
      LTREND(LNGEND)=LTRQUO
      GO TO 69
C
C     INSERT ZERO LENGTH LINE AS MERELY TERMINAL SLASH
   45 IF(MRKBLA.NE.0)GO TO 3
      IF(LNGTEM.GT.0)GO TO 4
      IF(LFTOVR.LE.0)GO TO 72
      IF(IPASS.EQ.0)GO TO 70
      IF(ISKIP.LE.0)GO TO 46
      ISKIP=ISKIP-1
      GO TO 69
   46 WRITE(KDISK,47)
   47 FORMAT(1X)
      ISKIP=ISPACE
      GO TO 69
C
C     FIND NEXT SECTION OF FIELD DESCRIPTION
   48 IF(KPYMID.LT.KPYKLM)GO TO 49
      KPYKLM=KPYKLM+KPYUSD
      NOWLNG=KPYLNG
      NOWSPL=KPYSPL
   49 KONVRT=NOWSPL
      INSERT=0
      IF(NOWLNG.GT.MAXLNG)GO TO 54
   50 IF(INSERT.GE.LFTOVR)GO TO 71
      IF(KONVRT.GE.LNGDEF(NOWLNG))GO TO 52
      KONVRT=KONVRT+1
      IF(MSKDEF(KONVRT).GT.0)GO TO 51
      IF(LTRDEF(KONVRT).EQ.LTRCOM)GO TO 59
   51 INSERT=INSERT+1
      GO TO 50
   52 IF(IPASS.EQ.0)GO TO 54
      I=1
      IF(NOWLNG.GT.1)I=LNGDEF(NOWLNG-1)+1
      J=LNGDEF(NOWLNG)
      IF(I.LE.J)WRITE(KDISK,53)(LTRDEF(K),K=I,J)
   53 FORMAT(300A1)
   54 NOWLNG=NOWLNG+1
   55 KPYMID=KPYMID+1
      IF(KPYMID.GT.LNGMID)GO TO 56
      IF(KPYMID.GT.KPYKLM)GO TO 56
      IF(MSKMID(KPYMID).EQ.-2)GO TO 55
   56 KPYMID=KPYMID-1
      IF(INSERT.GT.0)GO TO 59
      IF(NOWLNG.GT.(MAXLNG+1))GO TO 58
      IF(NOWLNG.GT.2)GO TO 57
      IF(NOWLNG.EQ.1)GO TO 58
      IF(LNGDEF(1).GT.0)GO TO 59
      GO TO 58
   57 IF(LNGDEF(NOWLNG-1).GT.LNGDEF(NOWLNG-2))GO TO 59
   58 IF(KPYMID.LT.LNGMID)GO TO 20
      IF(IPASS.EQ.0)GO TO 75
      GO TO 95
C
C     INSERT FIELD DESCRIPTION
   59 IF(IPASS.NE.0)GO TO 60
      LNGEND=LNGEND+INSERT+1
      NOWSPL=KONVRT
      GO TO 70
   60 IF(INSERT.LE.0)GO TO 62
      DO 61 I=1,INSERT
      NOWSPL=NOWSPL+1
      LNGEND=LNGEND+1
   61 LTREND(LNGEND)=LTRDEF(NOWSPL)
   62 NOWSPL=KONVRT
      GO TO 69
C
C     INSERT MULTIPLE SPACES IN X NOTATION
   63 IF(LFTOVR.LT.3)GO TO 72
      IF(INSERT.LT.10)GO TO 64
      IF(LFTOVR.EQ.3)INSERT=9
      IF(INSERT.LT.100)GO TO 64
      IF(LFTOVR.EQ.4)INSERT=99
   64 KPYMID=KPYMID+INSERT
      IF(IPASS.NE.0)GO TO 65
      LNGEND=LNGEND+3
      IF(INSERT.GE.10)LNGEND=LNGEND+1
      IF(INSERT.GE.100)LNGEND=LNGEND+1
      GO TO 70
   65 LFTDGT=INSERT
      ININUM=LNGEND+1
   66 LNGEND=LNGEND+1
      I=LFTDGT
      LFTDGT=LFTDGT/10
      I=I-(10*LFTDGT)
      J=LNGEND
   67 IF(J.LE.ININUM)GO TO 68
      LTREND(J)=LTREND(J-1)
      J=J-1
      GO TO 67
   68 LTREND(ININUM)=LTRDGT(I+1)
      IF(LFTDGT.GT.0)GO TO 66
      LNGEND=LNGEND+1
      LTREND(LNGEND)=LTRXXX
C
C     END OF CURRENT FIELD IN 2ND PASS
   69 LNGEND=LNGEND+1
      IF(KPYMID.GE.LNGMID)GO TO 96
      LTREND(LNGEND)=LTRCOM
      GO TO 20
C
C     END OF CURRENT FIELD IN 1ST PASS
   70 IF(KPYMID.LT.LNGMID)GO TO 20
      GO TO 75
C
C     INPUT LINE OVERFLOWS CURRENT OUTPUT LINE
   71 IMACRO=1
      GO TO 73
   72 IMACRO=0
   73 IF(IPASS.NE.0)GO TO 101
      LNGEND=0
      LEDING=6
      NOWLIN=NOWLIN-1
      IF(NOWLIN.GE.0)GO TO 20
      IF(INILIN.LT.(MAXLIN-1))GO TO 75
      IF(INICLM.GT.0)GO TO 75
C
C     CANCEL LINE WHICH IS IMPOSSIBLE TO OUTPUT
      WRITE(ITTY,74)KNTLIN,INITAL
   74 FORMAT(6H (Line,1I5,26H) Output line in statement,
     11I6,12H is too long)
      INITAL=INITAL+INTRVL
      IF(INITAL.LT.1)INITAL=1
      IF(INITAL.GT.99999)INITAL=99999
      MOVBAC=INTRVL
      LNGMID=0
      KPYMID=0
      IF(ISKIP.GT.0)ISKIP=0
      IF(IMACRO.EQ.0)GO TO 109
      NOWSPL=LNGDEF(NOWLNG)
      NOWLNG=NOWLNG+1
      GO TO 109
C
C     PREPARE FOR 2ND PASS OR FOR ANOTHER 1ST PASS
   75 KPYMID=0
      LNGEND=INICLM
      NOWSPL=INISPL
      NOWLNG=INILNG
      KPYKLM=INIKPY
      IF(NOWLIN.LT.0)GO TO 101
      IPASS=1
      NOWLIN=INILIN
      LEDING=INILED
C
C     CHECK IF PREFACE LINE IS NEEDED
      IF(MRKLIN.NE.0)GO TO 20
      IF(LNGEND.NE.0)GO TO 20
      IF(MAXPRE.LE.0)GO TO 93
C
C     GET NEXT CHARACTER IN PREFACE AND CHECK FOR DOLLAR
      KPYPRE=0
   76 KPYPRE=KPYPRE+1
      IF(KPYPRE.GT.MAXPRE)GO TO 90
      IF(MSKPRE(KPYPRE).NE.-2)GO TO 78
      IWIDTH=1
   77 IF(KPYPRE.GE.MAXPRE)GO TO 82
      IF(MSKPRE(KPYPRE+1).NE.-2)GO TO 82
      KPYPRE=KPYPRE+1
      IWIDTH=IWIDTH+1
      GO TO 77
   78 IF(LNGEND.GE.LMTEND)GO TO 90
      LNGEND=LNGEND+1
      LTREND(LNGEND)=LTRPRE(KPYPRE)
      GO TO 76
C
C     GET NEXT CHARACTER IN LITERAL AND CHECK FOR DOLLAR
   79 IF(KPYBGN.GE.LNGBGN)GO TO 90
      KPYBGN=KPYBGN+1
      IF(MSKBGN(KPYBGN).NE.-2)GO TO 81
      IWIDTH=1
   80 IF(KPYBGN.GE.LNGBGN)GO TO 82
      IF(MSKBGN(KPYBGN+1).NE.-2)GO TO 82
      KPYBGN=KPYBGN+1
      IWIDTH=IWIDTH+1
      GO TO 80
   81 IF(LNGEND.GE.LMTEND)GO TO 89
      LNGEND=LNGEND+1
      LTREND(LNGEND)=LTRBGN(KPYBGN)
      GO TO 79
C
C     REPLACE DOLLAR IN LITERAL OR PREFACE BY NUMBER
   82 LFTDGT=INITAL
      ININUM=LNGEND+1
   83 IF(LNGEND.GE.LMTEND)GO TO 90
      IWIDTH=IWIDTH-1
      LNGEND=LNGEND+1
      I=LFTDGT
      LFTDGT=LFTDGT/10
      I=I-(10*LFTDGT)
      J=LNGEND
   84 IF(J.LE.ININUM)GO TO 85
      LTREND(J)=LTREND(J-1)
      J=J-1
      GO TO 84
   85 LTREND(ININUM)=LTRDGT(I+1)
      IF(LFTDGT.GT.0)GO TO 83
      IF(IWIDTH.GT.(LMTEND-LNGEND))IWIDTH=LMTEND-LNGEND
      IF(IWIDTH.LE.0)GO TO 88
      I=LNGEND
      LNGEND=LNGEND+IWIDTH
      J=LNGEND
   86 LTREND(J)=LTREND(I)
      I=I-1
      J=J-1
      IF(I.GE.ININUM)GO TO 86
   87 LTREND(J)=LTRSPA
      J=J-1
      IF(J.GE.ININUM)GO TO 87
   88 IF(LITERL.NE.0)GO TO 79
      GO TO 76
C
C     INSERT LITERAL OR PREFACE INTO PROOF AND FORMAT FILES
   89 KPYBGN=LNGBGN
   90 WRITE(JDISK,91)(LTREND(I),I=1,LNGEND)
   91 FORMAT(300A1)
      WRITE(KDISK,92)(LTREND(I),I=1,LNGEND)
   92 FORMAT(300A1)
      LNGEND=0
      IF(LITERL.NE.0)GO TO 114
   93 WRITE(KDISK,94)INITAL
   94 FORMAT(1I5,8H FORMAT()
      GO TO 20
C
C     OUTPUT COMPLETED LINE OF FORMAT STATEMENT
   95 IF(LNGEND.EQ.0)GO TO 111
   96 LTREND(LNGEND)=LTRSLA
      IF(LNGMID.LE.0)GO TO 99
      IF(ISKIP.LE.0)GO TO 97
      ISKIP=ISKIP-1
      GO TO 99
   97 ISKIP=ISPACE
      WRITE(KDISK,98)(LTRMID(I),I=1,LNGMID)
   98 FORMAT(300A1)
   99 LNGMID=0
      IF(MASTER.EQ.0)GO TO 114
      IF(MASTER.EQ.6)GO TO 114
      IF(MASTER.EQ.5)GO TO 112
      IF(ITRAIL.LE.0)GO TO 100
      IF(ISKIP.GT.0)GO TO 3
  100 NOWLIN=0
  101 IF(NOWLIN.LE.0)LTREND(LNGEND)=LTRRIG
      IF(MRKLIN.GT.0)GO TO 106
      IF(NOWLIN.GT.0)GO TO 103
      IF(LNGEND.GT.1)GO TO 103
      WRITE(JDISK,102)INITAL
  102 FORMAT(1I5,11H FORMAT(1X))
      GO TO 105
  103 IF(LNGEND.EQ.0)WRITE(JDISK,104)INITAL
      IF(LNGEND.GT.0)WRITE(JDISK,104)INITAL,
     1(LTREND(I),I=1,LNGEND)
  104 FORMAT(I5,8H FORMAT(,59A1)
  105 INITAL=INITAL+INTRVL
      IF(INITAL.LT.1)INITAL=1
      IF(INITAL.GT.99999)INITAL=99999
      MOVBAC=INTRVL
      GO TO 108
  106 WRITE(JDISK,107)MRKLIN,(LTREND(I),I=1,LNGEND)
  107 FORMAT(5X,1I1,66A1)
C
C     SPECIFY APPEARANCE OF NEXT LINE OF FORMAT STATEMENT
  108 IF(NOWLIN.LE.0)GO TO 109
      LNGEND=0
      LEDING=6
      MRKLIN=MRKLIN+1
      IF(MRKLIN.GT.9)MRKLIN=1
      NOWLIN=NOWLIN-1
      GO TO 110
  109 NOWLIN=MAXLIN-1
      MRKLIN=0
      LNGEND=0
      LEDING=13
  110 IF(KPYMID.LT.LNGMID)GO TO 19
C
C     LINE OF TEXT IS ENTIRELY SHIFTED TO FORMAT STATEMENT
  111 IF(MASTER.EQ.0)GO TO 113
      IF(MASTER.EQ.6)GO TO 113
      IF(MASTER.EQ.5)GO TO 112
      IF(ITRAIL.LE.0)GO TO 113
  112 IF(ISKIP.GT.0)GO TO 3
  113 LNGMID=0
  114 RETURN
      END
      SUBROUTINE FMTSET
C     RENBR(/APPLY COMMAND)
C
C     DONALD E. BARTH, HARVARD BUSINESS SCHOOL
C
      COMMON/FMTONE/I     ,IBYTE ,ICENTR,IDISK ,IFFILL,
     1IFFLAG,IFQUOT,IGROUP,IHEADR,IMACRO,IMINUS,INDENT,
     2INICLM,INIKPY,INILED,INILIN,INILNG,ININUM,INISPC,
     3INISPL,INITAL,INSERT,INTRVL,IOFFST,IPASS ,IREVRS,
     4ISKIP ,ISPACE,ISTART,ITRAIL,ITTY  ,IVALUE,IWIDTH,
     5J     ,JDISK ,JGROUP,JMINUS,JSKIP ,JSTIFY,JTTY  ,
     6JVALUE,K     ,KASALL,KASFLG,KASLCL,KDISK ,KMINUS,
     7KNTARG,KNTLIN,KNTPNT,KNTQOT,KNTSPC,KNTXTR,KOMAND,
     8KOMENT,KONVRT,KPYBGN,KPYKAS,KPYKLM,KPYKNT,KPYLNG,
     9KPYMID,KPYPRE,KPYPRT,KPYSPL,KPYUSD,KPYWID,KVALUE
      COMMON/FMTTWO/LEDING,LENGTH,LFTDGT,LFTOVR,LITERL,
     1LMTBGN,LMTEND,LMTKAS,LMTLNG,LMTMID,LMTPRE,LMTSPL,
     2LMTTEM,LNGBGN,LNGEND,LNGMID,LNGTEM,LOCABC,LOCATE,
     3LOCPNT,LOWBFR,MASTER,MAXBGN,MAXEND,MAXLIN,MAXLNG,
     4MAXPRE,MAXPRT,MAXSPL,MAXWRD,MOVBAC,MRGFAR,MRGLFT,
     5MRGRIT,MRKBAC,MRKBLA,MRKCAR,MRKDOL,MRKDOT,MRKEXC,
     6MRKLES,MRKLIN,MRKNUM,MRKSEM,MRKUND,NEEDED,NOWIND,
     7NOWLFT,NOWLIN,NOWLNG,NOWOFF,NOWRIT,NOWSKP,NOWSPL,
     8NXTBGN,NXTLST
      COMMON/FMTTHR/KMDARG(63)  ,KMDBRK(63)  ,LNGDEF(50)  ,
     1 MCHPNT(224) ,MSKBGN(300) ,MSKDEF(500) ,MSKMID(300) ,
     2 MSKPRE(80)  ,NOTPNT(224) ,MSKTEM(300)
      COMMON/FMTFOU/LTRBAC,LTRBLA,LTRCAR,LTRCOM,LTRDOL,
     1LTRDOT,LTREXC,LTRHHH,LTRLES,LTRMNS,LTRNOW,LTRNUM,
     2LTRPLS,LTRQUO,LTRRIG,LTRSEM,LTRSLA,LTRSPA,LTRTAB,
     3LTRUND,LTRXXX,LWRHHH,LTRNXT
      COMMON/FMTFIV/LTRABC(26)  ,LTRBGN(300) ,LTRDEF(500) ,
     1 LTRDGT(10)  ,LTREND(72)  ,LTRFLG(9)   ,LTRMID(300) ,
     2 LTRONL(26)  ,LTRONU(26)  ,LTRPRE(80)  ,LTRTWO(5)   ,
     3 LWRABC(26)  ,LWRONL(26)  ,LWRONU(26)  ,LTRTEM(300)
C
C
      WRITE(KDISK,1)(LTRBGN(I),I=ISTART,LNGBGN)
    1 FORMAT(300A1)
C
C     GO TO(   ,BLA,BRE,CEN,EOF,FIL,FAL,FCA,CAR,FCO,
C    1      FLC,FQU,FSP,FUC,FOR,IND,IWI,INS,JUS,LMA,
C    2      LEN,LCA,NFI,NFA,NFC,NCA,NFC,NFL,NFQ,NFS,
C    3      NFU,NJU,NTR,OFF,OWI,PAR,PRE,PRO,RES,RMA,
C    4      SKI,SPA,TRA,UCA,USE,FIN,FRE,FFE,NFI,NFR,
C    5      NFF,LEA,NLE,EJE,USH,COP,MAS,NPR,NMA,NCO,
C    6      NIN,NOF,BEG),KOMAND
      GO TO( 72,  4, 72,  7, 72,  9, 10, 11,  5, 12,
     1       14, 16, 18, 19, 20, 21, 22, 23, 30, 32,
     2       33, 34, 39, 40, 41, 37, 42, 44, 46, 48,
     3       49, 51, 56, 57, 59, 60, 62, 64, 72, 65,
     4       66, 67, 68, 69, 70, 13, 17, 15, 43, 47,
     5       45, 31, 52, 72, 71,  8, 35, 55, 53, 38,
     6       50, 54,  2),KOMAND
C
C     .BEGIN
    2 LITERL=0
    3 IF(IMINUS.LT.0)INITAL=INITAL+IVALUE-MOVBAC
      IF(IMINUS.EQ.0)INITAL=INITAL+INTRVL-MOVBAC
      IF(IMINUS.GT.0)INITAL=IVALUE
      IF(INITAL.LT.1)INITAL=1
      IF(INITAL.GT.99999)INITAL=99999
      IF(KNTARG.LE.1)JVALUE=0
      IF(JVALUE.NE.0)INTRVL=JVALUE
      MOVBAC=0
      IF(LITERL.NE.0)MOVBAC=INTRVL
      GO TO 72
C
C     .BLANK
    4 IF(ISKIP.LT.-1)GO TO 72
      IF(ISKIP.EQ.-1)ISKIP=0
      IF(IVALUE.LE.0)IVALUE=1
      ISKIP=ISKIP+IVALUE
      GO TO 72
C
C     .CARRIAGE
    5 MRKBLA=0
      IF(LOCATE.GT.LNGBGN)GO TO 6
      LTRBLA=LTRBGN(LOCATE)
      LTRNXT=LTRBLA
      MRKBLA=1
    6 IF(KNTARG.LT.2)GO TO 72
      IF(LOWBFR.GT.LNGBGN)GO TO 72
      LTRNXT=LTRBGN(LOWBFR)
      IF(MRKBLA.EQ.0)LTRBLA=LTRNXT
      MRKBLA=-1
      GO TO 72
C
C     .CENTER
    7 ICENTR=-1
      IF(IVALUE.GT.0)ICENTR=IVALUE
      IF(IMINUS.LE.0)ICENTR=MRGFAR+IVALUE
      INDENT=0
      GO TO 72
C
C     .COPY
    8 IF(IMINUS.NE.0)KPYWID=IVALUE
      IF(KNTARG.GT.1)KPYKNT=JVALUE
      GO TO 72
C
C     .FILL
    9 IFFILL=1
      GO TO 72
C
C     .FLAGS ALL
   10 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
      GO TO 72
C
C     .FLAGS CAPITALIZE
   11 IF(LOCATE.LE.LNGBGN)LTRLES=LTRBGN(LOCATE)
      MRKLES=IFFLAG
      GO TO 72
C
C     .FLAGS CONTROL
   12 IF(LOCATE.LE.LNGBGN)LTRDOT=LTRBGN(LOCATE)
      GO TO 72
C
C     .FLAGS INSERT
   13 IF(LOCATE.LE.LNGBGN)LTRDOL=LTRBGN(LOCATE)
      MRKDOL=IFFLAG
      GO TO 72
C
C     .FLAGS LOWER CASE
   14 IF(LOCATE.LE.LNGBGN)LTRBAC=LTRBGN(LOCATE)
      MRKBAC=IFFLAG
      GO TO 72
C
C     .FLAGS FENCE
   15 IF(LOCATE.LE.LNGBGN)LTRSEM=LTRBGN(LOCATE)
      MRKSEM=1
      GO TO 72
C
C     .FLAGS QUOTE
   16 IF(LOCATE.LE.LNGBGN)LTRUND=LTRBGN(LOCATE)
      MRKUND=IFFLAG
      GO TO 72
C
C     .FLAGS REMARK
   17 IF(LOCATE.LE.LNGBGN)LTREXC=LTRBGN(LOCATE)
      MRKEXC=1
      GO TO 72
C
C     .FLAGS SPACE
   18 IF(LOCATE.LE.LNGBGN)LTRNUM=LTRBGN(LOCATE)
      MRKNUM=IFFLAG
      GO TO 72
C
C     .FLAGS UPPER CASE
   19 IF(LOCATE.LE.LNGBGN)LTRCAR=LTRBGN(LOCATE)
      MRKCAR=IFFLAG
      GO TO 72
C
C     .FORMAT
   20 IF(LITERL.NE.0)ISKIP=JSKIP
      GO TO 2
C
C     .INDENT
   21 INDENT=5
      IF(IMINUS.NE.0)INDENT=IVALUE
      ICENTR=0
      GO TO 72
C
C     .INPUT WIDTH
   22 IF(IMINUS.LT.0)IVALUE=NXTBGN+IVALUE
      IF(IVALUE.GT.LMTBGN)IVALUE=LMTBGN
      IF(IVALUE.GT.0)NXTBGN=IVALUE
      GO TO 72
C
C     .INSERT
C     USED DEFINITIONS ARE REMOVED BEFORE NEW ONE IS ADDED
   23 I=0
   24 IF(NOWLNG.GT.MAXLNG)GO TO 25
      I=I+1
      LNGDEF(I)=LNGDEF(NOWLNG)-NOWSPL
      NOWLNG=NOWLNG+1
      GO TO 24
   25 NOWLNG=1
      MAXLNG=I
      I=0
   26 IF(NOWSPL.GE.MAXSPL)GO TO 27
      I=I+1
      NOWSPL=NOWSPL+1
      LTRDEF(I)=LTRDEF(NOWSPL)
      MSKDEF(I)=MSKDEF(NOWSPL)
      GO TO 26
   27 NOWSPL=0
      MAXSPL=I
      IF(MAXLNG.GE.LMTLNG)GO TO 72
      IF(LOCATE.GE.LNGBGN)GO TO 29
      IF((MAXSPL+LNGBGN-LOCATE+1).GT.LMTSPL)GO TO 72
      DO 28 I=LOCATE,LNGBGN
      MAXSPL=MAXSPL+1
      LTRDEF(MAXSPL)=LTRBGN(I)
   28 MSKDEF(MAXSPL)=MSKBGN(I)
   29 MAXLNG=MAXLNG+1
      LNGDEF(MAXLNG)=MAXSPL
      GO TO 72
C
C     .JUSTIFY
   30 JSTIFY=1
      GO TO 72
C
C     .LEADING
   31 IHEADR=-1
      IF(ISKIP.LT.0)ISKIP=-1
      GO TO 72
C
C     .LEFT MARGIN
   32 IF(IMINUS.LT.0)IVALUE=NOWLFT+IVALUE
      NOWLFT=IVALUE
      MRGLFT=NOWLFT+IOFFST
      IF(MRGLFT.LT.IOFFST)MRGLFT=IOFFST
      GO TO 72
C
C     .LENGTH
   33 IF(IMINUS.LT.0)IVALUE=MAXLIN+IVALUE
      IF(IVALUE.LE.0)GO TO 72
      NOWLIN=IVALUE+NOWLIN-MAXLIN
      MAXLIN=IVALUE
      GO TO 72
C
C     .LOWER CASE, CORRESPONDS TO \\ IN TEXT
   34 KASALL=1
      GO TO 72
C
C     .MASK
   35 LNGTEM=0
      IF(LOCATE.GE.LNGBGN)GO TO 72
      DO 36 I=LOCATE,LNGBGN
      IF(LNGTEM.GE.LMTTEM)GO TO 72
      LNGTEM=LNGTEM+1
      MSKTEM(LNGTEM)=MSKBGN(I)
   36 LTRTEM(LNGTEM)=LTRBGN(I)
      GO TO 72
C
C     .NO CARRIAGE
   37 MRKBLA=0
      GO TO 72
C
C     .NO COPY
   38 KPYKNT=0
      GO TO 72
C
C     .NO FILL
   39 IFFILL=0
      GO TO 72
C
C     .NO FLAGS ALL
   40 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
      GO TO 72
C
C     .NO FLAGS CAPITALIZE
   41 MRKLES=0
      GO TO 72
C
C     .NO FLAGS CONTROL
   42 MRKDOT=0
      GO TO 72
C
C     .NO FLAGS INSERT
   43 MRKDOL=0
      GO TO 72
C
C     .NO FLAGS LOWER CASE
   44 MRKBAC=0
      GO TO 72
C
C     .NO FLAGS FENCE
   45 MRKSEM=0
      GO TO 72
C
C     .NO FLAGS QUOTE
   46 MRKUND=0
      GO TO 72
C
C     .NO FLAGS REMARK
   47 MRKEXC=0
      GO TO 72
C
C     .NO FLAGS SPACE
   48 MRKNUM=0
      GO TO 72
C
C     .NO FLAGS UPPER CASE
   49 MRKCAR=0
      GO TO 72
C
C     .NO INSERT
   50 MAXSPL=0
      MAXLNG=0
      NOWSPL=0
      NOWLNG=1
      GO TO 72
C
C     .NO JUSTIFY
   51 JSTIFY=0
      GO TO 72
C
C     .NO LEADING
   52 IHEADR=-2
      IF(ISKIP.LT.0)ISKIP=-2
      GO TO 72
C
C     .NO MASK
   53 LNGTEM=0
      GO TO 72
C
C     .NO OFFSET
   54 IVALUE=0
      GO TO 58
C
C     .NO PREFACE
   55 MAXPRE=0
      GO TO 72
C
C     .NO TRAILING
   56 ITRAIL=0
      GO TO 72
C
C     .OFFSET
   57 IF(IMINUS.LE.0)IVALUE=NOWOFF+IVALUE
   58 NOWOFF=IVALUE
      IOFFST=NOWOFF
      IF(IOFFST.LT.0)IOFFST=0
      MRGLFT=NOWLFT+IOFFST
      IF(MRGLFT.LT.IOFFST)MRGLFT=IOFFST
      MRGRIT=NOWRIT+IOFFST
      IF(MRGRIT.GT.LMTMID)MRGRIT=LMTMID
      GO TO 72
C
C     .OUTPUT WIDTH
   59 IF(IMINUS.LT.0)IVALUE=MAXEND+IVALUE
      IF(IVALUE.GT.LMTEND)IVALUE=LMTEND
      IF(IVALUE.GT.0)MAXEND=IVALUE
      GO TO 72
C
C     .PARAGRAPH
   60 INDENT=NOWIND
      IF(IMINUS.NE.0)INDENT=IVALUE
      NOWIND=INDENT
      IF(KNTARG.GT.1)NOWSKP=JVALUE
      IF(ISKIP.LT.-1)GO TO 72
      IF(ISKIP.EQ.-1)ISKIP=0
      IF(NOWSKP.LT.0)GO TO 61
      ISKIP=ISKIP+(NOWSKP*(ISPACE+1))
      GO TO 72
   61 ISKIP=ISKIP-NOWSKP
      GO TO 72
C
C     .PREFACE
   62 MAXPRE=0
      IF(LOCATE.GE.LNGBGN)GO TO 72
      DO 63 I=LOCATE,LNGBGN
      IF(MAXPRE.GE.LMTPRE)GO TO 72
      MAXPRE=MAXPRE+1
      MSKPRE(MAXPRE)=MSKBGN(I)
   63 LTRPRE(MAXPRE)=LTRBGN(I)
      GO TO 72
C
C     .PROGRAM, LITERAL COPY OF INPUT TO OUTPUT
   64 IF(LITERL.EQ.0)JSKIP=ISKIP
      ISKIP=0
      LITERL=1
      GO TO 3
C
C     .RIGHT MARGIN
   65 IF(IMINUS.LT.0)IVALUE=NOWRIT+IVALUE
      IF(IMINUS.EQ.0)IVALUE=MRGFAR
      NOWRIT=IVALUE
      IF(MRGFAR.LT.NOWRIT)MRGFAR=NOWRIT
      MRGRIT=NOWRIT+IOFFST
      IF(MRGRIT.GT.LMTMID)MRGRIT=LMTMID
      GO TO 72
C
C     .SKIP
   66 IF(ISKIP.LT.-1)GO TO 72
      IF(ISKIP.EQ.-1)ISKIP=0
      IF(IVALUE.LE.0)IVALUE=1
      ISKIP=ISKIP+(IVALUE*(ISPACE+1))
      GO TO 72
C
C     .SPACING
   67 ISPACE=0
      IF(IVALUE.GT.0)ISPACE=IVALUE-1
      GO TO 72
C
C     .TRAILING
   68 ITRAIL=1
      GO TO 72
C
C     .UPPER CASE, CORRESPONDS TO ^^ IN TEXT
   69 KASALL=0
      GO TO 72
C
C     .USE
   70 IF(LOCATE.GT.LNGBGN)GO TO 72
      LTRQUO=LTRBGN(LOCATE)
      IFQUOT=1
      GO TO 72
C
C     .USE H
   71 LTRQUO=LTRBGN(LOWBFR-1)
      IFQUOT=0
      GO TO 72
C
C     COMMAND COMPLETED
   72 RETURN
      END