       IDENTIFICATION DIVISION.
       PROGRAM-ID.   RMCNFG.
      *                  Ver. 2.0B
      *              For CP/M, CP/M-86 and MS-DOS OpSys Environments
      *              Date Revised  11 July 1984
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       SOURCE-COMPUTER.  RMCOBOL.
       OBJECT-COMPUTER.  RMCOBOL.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
       SELECT TERM-FILE ASSIGN TO RANDOM "RMCTRM.DAT"
           ORGANIZATION IS INDEXED
           ACCESS MODE IS DYNAMIC
           RECORD KEY IS TERM-TYPE.
       SELECT CONFIG-FILE ASSIGN TO RANDOM "RMCNFG.DAT"
           ORGANIZATION IS RELATIVE
           ACCESS MODE IS DYNAMIC
           RELATIVE KEY IS REL-KEY.
       DATA DIVISION.
       FILE SECTION.
       FD  TERM-FILE.
       01  TERM-REC.
           03  TERM-TYPE                          PIC X(8).
           03  TERM-DATA.
               05  CRT-DEF-WORD OCCURS 7 TIMES    PIC 9(5)  COMP-1.
               05  CNTL-SEQ-WORD OCCURS 110 TIMES PIC 9(5)  COMP-1.
               05  SPARE-AREA-WORD OCCURS 7 TIMES PIC 9(5)  COMP-1.
           03  FC-KEY-SEQ.
               05  FC-BYTE     OCCURS 18 TIMES    PIC X.
       FD  CONFIG-FILE.
       01  CONFIG-REC.
           03  CONFIG-KEY                         PIC X(8).
           03  CONFIG-DATA-1.
               05  WORD1     OCCURS 11 TIMES      PIC 9(5)  COMP-1.
           03  TERM-NAME                          PIC X(8).
           03  TERM-INFO.
               05  TERM-INFO-1                    PIC X(14).
               05  TERM-INFO-2                    PIC X(220).
               05  TERM-INFO-3                    PIC X(14).
           03  CONFIG-DATA-2.
               05  DISK-MAP.
                   07  WORD2   OCCURS 11 TIMES    PIC 9(5)  COMP-1.
               05  LNK-FUNC.
                   07  WORD3   OCCURS 21 TIMES    PIC 9(5)  COMP-1.
           03  FILLER                             PIC X(158).
           03  CONFIG-REC-USED                    PIC XXXX.
      *
       WORKING-STORAGE SECTION.
       01  A                                      PIC 99.
       01  A-BYTES REDEFINES A.
           03  A1                                 PIC 9.
           03  A2                                 PIC 9.
       01  B                                      PIC 99.
       01  B-BYTES REDEFINES B.
           03  B1                                 PIC 9.
           03  B2                                 PIC 9.
      /
       77  C                                      PIC 999.
       77  D                                      PIC 9.
       77  E                                      PIC 99.
       01  RUN-NAMES.
           03  RUN-NAME     OCCURS 4 TIMES        PIC X(74).
       01  RM-NAMES.
           03  RM-NAME      OCCURS 4 TIMES        PIC X(74).
       77  I                                      PIC 99.
       77  J                                      PIC 999.
       77  L                                      PIC 99.
       77  M                                      PIC 9(4).
       77  N                                      PIC 9.
       77  O                                      PIC 99.
       77  P                                      PIC 99.
       77  Q                                      PIC 999.
       77  R                                      PIC X.
       77  FILE-NAME                              PIC X(74).
       77  DATA-BUF                               PIC X(512).
       77  FUNC                                   PIC 99.
       77  RTN                                    PIC 99.
       77  OS-NUM                                 PIC 9.
       77  REL-KEY                                PIC 99.
       77  EXCPT-CHAR                             PIC 99.
       77  TERM-FLG                               PIC 9.
       77  CONFIG-FLG                             PIC 9.
       77  ENTER-IND                              PIC 9.
       01  TERM-DISP-AREA.
           03  TERM-DISP OCCURS 108 TIMES         PIC X(8).
       01  CONFIG-DISP-AREA.
           03  CONFIG-DISP OCCURS 16 TIMES        PIC X(8).
       01  BIT-VALUES.
           03  FILLER              PIC 9(16)
                   VALUE 4096025600160001.
       01  BIT-VALUE-TABLE REDEFINES BIT-VALUES.
           03  BIT-VALUE           PIC 9(4)      OCCURS 4 TIMES.
       01  HEX-VALUES.
           03  FILLER              PIC X(16)
                   VALUE "0123456789ABCDEF".
       01  HEX-VALUE-TABLE REDEFINES HEX-VALUES.
           03  HEX-VALUE           PIC X         OCCURS 16 TIMES.
       01  ERROR-LITERALS.
           03  ERR-LIT  OCCURS 19 TIMES           PIC X(35).
       01  TAB-TABLE.
           03  TAB-1                              PIC X(16).
           03  TAB-2                              PIC X(32).
       01  TAB-TABLE-BYTES REDEFINES TAB-TABLE.
           03  TAB-BYTE   OCCURS 48 TIMES         PIC X.
      /
       01  TAB-BUFFER.
           03  TAB-BUF     OCCURS 2 TIMES         PIC 9.
       01  TAB-NUM REDEFINES TAB-BUFFER           PIC 99.
       01  DISK-TEMP.
           03  DISK-BYTE    OCCURS 22 TIMES       PIC X.
       77  NUM                                    PIC 999.
       77  COND                                   PIC 9.
       01  DEL.
           03  FILLER                             PIC X(3).
       01  TEMP-STORAGE.
           03  ALPHA-TEMP-AREA OCCURS 31 TIMES.
               05 ALPHA-TEMP-BYTE OCCURS 16 TIMES PIC X.
           03  NUM-TEMP-AREA OCCURS 32 TIMES      PIC 999.
           03  ALPHA-COND OCCURS 12 TIMES         PIC X.
           03  COND-TEMP-AREA OCCURS 12 TIMES     PIC 9.
       01  FC-TBL.
           03  FILLER                             PIC X(21).
           03  FC-SEQ                             PIC X(18).
           03  FILLER                             PIC XXX.
       01  LNK-TBL.
           03  FILLER                             PIC X(9).
           03  HF-NAME                            PIC X(11).
           03  FILLER                             PIC X(22).
       01  COMP1-TEMP-AREA.
           05 COMP1-TEMP-WORD   OCCURS 17 TIMES   PIC 9(5) COMP-1.
       01  COMP1                                  PIC 9(5) COMP-1.
       01  COMP1-BYTES REDEFINES COMP1.
           03  C1-BYTE                            PIC X.
           03  C2                                 PIC X.
       01  COMP2                                  PIC 9(5) COMP-1.
       01  COMP2-BYTES REDEFINES COMP2.
           03  C2-BYTE                            PIC X.
           03  C4                                 PIC X.
       01  COMP3                                  PIC 9(5) COMP-1.
       01  COMP3-BYTES REDEFINES COMP3.
           03  C1                                 PIC X.
           03  C3                                 PIC X.
       77  C5                                     PIC X.
       01  WORK-AREA.
           03  WORK-WORD      OCCURS 7 TIMES      PIC S9(5).
       01  LINE-NUMBERS.
           03  LN     OCCURS 20 TIMES             PIC 99.
       01  DATA-REC.
           03  RUN-1                              PIC X(22).
           03  RUN-2                              PIC X(248).
           03  RUN-3                              PIC X(64).
       01  SPARE-WORDS.
           03  SPARE-WORD    OCCURS 7 TIMES       PIC 9(5)  COMP-1.
       01  SPARE-AREA.
           03  SPARE-CHAR    OCCURS 28 TIMES      PIC X.
       77  CONFIG-NAME                            PIC X(8).
       77  KEY-SAVE                               PIC X(8).
      /
       PROCEDURE DIVISION.
       SEG-50 SECTION 50.
       INIT-PARA.
           MOVE 0 TO A B C D E I J L M N O P Q FUNC RTN
                     OS-NUM REL-KEY EXCPT-CHAR TERM-FLG 
                     CONFIG-FLG ENTER-IND TAB-BUFFER
                     NUM COND COMP1 COMP2 COMP3
           MOVE 7 TO LN (1)  MOVE 8 TO LN (2)  MOVE 9 TO LN (3)
           MOVE 10 TO LN (4)  MOVE 13 TO LN (5)  MOVE 14 TO LN (6)
           MOVE 15 TO LN (7)  MOVE 16 TO LN (8)  MOVE 17 TO LN (9)
           MOVE 18 TO LN (10)  MOVE 6 TO LN (11)  MOVE 8 TO LN (12)
           MOVE 12 TO LN (13)  MOVE 13 TO LN (14)  MOVE 14 TO LN (15)
           MOVE 15 TO LN (16)  MOVE 16 TO LN (17)  MOVE 19 TO LN (18)
           MOVE 20 TO LN (19)
           MOVE "Input Error!" TO ERR-LIT (1) MOVE "Value too large"
               TO ERR-LIT (2) MOVE "Entry left blank" TO ERR-LIT (3)
           MOVE "Answer Y or N" TO ERR-LIT (4)
           MOVE "Values must be hexadecimal" TO ERR-LIT (5)
           MOVE "Entry not complete" TO ERR-LIT (6)
           MOVE "Entry too long" TO ERR-LIT (7) MOVE "Must be A thru P"
               TO ERR-LIT (8) MOVE "Must be A or R" TO ERR-LIT (9)
           MOVE "Must be Cntl-Char or DEL" TO ERR-LIT (10)
           MOVE "Numbers and commas only" TO ERR-LIT (11)
           MOVE "Filename Error!" TO ERR-LIT (12)
           MOVE "1st char must be 0 thru 9" TO ERR-LIT (13)
           MOVE "Line, Column offsets can't be equal" TO ERR-LIT (14)
           MOVE "Record not found" TO ERR-LIT (15)
           MOVE "Record already exists" TO ERR-LIT (16)
           MOVE "Incorrect value" TO ERR-LIT (17)
           MOVE "OpSys not yet available" TO ERR-LIT (18)
           MOVE "ALL is not a valid name" TO ERR-LIT (19)
           MOVE SPACES TO RUN-NAME (1) RUN-NAME (2)
                          RUN-NAME (3) RUN-NAME (4)
           MOVE "RUNCOBOL.COM" TO RUN-NAME (1) RUN-NAME (3)
           MOVE "RUNCOBOL.CMD" TO RUN-NAME (2)
           MOVE "RUNCOBOL.68K" TO RUN-NAME (4)
           MOVE "RMCOBOL.COM" TO RM-NAME (1) RM-NAME (3)
           MOVE "RMCOBOL.CMD" TO RM-NAME (2)
           MOVE "RMCOBOL.68K" TO RM-NAME (4).
       ACPT-OS-NUM.
           PERFORM TITLE.
           DISPLAY "1.  CP/M, MP/M-II and TurboDOS Operating Systems"
               LINE 5 POSITION 10
               "2.  CP/M-86 and MP/M-86 Operating Systems" POSITION 10
               "3.  MS-DOS and PC-DOS Operating Systems" POSITION 10
               "4.  CP/M-68K Operating Systems" POSITION 10
               "Enter desired OpSys Number   " LINE 12 POSITION 20.
           ACCEPT OS-NUM POSITION 0 CONVERT ECHO TAB.
           IF OS-NUM = 0 OR OS-NUM > 4
               MOVE 17 TO E PERFORM ERROR-DA GO TO ACPT-OS-NUM.
           IF OS-NUM = 4
               MOVE 18 TO E PERFORM ERROR-DA GO TO ACPT-OS-NUM.
      /
       SEG-0 SECTION 0.
       C1-FILL.
           MOVE LOW-VALUES TO C1-BYTE.
       C2-FILL.
           MOVE LOW-VALUES TO C2-BYTE.
       TITLE.
           DISPLAY
           "RM/COBOL Configuration Utility (Ver. 2.0B 11 July 84)" 
               LINE 1 ERASE.
       DISP-MAIN-MENU.
           DISPLAY "Main Menu" LINE 4 POSITION 5
               "1.  View, Change or Add Terminal Library Entry"
                   POSITION 10
               "2.  View, Change or Add Configuration Table Entry"
                   POSITION 10
               "3.  Configure Compiler or Runtime" POSITION 10.
           MOVE 1 TO D.
       DISP-EXIT.
           DISPLAY "4.  Exit Program" POSITION 10.
       ACPT-N.
           DISPLAY "Enter Desired Function Number - "
               LINE 12 POSITION 20 ERASE EOL.
           ACCEPT N POSITION 0 CONVERT ECHO TAB.
           IF N = 0 OR N > 4 PERFORM INPUT-ERROR PERFORM ACPT-ERROR.
       ACPT-0.
           GO TO PARA-1, PARA-2, PARA-3 DEPENDING ON N.
       STOP-PARA.
           STOP RUN.
      /
       ACPT-ERROR.
           GO TO ACPT-N, ACPT-1, ACPT-2, ACPT-3 DEPENDING ON D.
       DISP-RTN.
           DISPLAY "3.  Return to Main Menu" POSITION 10.
       CHECK-PAGE.
           DISPLAY "Is the above information correct ?"
               LINE 23 POSITION 40.
           PERFORM ENTER-COMMAND.
       ENTER-COMMAND.
           MOVE 0 TO ENTER-IND.
           PERFORM ENTER-PARA UNTIL ENTER-IND = 1.
           PERFORM ERASE-MESSAGE.
       ENTER-PARA.
           DISPLAY "Enter Y(Yes) N(No) or E(Exit) "
               LINE 24 POSITION 40 ERASE EOL.
           ACCEPT R POSITION 0 TAB.
           IF R = "Y" OR R = "y" OR R = "N" OR R = "n"
               OR R = "E" OR R = "e" MOVE 1 TO ENTER-IND.
       ERROR-PARA.
           PERFORM ERROR-DA   PERFORM ERASE-MESSAGE.
       ERROR-DA.
           DISPLAY ERR-LIT (E) LINE 23 POSITION 40
               "Hit any key to try again" POSITION 40.
           ACCEPT R POSITION 0.
       INPUT-ERROR.
           MOVE 1 TO E   PERFORM ERROR-PARA.
       NOT-FOUND.
           MOVE 15 TO E   PERFORM ERROR-DA.
       ALREADY-EXISTS.
           MOVE 16 TO E   PERFORM ERROR-DA.
       ERASE-MESSAGE.
           DISPLAY " " LINE 23 POSITION 30 ERASE EOS.
       B-TAB-DISP.
           DISPLAY "(Cntl-B for Back-Tab)" LINE 4 POSITION 56.
       FIX-WW1.
           IF WORK-WORD (1) > 32767 SUBTRACT 65536 FROM WORK-WORD (1).
       WW1-CHECK.
           IF WORK-WORD (1) < 0 ADD 65536 TO WORK-WORD (1).
       FND-TERM.
           START TERM-FILE KEY NOT < TERM-TYPE
               INVALID KEY PERFORM NO-TERM.
           MOVE 0 TO I   PERFORM READ-NEXT UNTIL I = 1.
       NO-TERM.
           DISPLAY SPACES LINE 4 POSITION 46 SIZE 8.
           PERFORM NOT-FOUND CLOSE TERM-FILE GO TO PARA-1.
       READ-NEXT.
           READ TERM-FILE NEXT RECORD AT END PERFORM NO-TERM.
           DISPLAY TERM-TYPE LINE 4 POSITION 46
           "Is this the terminal you wanted ?" LINE 23 POSITION 40.
           PERFORM ENTER-COMMAND.
           IF R = "Y" OR R = "y" MOVE 1 TO I
             ELSE IF R = "E" OR R = "e" CLOSE TERM-FILE GO TO PARA-1.
      /
       WRITE-MESSAGE.
           DISPLAY "Writing Record" LINE 23 POSITION 40 BLINK.
       REWRITE-MESSAGE.
           DISPLAY "Rewriting Record" LINE 23 POSITION 40 BLINK.
       CHECK-MESSAGE.
           DISPLAY "Checking Term Entry" LINE 23 POSITION 40 BLINK.
       PATCH-MESSAGE.
           DISPLAY "Patching" LINE 23 POSITION 40 BLINK.
       RETURN-PARA.
           DISPLAY "Hit any key to return to menu" POSITION 40.
           ACCEPT R POSITION 0.
       WRITTEN-MESSAGE.
           DISPLAY "Record Written " LINE 23 POSITION 40.
       REWRITTEN-MESSAGE.
           DISPLAY "Record Rewritten " LINE 23 POSITION 40.
       SET-FC-SEQ.
           ADD 1 TO L ADD 1 TO J MOVE FC-BYTE (L) TO C2.
           PERFORM C1-FILL   IF COMP1 < 32 PERFORM SET-FC-CNTL
             ELSE IF COMP1 = 127 PERFORM CNV-DEL
               ELSE IF COMP1 > 127 PERFORM CNV-NA1
                 ELSE MOVE FC-BYTE (L) TO ALPHA-TEMP-BYTE (I J).
       SET-FC-CNTL.
           IF COMP1 = 27 PERFORM ESC-MOVE
             ELSE IF COMP1 = 13 PERFORM CR-MOVE
               ELSE IF COMP1 = 10 PERFORM LF-MOVE
                 ELSE ADD 64 TO COMP1 PERFORM CNTL-MOVE
                     MOVE C2 TO ALPHA-TEMP-BYTE (I J).
       CNV-EX.
           ADD 1 TO L IF ALPHA-TEMP-BYTE (P L) = "!"
             PERFORM CNV-ALPHA-CHAR ELSE MOVE 2 TO C MOVE P TO A
             SUBTRACT 1 FROM L GIVING B MOVE 0 TO COMP1 ADD 1 TO L
             PERFORM CNV-CNTL-HEX 2 TIMES.
       CNV-CNTL-HEX.
           PERFORM CNV-HEX   ADD WORK-WORD (1) TO COMP1.
       CNV-HEX.
           ADD 1 TO B MOVE ALPHA-TEMP-BYTE (A B) TO C4.
           PERFORM CNV-HEX-VALUE.
       CNV-HEX-VALUE.
           ADD 1 TO C   PERFORM C2-FILL.
           IF COMP2 > 64 SUBTRACT 55 FROM COMP2
             ELSE SUBTRACT 48 FROM COMP2.
           MOVE COMP2 TO WORK-WORD (1).
           MULTIPLY BIT-VALUE (C) BY WORK-WORD (1) PERFORM FIX-WW1.
      /
       CNV-CNTL-ENTRY.
           ADD 1 TO L ADD 1 TO M.
           IF ALPHA-TEMP-BYTE (P L) = "\" MOVE 27 TO COMP1
             ELSE IF ALPHA-TEMP-BYTE (P L) = "^" ADD 1 TO L
                 PERFORM CNV-CNTL-CHAR
               ELSE IF ALPHA-TEMP-BYTE (P L) = "C" PERFORM C-CHECK
                 ELSE IF ALPHA-TEMP-BYTE (P L) = "D" PERFORM D-CHECK
                   ELSE IF ALPHA-TEMP-BYTE (P L) = "L" PERFORM L-CHECK
                     ELSE IF ALPHA-TEMP-BYTE (P L) = "!" PERFORM CNV-EX
                       ELSE PERFORM CNV-ALPHA-CHAR.
           MOVE COMP1 TO COMP1-TEMP-WORD (M).
       C-CHECK.
           ADD 1 TO L.
           IF ALPHA-TEMP-BYTE (P L) = "R" MOVE 13 TO COMP1
             ELSE IF ALPHA-TEMP-BYTE (P L) = "O" MOVE 0 TO COMP1
               ELSE SUBTRACT 1 FROM L PERFORM CNV-ALPHA-CHAR.
       D-CHECK.
           ADD 1 TO L   IF ALPHA-TEMP-BYTE (P L) = "E" ADD 1 TO L
               IF ALPHA-TEMP-BYTE (P L) = "L" MOVE 127 TO COMP1
                 ELSE SUBTRACT 2 FROM L MOVE 68 TO COMP1
             ELSE SUBTRACT 1 FROM L MOVE 68 TO COMP1.
       L-CHECK.
           ADD 1 TO L.
           IF ALPHA-TEMP-BYTE (P L) = "F" MOVE 10 TO COMP1
             ELSE IF ALPHA-TEMP-BYTE (P L) = "N" MOVE 0 TO COMP1
               ELSE SUBTRACT 1 FROM L PERFORM CNV-ALPHA-CHAR.
       CNV-ALPHA-CHAR.
           MOVE ALPHA-TEMP-BYTE (P L) TO C2.
       CNV-CNTL-CHAR.
           PERFORM CNV-ALPHA-CHAR.
           PERFORM C1-FILL   SUBTRACT 64 FROM COMP1.
       ESC-MOVE.
           MOVE "\" TO ALPHA-TEMP-BYTE (I J).
       CR-MOVE.
           MOVE "C" TO ALPHA-TEMP-BYTE (I J)   ADD 1 TO J.
           MOVE "R" TO ALPHA-TEMP-BYTE (I J).
       LF-MOVE.
           MOVE "L" TO ALPHA-TEMP-BYTE (I J)   ADD 1 TO J.
           MOVE "F" TO ALPHA-TEMP-BYTE (I J).
       CNTL-MOVE.
           MOVE "^" TO ALPHA-TEMP-BYTE (I J)   ADD 1 TO J.
       CNV-DEL.
           MOVE "D" TO ALPHA-TEMP-BYTE (I J)   ADD 1 TO J.
           MOVE "E" TO ALPHA-TEMP-BYTE (I J)   ADD 1 TO J.
           MOVE "L" TO ALPHA-TEMP-BYTE (I J).
       EM-MOVE.
           MOVE "!" TO ALPHA-TEMP-BYTE (I J).
       CNV-EM.
           PERFORM EM-MOVE ADD 1 TO J PERFORM EM-MOVE.
       CNV-NA.
           PERFORM EM-MOVE MOVE J TO B MOVE I TO A.
           MOVE 2 TO C ADD 2 TO J.
      /
       CNV-NA1.
           PERFORM CNV-NA   MOVE COMP1 TO WORK-WORD (1).
           PERFORM SET-LNK-HEX 2 TIMES.
       CNV-NA2.
           PERFORM CNV-NA   MOVE COMP2 TO WORK-WORD (1).
           PERFORM SET-LNK-HEX 2 TIMES.
       SET-HEX-VALUE.
           ADD 1 TO B ADD 1 TO C.
           DIVIDE WORK-WORD (1) BY BIT-VALUE (C) GIVING E REMAINDER M.
           MOVE M TO WORK-WORD (1)   ADD 1 TO E.
       SET-LNK-HEX.
           PERFORM SET-HEX-VALUE.
           MOVE HEX-VALUE (E) TO ALPHA-TEMP-BYTE (A B).
      *
       SEG-51 SECTION 51.
       PARA-1.
           PERFORM TITLE.
           DISPLAY "Terminal Menu" LINE 4 POSITION 5
               "1.  View/Change Terminal Library Entry" POSITION 10
               "2.  Add New Terminal Library Entry" POSITION 10.
           PERFORM DISP-RTN   PERFORM DISP-EXIT.
       ACPT-1.
           MOVE 2 TO D   PERFORM ACPT-N.
           GO TO SUB-1-1, SUB-1-2, TITLE, STOP-PARA DEPENDING ON N.
       SUB-1-1.
           MOVE 0 TO TERM-FLG   PERFORM TITLE.
           DISPLAY "Enter Terminal Type (up to 8 characters) "
               LINE 4 POSITION 5.
           ACCEPT TERM-TYPE POSITION 0 TAB.
           IF TERM-TYPE = SPACES GO TO PARA-1.
           OPEN I-O TERM-FILE.
           IF TERM-TYPE = "ALL     " PERFORM DISP-ALL-TERMS.
           READ TERM-FILE INVALID KEY PERFORM FND-TERM.
       DISP-TERM-INFO.
           DISPLAY "1. Col/Screen" LINE 6 POSITION 2
           "2. Lines/Screen" POSITION 2 "3. ANSI-Type" POSITION 2
           "4. Line Offset" POSITION 2 "5. Column Offset" POSITION 2
           "6. Line Bias" POSITION 2 "7. Column Bias" POSITION 2
           "8. Char Delete" POSITION 2 "9. Alt Delete" POSITION 2
           "10. Line Delete" POSITION 1 "11. Attr Overhead" POSITION 1
           "12. 1/2 Intensity" POSITION 1 "13. Crsr Pos Seq" POSITION 1
           "14. Clear Screen" POSITION 1 "15. Crsr Nxt Line" POSITION 1
           "16. Screen Nrml" POSITION 1
           "17. Blink" LINE 6 POSITION 39 "18. Reverse" POSITION 39
           "19. Blk Rev" POSITION 39 "20. Alternate" POSITION 39
           "21. Alt Blk" POSITION 39 "22. Alt Rev" POSITION 39
           "23. Alt Blk Rev" POSITION 39 "24. Reset" POSITION 39
           "25. Crsr On" POSITION 39 "26. Crsr Off" POSITION 39
           "27. Backspace" POSITION 39 "28. Ring Bell" POSITION 39
           "29. Erase EOL" POSITION 39 "30. Erase EOS" POSITION 39
           "31. FKey Seq" POSITION 39 "32. FKey Ofst" POSITION 39.
      /
       TERM-REC-TO-DISP.
           MOVE SPACES TO TEMP-STORAGE.
           MOVE 2 TO I   PERFORM FIX-CRT-DEF 5 TIMES   MOVE 0 TO I.
           DISPLAY SPACE LINE 5   PERFORM FLIP-COMP 2 TIMES.
           MOVE 1 TO A   MOVE 2 TO B   PERFORM SPLIT-DEF-WORD 5 TIMES.
           MOVE 0 TO I   PERFORM DISP-CRT-DEF 12 TIMES   MOVE 0 TO Q.
           PERFORM DISP-CNTL-SEQ THRU DISP-LINE 18 TIMES   MOVE 0 TO L.
           MOVE 31 TO I MOVE FC-BYTE (17) TO C2 PERFORM C1-FILL.
           ADD 48 TO COMP1 MOVE C2 TO ALPHA-TEMP-BYTE (I 1).
           MOVE 1 TO J MOVE C2 TO NUM PERFORM SET-FC-SEQ NUM TIMES.
           MOVE FC-BYTE (18) TO C2 ADD 48 TO COMP1.
           MOVE C2 TO NUM-TEMP-AREA (32).
           DISPLAY ALPHA-TEMP-AREA (31) POSITION 57 MOVE 0 TO I.
           DISPLAY NUM-TEMP-AREA (32) POSITION 57.
       CHECK-TERM-UPDT.
           PERFORM CHECK-PAGE.
           IF R = "N" OR R = "n"
               MOVE 0 TO J   MOVE 5 TO L   PERFORM B-TAB-DISP
             ELSE IF R = "Y" OR R = "y" GO TO REWRITE-TERM
               ELSE CLOSE TERM-FILE GO TO PARA-1.
       UPDT-LOOP-1.
           PERFORM UPDT-TERM-LOOP UNTIL J = 32.
       UPDT-CHECK-1.
           MOVE 1 TO TERM-FLG   GO TO CHECK-TERM-UPDT.
      *
       DISP-ALL-TERMS.
           DISPLAY "Reading all terminal types" LINE 24 POSITION 40.
           MOVE LOW-VALUES TO TERM-TYPE MOVE SPACES TO TERM-DISP-AREA.
           START TERM-FILE KEY > TERM-TYPE READ TERM-FILE NEXT RECORD.
           MOVE 0 TO I MOVE 0 TO J PERFORM READ-KEYS UNTIL I = 1.
           COMPUTE A ROUNDED = (J + 2) / 6.
           PERFORM TITLE   MOVE 5 TO P   MOVE 0 TO J.
           PERFORM DISP-KEY-PARA 6 TIMES.
           DISPLAY "(Terminals w/ asterisk are for MS-DOS)"
               LINE 23 POSITION 40   PERFORM RETURN-PARA.
           CLOSE TERM-FILE   GO TO PARA-1.
       DISP-KEY-PARA.
           DISPLAY " " LINE 3 PERFORM DISP-KEYS A TIMES.
           ADD 11 TO P.
       READ-KEYS.
           ADD 1 TO J   MOVE TERM-TYPE TO TERM-DISP (J).
           READ TERM-FILE NEXT RECORD AT END MOVE 1 TO I.
       DISP-KEYS.
           ADD 1 TO J   DISPLAY TERM-DISP (J) POSITION P.
      /
       REWRITE-TERM.
           IF TERM-FLG = 1 PERFORM REWRITE-MESSAGE
               PERFORM DISP-TO-TERM-REC   REWRITE TERM-REC
               PERFORM REWRITTEN-MESSAGE.
       TERM-LOOP.
           CLOSE TERM-FILE.
           PERFORM RETURN-PARA   GO TO PARA-1.
       FIX-CRT-DEF.
           ADD 1 TO I   MOVE CRT-DEF-WORD (I) TO WORK-WORD (I).
           IF WORK-WORD (I) < 0 ADD 65536 TO WORK-WORD (I).
       FLIP-COMP.
           ADD 1 TO I   MOVE CRT-DEF-WORD (I) TO COMP3   MOVE C3 TO C5.
           MOVE C1 TO C3 MOVE C5 TO C1 MOVE COMP3 TO NUM-TEMP-AREA (I).
       SPLIT-DEF-WORD.
           ADD 1 TO I   ADD 2 TO A   ADD 2 TO B.
           DIVIDE WORK-WORD (I) BY 256 GIVING NUM-TEMP-AREA (A)
               REMAINDER NUM-TEMP-AREA (B).
       DISP-CRT-DEF.
           ADD 1 TO I   IF I < 8
               IF I = 3 PERFORM DISP-TERM-COND
                 ELSE DISPLAY NUM-TEMP-AREA (I) POSITION 22
             ELSE IF I > 10 PERFORM DISP-TERM-COND
               ELSE PERFORM DISP-TDEL.
       DISP-TDEL.
           MOVE NUM-TEMP-AREA (I) TO COMP1.
           IF COMP1 = 127 MOVE "DEL" TO ALPHA-TEMP-AREA (I)
             ELSE MOVE "^" TO ALPHA-TEMP-BYTE (I 1) ADD 64 TO COMP1
                 MOVE C2 TO ALPHA-TEMP-BYTE (I 2).
           DISPLAY ALPHA-TEMP-AREA (I) POSITION 22.
       DISP-TERM-COND.
           IF NUM-TEMP-AREA (I) = 1 MOVE "Y" TO ALPHA-COND (I)
             ELSE MOVE "N" TO ALPHA-COND (I).
           DISPLAY ALPHA-COND (I) POSITION 22.
       DISP-CNTL-SEQ.
           ADD 1 TO I   MOVE 1 TO J   PERFORM GET-COMPS.
           MOVE COMP1 TO COND   MOVE COND TO ALPHA-TEMP-BYTE (I J).
           IF COND = 0 GO TO DISP-LINE.
           ADD 1 TO J MOVE 0 TO C PERFORM COMP2-CHECK.
           DIVIDE COMP1 BY 2 GIVING NUM REMAINDER N.
           MOVE 0 TO L   PERFORM GET-CNTL-SEQ NUM TIMES.
       DISP-LINE.
           IF I < 17 DISPLAY ALPHA-TEMP-AREA (I) POSITION 22
             ELSE IF I = 17 DISPLAY ALPHA-TEMP-AREA (I)
                 LINE 6 POSITION 57
               ELSE DISPLAY ALPHA-TEMP-AREA (I) POSITION 57.
           COMPUTE Q = (I * 6) - 70.
       GET-COMPS.
           ADD 1 TO Q   MOVE CNTL-SEQ-WORD (Q) TO WORK-WORD (1).
           PERFORM WW1-CHECK.
           DIVIDE WORK-WORD (1) BY 256 GIVING COMP1 REMAINDER COMP2.
      /
       GET-CNTL-SEQ.
           PERFORM GET-COMPS   ADD 1 TO J   PERFORM COMP1-CHECK.
           IF N = 0 ADD 1 TO L IF L = NUM GO TO DISP-LINE.
           ADD 1 TO J   PERFORM COMP2-CHECK.
       COMP1-CHECK.
           ADD 1 TO C   IF COMP1 < 32 PERFORM CNV-COMP1
             ELSE IF COMP1 = 33 PERFORM CNV-EM
               ELSE IF COMP1 = 127 PERFORM CNV-DEL
                 ELSE IF COMP1 > 127 PERFORM CNV-NA1
                   ELSE MOVE C2 TO ALPHA-TEMP-BYTE (I J).
       COMP2-CHECK.
           ADD 1 TO C   IF COMP2 < 32 PERFORM CNV-COMP2
             ELSE IF COMP2 = 33 PERFORM CNV-EM
               ELSE IF COMP2 = 127 PERFORM CNV-DEL
                 ELSE IF COMP2 > 127 PERFORM CNV-NA2
                   ELSE MOVE C4 TO ALPHA-TEMP-BYTE (I J).
       CNV-COMP1.
           IF COMP1 = 27 PERFORM ESC-MOVE
             ELSE IF I = 13 IF COMP1 = 0 PERFORM LNCO-MOVE
                    ELSE PERFORM COMP1-MOVE
               ELSE IF I = 15 IF COMP1 = 13 PERFORM CR-MOVE
                      ELSE IF COMP1 = 10 PERFORM LF-MOVE
                        ELSE PERFORM COMP1-MOVE
                 ELSE PERFORM COMP1-MOVE.
       CNV-COMP2.
           IF COMP2 = 27 PERFORM ESC-MOVE
             ELSE IF I = 13 IF COMP2 = 0 PERFORM LNCO-MOVE
                    ELSE PERFORM COMP2-MOVE
               ELSE IF I = 15 IF COMP2 = 13 PERFORM CR-MOVE
                      ELSE IF COMP2 = 10 PERFORM LF-MOVE
                        ELSE PERFORM COMP2-MOVE
                 ELSE PERFORM COMP2-MOVE.
       COMP1-MOVE.
           PERFORM CNTL-MOVE   ADD 64 TO COMP1.
           MOVE C2 TO ALPHA-TEMP-BYTE (I J).
       COMP2-MOVE.
           PERFORM CNTL-MOVE   ADD 64 TO COMP2.
           MOVE C4 TO ALPHA-TEMP-BYTE (I J).
       LNCO-MOVE.
           IF NUM-TEMP-AREA (4) > NUM-TEMP-AREA (5)
               IF C < NUM-TEMP-AREA (4)
                   PERFORM CO-MOVE ELSE PERFORM LN-MOVE
             ELSE IF C < NUM-TEMP-AREA (5)
                      PERFORM LN-MOVE ELSE PERFORM CO-MOVE.
       LN-MOVE.
           MOVE "L" TO ALPHA-TEMP-BYTE (I J) ADD 1 TO J.
           MOVE "N" TO ALPHA-TEMP-BYTE (I J).
       CO-MOVE.
           MOVE "C" TO ALPHA-TEMP-BYTE (I J) ADD 1 TO J.
           MOVE "O" TO ALPHA-TEMP-BYTE (I J).
      /
       UPDT-TERM-LOOP.
           ADD 1 TO J.
           ADD 1 TO L   IF L = 22 MOVE 6 TO L.
           IF L = 5 MOVE 21 TO L.
           IF J > 16 MOVE 57 TO P ELSE MOVE 22 TO P.
           IF J < 8
               IF J = 3 PERFORM UPDT-TERM-COND
                 ELSE PERFORM UPDT-TERM-NUM
             ELSE IF J = 11 OR J = 12 PERFORM UPDT-TERM-COND
               ELSE IF J = 32 PERFORM UPDT-TERM-NUM
                 ELSE PERFORM UPDT-TERM-ALPHA.
       DISP-TO-TERM-REC.
           MOVE LOW-VALUES TO TERM-DATA.
           MOVE 0 TO P   PERFORM FLIP-WORD 2 TIMES.
           MOVE 7 TO P   MOVE 2 TO L   MOVE 5 TO N.
           PERFORM CNV-CNTL-WORDS 3 TIMES.
           MOVE 3 TO P   MOVE 1 TO L.
           PERFORM COND-MOVE   PERFORM NUM-MOVE 4 TIMES.
           MOVE 11 TO P   MOVE 9 TO L.
           PERFORM COND-MOVE 2 TIMES.
           MOVE 1 TO P   MOVE 2 TO L   MOVE 3 TO N.
           PERFORM FORM-DEF-WORD 5 TIMES.
           MOVE 12 TO P   MOVE 0 TO Q   PERFORM CNV-CNTL-SEQ 18 TIMES.
           MOVE LOW-VALUES TO COMP1-TEMP-AREA MOVE 0 TO M MOVE 1 TO L.
           MOVE ALPHA-TEMP-BYTE (31 1) TO NUM   MOVE 31 TO P.
           PERFORM CNV-CNTL-ENTRY NUM TIMES   MOVE NUM TO COMP1.
           MOVE C2 TO FC-BYTE (17)   MOVE 0 TO M   MOVE 0 TO L.
           PERFORM FORM-FC-SEQ 16 TIMES.
           MOVE NUM-TEMP-AREA (32) TO COMP1 MOVE C2 TO FC-BYTE (18).
       FORM-FC-SEQ.
           ADD 1 TO M ADD 1 TO L MOVE COMP1-TEMP-WORD (M) TO COMP1.
           MOVE C2 TO FC-BYTE (L).
       FLIP-WORD.
           ADD 1 TO P   MOVE NUM-TEMP-AREA (P) TO COMP3.
           MOVE C3 TO C5   MOVE C1 TO C3   MOVE C5 TO C1.
           MOVE COMP3 TO CRT-DEF-WORD (P).
       CNV-CNTL-WORDS.
           ADD 1 TO P MOVE ALPHA-TEMP-AREA (P) TO DEL.
           IF DEL = "DEL" MOVE 127 TO COMP1 ELSE PERFORM CNV-CNTL-CHAR.
           ADD 1 TO N   MOVE COMP1 TO COMP1-TEMP-WORD (N).
       COND-MOVE.
           MOVE COND-TEMP-AREA (P) TO COMP1-TEMP-WORD (L).
           ADD 1 TO P   ADD 1 TO L.
       NUM-MOVE.
           MOVE NUM-TEMP-AREA (P) TO COMP1-TEMP-WORD (L).
           ADD 1 TO P   ADD 1 TO L.
       FORM-DEF-WORD.
           COMPUTE CRT-DEF-WORD (N) =
               (COMP1-TEMP-WORD (P) * 256) + COMP1-TEMP-WORD (L).
           ADD 2 TO P   ADD 2 TO L   ADD 1 TO N.
      /
       CNV-CNTL-SEQ.
           MOVE LOW-VALUES TO COMP1-TEMP-AREA.
           ADD 1 TO P   MOVE 1 TO M   MOVE 1 TO L.
           MOVE ALPHA-TEMP-BYTE (P 1) TO N.
           MOVE N TO COMP1-TEMP-WORD (1).
           PERFORM CNV-CNTL-ENTRY N TIMES.
           COMPUTE M ROUNDED = (N + 1) / 2.
           MOVE 1 TO O   MOVE 2 TO L   ADD 1 Q GIVING C.
           PERFORM FORM-SEQ-WORD M TIMES.
           IF P = 13 ADD 2 TO Q.   ADD 6 TO Q.
       FORM-SEQ-WORD.
           COMPUTE WORK-WORD (1) =
               (COMP1-TEMP-WORD (O) * 256) + COMP1-TEMP-WORD (L).
           PERFORM FIX-WW1   MOVE WORK-WORD (1) TO CNTL-SEQ-WORD (C).
           ADD 2 TO O   ADD 2 TO L   ADD 1 TO C.
       UPDT-TERM-NUM.
           ACCEPT NUM-TEMP-AREA (J) LINE L POSITION P CONVERT ECHO TAB
               UPDATE ON EXCEPTION EXCPT-CHAR PERFORM J-BACK-TAB.
           IF J = 4 OR J = 5 OR J = 32
               IF NUM-TEMP-AREA (J) > 9 PERFORM UE-M2
                 ELSE PERFORM UC-OFST
             ELSE IF NUM-TEMP-AREA (J) > 255 PERFORM UE-M2.
       UPDT-TERM-ALPHA.
           ACCEPT ALPHA-TEMP-AREA (J) LINE L POSITION P UPDATE TAB
               ON EXCEPTION EXCPT-CHAR PERFORM J-BACK-TAB.
           IF ALPHA-TEMP-AREA (J) = SPACES
               MOVE 3 TO E PERFORM UPDT-TERM-ERROR.
           IF J < 11 PERFORM UE-TDEL ELSE PERFORM UE-CSEQ.
       UPDT-TERM-COND.
           ACCEPT ALPHA-COND (J) LINE L POSITION P TAB
               UPDATE ON EXCEPTION EXCPT-CHAR PERFORM J-BACK-TAB.
           IF ALPHA-COND (J) = "Y" OR ALPHA-COND (J) = "y"
               MOVE 1  TO COND-TEMP-AREA (J)
             ELSE IF ALPHA-COND (J) = "N" OR ALPHA-COND (J) = "n"
                 MOVE 0 TO COND-TEMP-AREA (J)
               ELSE MOVE 4 TO E PERFORM UPDT-TERM-ERROR.
       UPDT-TERM-ERROR.
           PERFORM ERROR-PARA   SUBTRACT 1 FROM L.
           SUBTRACT 1 FROM J   GO TO UPDT-LOOP-1.
       UE-TDEL.
           MOVE ALPHA-TEMP-AREA (J) TO DEL.
           IF DEL NOT = "DEL" PERFORM UE-TCNTL.
       UE-TCNTL.
           PERFORM C1-FILL   MOVE ALPHA-TEMP-BYTE (J 2) TO C2.
           IF ALPHA-TEMP-BYTE (J 1) NOT = "^"
             OR COMP1 < 64 OR COMP1 > 95 MOVE 10 TO E
                 PERFORM UPDT-TERM-ERROR.
       UE-CSEQ.
           PERFORM C1-FILL   MOVE ALPHA-TEMP-BYTE (J 1) TO C2.
           IF COMP1 > 57 MOVE 13 TO E PERFORM UPDT-TERM-ERROR.
       UE-M2.
           MOVE 2 TO E PERFORM UPDT-TERM-ERROR.
       UC-OFST.
           IF NUM-TEMP-AREA (4) = NUM-TEMP-AREA (5)
               MOVE 14 TO E PERFORM UPDT-TERM-ERROR.
      /
       J-BACK-TAB.
           IF J = 1 MOVE 1 TO E PERFORM UPDT-TERM-ERROR.
           IF EXCPT-CHAR = 02
               SUBTRACT 2 FROM J    SUBTRACT 2 FROM L
               GO TO UPDT-LOOP-1
             ELSE IF EXCPT-CHAR = 98 NEXT SENTENCE
               ELSE MOVE 1 TO E PERFORM UPDT-TERM-ERROR.
      *
       SUB-1-2.
           PERFORM TITLE.
           DISPLAY "Enter New Terminal Type (up to 8 characters) "
               LINE 3 POSITION 5.
           ACCEPT TERM-TYPE POSITION 0 TAB.
           IF TERM-TYPE = SPACES GO TO PARA-1
             ELSE IF TERM-TYPE = "ALL     " MOVE 19 TO E
                 PERFORM ERROR-DA GO TO SUB-1-2.
           OPEN I-O TERM-FILE.
           READ TERM-FILE INVALID KEY GO TO ACPT-TERM.
           CLOSE TERM-FILE   PERFORM ALREADY-EXISTS.
           GO TO SUB-1-2.
       ACPT-TERM.
           MOVE TERM-TYPE TO KEY-SAVE.
           DISPLAY "Enter Model Name (up to 8 characters)    "
               LINE 4 POSITION 5 ERASE EOL.
           ACCEPT TERM-TYPE POSITION 0 TAB.
           IF TERM-TYPE = SPACES MOVE "DUMB    " TO TERM-TYPE
               DISPLAY TERM-TYPE LINE 4 POSITION 46
             ELSE IF TERM-TYPE = "ALL     " MOVE 19 TO E
                 PERFORM ERROR-PARA GO TO ACPT-TERM.
           READ TERM-FILE INVALID KEY PERFORM FND-TERM.
           PERFORM DISP-TERM-INFO THRU TERM-REC-TO-DISP.
           PERFORM B-TAB-DISP   MOVE KEY-SAVE TO TERM-TYPE.
           MOVE 5 TO L   MOVE 0 TO J   PERFORM UPDT-LOOP-1.
       CHECK-TERM-ACPT.
           PERFORM CHECK-PAGE.
           IF R = "N" OR R = "n" MOVE 0 TO J MOVE 5 TO L
               PERFORM UPDT-LOOP-1   GO TO CHECK-TERM-ACPT
             ELSE IF R = "E" OR R = "e" CLOSE TERM-FILE GO TO PARA-1.
           PERFORM WRITE-MESSAGE   PERFORM DISP-TO-TERM-REC.
           WRITE TERM-REC   PERFORM WRITTEN-MESSAGE.
           PERFORM TERM-LOOP.
      /
       SEG-52 SECTION 52.
       PARA-2.
           PERFORM TITLE.
           DISPLAY "Configuration Menu" LINE 4 POSITION 5
               "1.  View/Change Configuration Table Entry" POSITION 10
               "2.  Add New Configuration Table Entry" POSITION 10.
           PERFORM DISP-RTN   PERFORM DISP-EXIT.
       ACPT-2.
           MOVE 3 TO D   PERFORM ACPT-N.
           GO TO SUB-2-1, SUB-2-2, TITLE, STOP-PARA DEPENDING ON N.
       SUB-2-1.
           MOVE 0 TO CONFIG-FLG   PERFORM TITLE.
           DISPLAY "Enter Configuration Name (up to 8 characters) "
               LINE 4 POSITION 5.
           ACCEPT CONFIG-NAME POSITION 0 TAB.
           IF CONFIG-NAME = SPACES
               IF D = 3 GO TO PARA-2 ELSE GO TO PARA-3.
           OPEN I-O CONFIG-FILE   MOVE 0 TO I   MOVE 0 TO J.
           READ CONFIG-FILE NEXT RECORD.
           IF CONFIG-NAME = "ALL     "
               PERFORM READ-CONFIG UNTIL I = 2 GO TO DISP-ALL-CONFIGS
             ELSE PERFORM READ-CONFIG UNTIL I NOT = 0.
           IF I = 2 PERFORM NOT-FOUND CLOSE CONFIG-FILE GO TO SUB-2-1.
       DISP-CONFIG-INFO.
           DISPLAY "Printer:" LINE 6 "1. Col/Page" POSITION 2
           "2. Lines/Page" POSITION 2 "3. Auto Lf" POSITION 2
           "4. Form Feed" POSITION 2 "Disk Map:" LINE 12 POSITION 1
           "1. Disk Map" POSITION 2 "2. Sys Config" POSITION 2
           "3. OpSys Flag" POSITION 2 "4. Mode Type" POSITION 2
           "5. Dflt Mode" POSITION 2 "6. Cancel Key" POSITION 2
           "Terminal Type:" LINE 6 POSITION 41
           "Tab Table:" LINE 8 POSITION 41
           "Linkage Definition:" LINE 11 POSITION 41
           "1. Link Addr" POSITION 42 "2. Drive Spec" POSITION 42
           "3. HEX Filename" POSITION 42 "4. FKey Addr" POSITION 42
           "5. Time Addr" POSITION 42
           "Maximum Values:" LINE 18 POSITION 41
           "1. Max ASCII" POSITION 42 "2. Max FKey" POSITION 42
           "Spare Area (for future expansion)" LINE 20 POSITION 1.
       CONFIG-REC-TO-DISP.
           MOVE SPACES TO TEMP-STORAGE MOVE 1 TO I PERFORM SET-WW1.
           DIVIDE WORK-WORD (1) BY 256 GIVING NUM-TEMP-AREA (1)
               REMAINDER NUM-TEMP-AREA (2).
           MOVE 2 TO I PERFORM SET-WW1 DIVIDE WORK-WORD (1) BY 256
               GIVING COND-TEMP-AREA (3) REMAINDER COND-TEMP-AREA (4).
           MOVE 3 TO I PERFORM CA-MOVE 2 TIMES MOVE 3 TO I.
           MOVE 1 TO J MOVE 0 TO L MOVE SPACES TO TAB-TABLE.
           PERFORM SET-TAB-TABLE UNTIL L = 1.
           MOVE TAB-1 TO ALPHA-TEMP-AREA (12).
           MOVE TERM-NAME TO ALPHA-TEMP-AREA (11).
           MOVE DISK-MAP TO DISK-TEMP MOVE 0 TO I MOVE 0 TO J.
           PERFORM SET-DISK-MAP UNTIL I = 1.
           MOVE WORD2 (9) TO NUM-TEMP-AREA (6).
      /
           MOVE 7 TO I IF WORD2 (10) > 255 MOVE 1 TO COND-TEMP-AREA (I)
               ELSE MOVE 0 TO COND-TEMP-AREA (I).
           PERFORM CA-MOVE   ADD WORD2 (11) 12288 GIVING COMP3.
           MOVE DISK-BYTE (20) TO ALPHA-TEMP-BYTE (8 1).
           MOVE 0 TO COMP1 MOVE C1 TO NUM-TEMP-AREA (9) MOVE C3 TO C2.
           IF COMP1 = 127 MOVE 10 TO I MOVE 1 TO J PERFORM CNV-DEL
             ELSE IF COMP1 = 0 MOVE "0" TO ALPHA-TEMP-BYTE (10 1)
               ELSE MOVE "^" TO ALPHA-TEMP-BYTE (10 1)
                 ADD 64 TO COMP1 MOVE C2 TO ALPHA-TEMP-BYTE (10 2).
           MOVE 4 TO I   MOVE 13 TO A   PERFORM ADDR-CHECK.
           MOVE 21 TO I   MOVE 16 TO A   PERFORM ADDR-CHECK.
           MOVE 1 TO I   MOVE 17 TO A   PERFORM ADDR-CHECK.
           DIVIDE WORD3 (5) BY 256 GIVING NUM-TEMP-AREA (14).
           MOVE LNK-FUNC TO LNK-TBL.
           MOVE HF-NAME TO ALPHA-TEMP-AREA (15)   MOVE 11 TO I.
           PERFORM SET-WW3 MOVE 18 TO A MOVE 0 TO B MOVE 0 TO C.
           PERFORM SET-LNK-HEX 2 TIMES.
           MOVE 20 TO I PERFORM SET-WW3 MOVE 19 TO A MOVE 0 TO B.
           MOVE 0 TO C PERFORM SET-LNK-HEX 2 TIMES MOVE 0 TO B.
           PERFORM SET-LNK-HEX 2 TIMES   MOVE 0 TO A.
           MOVE TERM-INFO-3 TO SPARE-WORDS.
           MOVE 0 TO B PERFORM SET-SPARE-WORD 7 TIMES MOVE 0 TO A.
           PERFORM DISP-CONFIG-VALUES 19 TIMES   MOVE 0 TO A.
           DISPLAY SPARE-AREA LINE 21 POSITION 5.
       CHECK-CONFIG-UPDT.
           PERFORM CHECK-PAGE.
           IF R = "N" OR R = "n" MOVE 0 TO B PERFORM B-TAB-DISP
             ELSE IF R = "Y" OR R = "y" GO TO REWRITE-CONFIG
               ELSE CLOSE CONFIG-FILE GO TO PARA-2.
       UPDT-LOOP-2.
           PERFORM UPDT-CONFIG-LOOP UNTIL B = 20.
       UPDT-CHECK-2.
           MOVE 1 TO CONFIG-FLG   GO TO CHECK-CONFIG-UPDT.
       REWRITE-CONFIG.
           IF CONFIG-FLG = 1 PERFORM REWRITE-MESSAGE
               PERFORM DISP-TO-CONFIG-REC
               MOVE CONFIG-NAME TO CONFIG-KEY
               MOVE "USED" TO CONFIG-REC-USED
               REWRITE CONFIG-REC
               PERFORM REWRITTEN-MESSAGE.
       CONFIG-LOOP.
           CLOSE CONFIG-FILE   PERFORM RETURN-PARA   GO TO PARA-2.
      *
       ADDR-CHECK.
           PERFORM FLIP-WORD   PERFORM WW1-CHECK.
           IF WORK-WORD (1) NOT = 1 MOVE 0 TO B MOVE 0 TO C
               PERFORM SET-LNK-HEX 4 TIMES.
       SET-SPARE-WORD.
           ADD 1 TO A MOVE 0 TO C MOVE SPARE-WORD (A) TO WORK-WORD (1).
           PERFORM WW1-CHECK   PERFORM SET-SPARE-HEX 4 TIMES.
       SET-SPARE-HEX.
           PERFORM SET-HEX-VALUE MOVE HEX-VALUE (E) TO SPARE-CHAR (B).
       READ-CONFIG.
           IF CONFIG-NAME = CONFIG-KEY AND
            ( CONFIG-REC-USED = "USED" OR CONFIG-KEY = "DEFAULT" )
            MOVE 1 TO I.
           IF CONFIG-REC-USED = "USED" OR CONFIG-KEY = "DEFAULT"
               ADD 1 TO J  MOVE CONFIG-KEY TO CONFIG-DISP (J).
           IF I = 0 READ CONFIG-FILE NEXT RECORD AT END MOVE 2 TO I.
      /
       SET-WW1.
           MOVE WORD1 (I) TO WORK-WORD (1) PERFORM WW1-CHECK.
       SET-WW3.
           MOVE WORD3 (I) TO WORK-WORD (1) PERFORM WW1-CHECK.
       CA-MOVE.
           IF COND-TEMP-AREA (I) = 1 MOVE "Y" TO ALPHA-COND (I)
             ELSE MOVE "N" TO ALPHA-COND (I).   ADD 1 TO I.
       SET-TAB-TABLE.
           PERFORM SET-WW1.
           DIVIDE WORK-WORD (1) BY 256 GIVING A REMAINDER B.
           IF A = 0 MOVE 1 TO L SUBTRACT 1 FROM J
               MOVE " " TO TAB-BYTE (J)
             ELSE IF B = 0 PERFORM A-MOVE MOVE 1 TO L
               ELSE PERFORM A-MOVE PERFORM C-MOVE PERFORM B-MOVE
                   PERFORM C-MOVE ADD 1 TO I.
       A-MOVE.
           IF A1 > 0 MOVE A1 TO TAB-BYTE (J) ADD 1 TO J. 
           MOVE A2 TO TAB-BYTE (J)   ADD 1 TO J.
       B-MOVE.
           IF B1 > 0 MOVE B1 TO TAB-BYTE (J) ADD 1 TO J.
           MOVE B2 TO TAB-BYTE (J)   ADD 1 TO J.
       C-MOVE.
           MOVE "," TO TAB-BYTE (J)   ADD 1 TO J.
       SET-DISK-MAP.
           ADD 1 TO J IF DISK-BYTE (J) = LOW-VALUES MOVE 1 TO I
             ELSE MOVE DISK-BYTE (J) TO ALPHA-TEMP-BYTE (5 J).
       DISP-CONFIG-VALUES.
           ADD 1 TO A IF A > 10 MOVE 59 TO P ELSE MOVE 21 TO P.
           IF A < 3 PERFORM DISP-NUM
             ELSE IF A < 8
                 IF A = 5 PERFORM DISP-ALPHA
                   ELSE IF A = 6 PERFORM DISP-NUM
                     ELSE PERFORM DISP-COND
               ELSE IF A = 9 OR A = 14
                   PERFORM DISP-NUM ELSE PERFORM DISP-ALPHA.
       DISP-NUM.
           DISPLAY NUM-TEMP-AREA (A) LINE LN (A) POSITION P.
       DISP-ALPHA.
           DISPLAY ALPHA-TEMP-AREA (A) LINE LN (A) POSITION P.
           IF A = 12 DISPLAY TAB-2 LINE 9 POSITION 43.
       DISP-COND.
           DISPLAY ALPHA-COND (A) LINE LN (A) POSITION P.
       FLIP-WORD.
           MOVE WORD3 (I) TO COMP3   MOVE C3 TO C5 MOVE C1 TO C3.
           MOVE C5 TO C1   MOVE COMP3 TO WORK-WORD (1).
       DISP-ALL-CONFIGS.
           PERFORM TITLE   DISPLAY " " LINE 3   MOVE 0 TO I.
           PERFORM DISP-NAMES J TIMES   DISPLAY " " LINE 23.
           PERFORM RETURN-PARA   CLOSE CONFIG-FILE   GO TO PARA-2.
       DISP-NAMES.
           ADD 1 TO I   DISPLAY CONFIG-DISP (I) POSITION 9.
      /
       UPDT-CONFIG-LOOP.
           ADD 1 TO B.
           IF B > 10 MOVE 59 TO P ELSE MOVE 21 TO P.
           IF B < 3 PERFORM UPDT-CONFIG-NUM PERFORM UE-255
             ELSE IF B < 8 
               IF B = 5 PERFORM UPDT-CONFIG-ALPHA PERFORM UE-DMAP
                 ELSE IF B = 6 PERFORM UPDT-CONFIG-NUM
                     PERFORM UE-2
                   ELSE PERFORM UPDT-CONFIG-COND
               ELSE IF B = 9 OR B = 14
                   PERFORM UPDT-CONFIG-NUM PERFORM UE-16
                 ELSE IF B = 13 OR B = 16 OR B = 17
                     PERFORM UPDT-CONFIG-ADDR
                   ELSE IF B = 20 PERFORM UPDT-SPARE
                     ELSE PERFORM UPDT-CONFIG-ALPHA
                       IF B = 18 OR B = 19 MOVE 3 TO N PERFORM UE-HEX
                         ELSE IF B = 12 PERFORM UE-TAB
                           ELSE IF B = 11 PERFORM UE-TERM
                             ELSE IF B = 8 PERFORM UE-MODE
                               ELSE IF B = 10 PERFORM UE-DEL
                                 ELSE IF B = 15 PERFORM UE-FILE.
       UE-255.
           IF NUM-TEMP-AREA (B) > 255 PERFORM UE-E2.
       UE-2.
           IF NUM-TEMP-AREA (B) > 2 PERFORM UE-E2.
       UE-16.
           IF NUM-TEMP-AREA (B) > 16 PERFORM UE-E2.
       UE-9.
           IF NUM-TEMP-AREA (B) > 9 PERFORM UE-E2.
       UE-E2.
           MOVE 2 TO E PERFORM UPDT-CONFIG-ERROR.
       UE-HEX.
           MOVE 0 TO I MOVE 0 TO J PERFORM UE-HCHECK UNTIL I = 1.
           IF J > N MOVE 7 TO E PERFORM UPDT-CONFIG-ERROR.
           IF J < N MOVE 6 TO E PERFORM UPDT-CONFIG-ERROR.
       UE-HCHECK.
           PERFORM BJ-MOVE IF COMP1 = 32 MOVE 1 TO I
             ELSE IF COMP1 > 57 AND COMP1 < 65 OR COMP1 > 70
                 MOVE 5 TO E PERFORM UPDT-CONFIG-ERROR.
           IF J = 6 MOVE 1 TO I.
       BJ-MOVE.
           PERFORM C1-FILL ADD 1 TO J MOVE ALPHA-TEMP-BYTE (B J) TO C2.
       UE-TAB.
           MOVE ALPHA-TEMP-AREA (12) TO TAB-1.
           MOVE 0 TO I MOVE 0 TO J PERFORM UE-TCHECK UNTIL I = 1.
       UE-TCHECK.
           PERFORM C1-FILL ADD 1 TO J MOVE TAB-BYTE (J) TO C2.
           IF COMP1 = 32 MOVE 1 TO I
             ELSE IF COMP1 > 57 AND COMP1 NOT = 44 MOVE 11 TO E
                 PERFORM UPDT-CONFIG-ERROR. IF J = 48 MOVE 1 TO I.
       TERM-MOVE.
           MOVE ALPHA-TEMP-AREA (11) TO TERM-NAME.
           MOVE TERM-NAME TO TERM-TYPE.
      /
       UE-TERM.
           PERFORM TERM-MOVE   PERFORM CHECK-MESSAGE.
           OPEN INPUT TERM-FILE   READ TERM-FILE INVALID KEY
               PERFORM NOT-FOUND SUBTRACT 1 FROM B
               PERFORM ERASE-MESSAGE
               CLOSE TERM-FILE   GO TO UPDT-LOOP-2.
           PERFORM ERASE-MESSAGE   CLOSE TERM-FILE.
       UE-DMAP.
           MOVE 0 TO I MOVE 0 TO J PERFORM UE-DCHECK UNTIL I = 1.
       UE-DCHECK.
           PERFORM BJ-MOVE IF COMP1 = 32 MOVE 1 TO I
             ELSE IF COMP1 < 65 OR COMP1 > 80 MOVE 8 TO E
                 PERFORM UPDT-CONFIG-ERROR.
           IF J = 16 MOVE 1 TO I.
       UE-MODE.
           IF ALPHA-TEMP-BYTE (8 1) NOT = "R" AND
               ALPHA-TEMP-BYTE (8 1) NOT = "A" MOVE 9 TO E
                   PERFORM UPDT-CONFIG-ERROR.
       UE-DEL.
           PERFORM DEL-MOVE IF DEL NOT = "DEL" PERFORM UE-CNTL.
       DEL-MOVE.
           MOVE ALPHA-TEMP-AREA (10) TO DEL.
       UE-CNTL.
           PERFORM C1-FILL MOVE ALPHA-TEMP-BYTE (10 2) TO C2.
           IF ALPHA-TEMP-BYTE (10 1) NOT = "0"
             IF ALPHA-TEMP-BYTE (10 1) NOT = "^"
             OR COMP1 < 64 OR COMP1 > 95 MOVE 10 TO E
                 PERFORM UPDT-CONFIG-ERROR.
       UE-FILE.
           MOVE 0 TO I MOVE 0 TO J PERFORM UE-FCHECK UNTIL I = 1.
       UE-FCHECK.
           PERFORM BJ-MOVE IF COMP1 = 32 PERFORM UE-ECHECK
             ELSE IF COMP1 > 90 OR COMP1 > 57 AND
                 COMP1 < 65 MOVE 12 TO E PERFORM UPDT-CONFIG-ERROR.
           IF J = 13 MOVE 7 TO E PERFORM UPDT-CONFIG-ERROR.
       UE-ECHECK.
           IF J = 12 MOVE 1 TO I.
      *
       DISP-TO-CONFIG-REC.
           MOVE LOW-VALUES TO CONFIG-REC COMPUTE WORK-WORD (1) =
               (NUM-TEMP-AREA (1) * 256) + NUM-TEMP-AREA (2).
           MOVE 1 TO I   PERFORM FIX-WW1   PERFORM MOVE-WW1.
           PERFORM TERM-MOVE   COMPUTE WORK-WORD (1) =
               (COND-TEMP-AREA (3) * 256) + COND-TEMP-AREA (4).
           PERFORM FIX-WW1 PERFORM MOVE-WW1 MOVE 0 TO I MOVE 2 TO O.
           MOVE 0 TO N MOVE 0 TO J PERFORM CNV-TAB-TABLE UNTIL I = 1.
           MOVE LOW-VALUES TO FC-TBL   MOVE FC-KEY-SEQ TO FC-SEQ.
           MOVE FC-TBL TO LNK-FUNC   MOVE TERM-DATA TO TERM-INFO.
           MOVE 0 TO I MOVE 0 TO J MOVE LOW-VALUES TO DISK-TEMP.
           PERFORM CNV-DISK-MAP UNTIL I = 1 MOVE DISK-TEMP TO DISK-MAP.
           ADD NUM-TEMP-AREA (6) TO WORD2 (9).
           MULTIPLY COND-TEMP-AREA (7) BY 256 GIVING WORD2 (10).
           PERFORM C1-FILL   MOVE ALPHA-TEMP-BYTE (8 1) TO C2.
           ADD COMP1 TO WORD2 (10).
      /
           PERFORM DEL-MOVE IF DEL = "DEL" MOVE 127 TO COMP1
             ELSE IF ALPHA-TEMP-BYTE (10 1) = "0" MOVE 0 TO COMP1
               ELSE MOVE ALPHA-TEMP-BYTE (10 2) TO C2
                   PERFORM C1-FILL SUBTRACT 64 FROM COMP1.
           COMPUTE WORD2 (11) = COMP1 + (NUM-TEMP-AREA (9) * 256).
           MOVE 4 TO I   MOVE 13 TO A   PERFORM ADDR-STORE.
           MOVE 21 TO I   MOVE 16 TO A   PERFORM ADDR-STORE.
           MOVE 1 TO I   MOVE 17 TO A   PERFORM ADDR-STORE.
           MULTIPLY NUM-TEMP-AREA (14) BY 256 GIVING WORD3 (5).
           MOVE LNK-FUNC TO LNK-TBL   MOVE ALPHA-TEMP-AREA (15)
               TO HF-NAME   MOVE LNK-TBL TO LNK-FUNC.
           MOVE 18 TO A MOVE 0 TO B MOVE 0 TO C MOVE 11 TO I.
           PERFORM CNV-LNK-HEX 2 TIMES.
           MOVE 19 TO A MOVE 0 TO B MOVE 2 TO C MOVE 20 TO I.
           PERFORM CNV-LNK-HEX 2 TIMES   MOVE 0 TO B.
           MOVE 0 TO A   PERFORM CNV-SPARE-WORD 7 TIMES.
           MOVE SPARE-WORDS TO TERM-INFO-3.
      *
       MOVE-WW1.
           MOVE WORK-WORD (1) TO WORD1 (I)   ADD 1 TO I.
       CNV-TAB-TABLE.
           MOVE ZEROES TO TAB-BUFFER   MOVE 0 TO A.
           MOVE 0 TO L   PERFORM GET-TAB UNTIL A = 1.
           IF L = 1 DIVIDE 10 INTO TAB-NUM.
           IF N = 0 ADD 1 TO O MULTIPLY TAB-NUM BY 256 GIVING WORD1 (O)
             ELSE ADD TAB-NUM TO WORD1 (O).
           ADD 1 TO N   IF N = 2 MOVE 0 TO N.
       GET-TAB.
           PERFORM C1-FILL   ADD 1 TO J   MOVE TAB-BYTE (J) TO C2.
           IF COMP1 = 32 MOVE 1 TO A MOVE 1 TO I.
           IF COMP1 = 44 MOVE 1 TO A.
           IF A = 0 AND I = 0 ADD 1 TO L
               MOVE TAB-BYTE (J) TO TAB-BUF (L).
           IF J = 48 MOVE 1 TO A MOVE 1 TO I.
       CNV-DISK-MAP.
           ADD 1 TO J   IF ALPHA-TEMP-BYTE (5 J) = " "
               MOVE 1 TO I
             ELSE MOVE ALPHA-TEMP-BYTE (5 J) TO DISK-BYTE (J).
           IF J = 16 MOVE 1 TO I.
       CNV-LNK-HEX.
           PERFORM CNV-HEX   ADD WORK-WORD (1) TO WORD3 (I).
       ADDR-STORE.
           IF ALPHA-TEMP-AREA (A) = SPACES MOVE 256 TO WORD3 (I)
             ELSE MOVE 0 TO B MOVE 0 TO C MOVE 0 TO WORD3 (I)
                 PERFORM CNV-LNK-HEX 4 TIMES PERFORM FLIP-WORD
                 MOVE WORK-WORD (1) TO WORD3 (I).
       CNV-SPARE-WORD.
           ADD 1 TO A   MOVE 0 TO SPARE-WORD (A).
           MOVE 0 TO C   PERFORM CNV-SPARE-HEX 4 TIMES.
       CNV-SPARE-HEX.
           ADD 1 TO B   MOVE SPARE-CHAR (B) TO C4.
           PERFORM CNV-HEX-VALUE ADD WORK-WORD (1) TO SPARE-WORD (A).
      /
       UPDT-CONFIG-NUM.
           ACCEPT NUM-TEMP-AREA (B) LINE LN (B) POSITION P CONVERT ECHO
               TAB UPDATE ON EXCEPTION EXCPT-CHAR PERFORM B-BACK-TAB.
       UPDT-ALPHA.
           ACCEPT ALPHA-TEMP-AREA (B) LINE LN (B) POSITION P TAB UPDATE
               ON EXCEPTION EXCPT-CHAR PERFORM B-BACK-TAB.
       UPDT-CONFIG-ALPHA.
           PERFORM UPDT-ALPHA.
           IF ALPHA-TEMP-AREA (B) = SPACES MOVE 3 TO E
               PERFORM UPDT-CONFIG-ERROR.
           IF B = 12 ACCEPT TAB-2 LINE 9 POSITION 43 UPDATE TAB.
       UPDT-CONFIG-ADDR.
           PERFORM UPDT-ALPHA.
           IF ALPHA-TEMP-AREA (B) NOT = SPACES
               MOVE 5 TO N PERFORM UE-HEX.
       UPDT-CONFIG-COND.
           ACCEPT ALPHA-COND (B) LINE LN (B) POSITION P TAB
               UPDATE ON EXCEPTION EXCPT-CHAR PERFORM B-BACK-TAB.
           IF ALPHA-COND (B) = "Y" OR ALPHA-COND (B) = "y"
               MOVE 1 TO COND-TEMP-AREA (B)
             ELSE IF ALPHA-COND (B) = "N" OR ALPHA-COND (B)  = "n"
                 MOVE 0 TO COND-TEMP-AREA (B)
               ELSE MOVE 4 TO E PERFORM UPDT-CONFIG-ERROR.
       UPDT-SPARE.
           ACCEPT SPARE-AREA LINE 21 POSITION 5 TAB
               UPDATE ON EXCEPTION EXCPT-CHAR PERFORM B-BACK-TAB.
           IF SPARE-AREA = SPACES
               MOVE 3 TO E PERFORM UPDT-CONFIG-ERROR.
           MOVE 0 TO E   PERFORM UE-SPARE 28 TIMES.
       UE-SPARE.
           ADD 1 TO E   IF SPARE-CHAR (E) = SPACE
               MOVE 5 TO E PERFORM UPDT-CONFIG-ERROR.
           PERFORM C1-FILL   MOVE SPARE-CHAR (E) TO C2.
           IF COMP1 > 70 OR COMP1 < 48 OR COMP1 > 57 AND COMP1 < 65
               MOVE 5 TO E PERFORM UPDT-CONFIG-ERROR.
       UPDT-CONFIG-ERROR.
           PERFORM ERROR-PARA.
           SUBTRACT 1 FROM B.
           GO TO UPDT-LOOP-2.
       B-BACK-TAB.
           IF B = 1 MOVE 1 TO E PERFORM UPDT-CONFIG-ERROR.
           IF EXCPT-CHAR = 02
               SUBTRACT 2 FROM B
               GO TO UPDT-LOOP-2
             ELSE IF EXCPT-CHAR = 98 NEXT SENTENCE
               ELSE MOVE 1 TO E PERFORM UPDT-CONFIG-ERROR.
      /
       SUB-2-2.
           PERFORM TITLE.
           DISPLAY "Enter New Configuration Name (up to 8 characters) "
               LINE 3 POSITION 5.
           ACCEPT CONFIG-NAME POSITION 0 TAB.
           IF CONFIG-NAME = SPACES GO TO PARA-2
             ELSE IF CONFIG-NAME = "ALL     " MOVE 19 TO E
                 PERFORM ERROR-DA GO TO SUB-2-2.
           OPEN I-O CONFIG-FILE   MOVE CONFIG-NAME TO KEY-SAVE.
           MOVE 0 TO I J   READ CONFIG-FILE NEXT RECORD.
           PERFORM READ-CONFIG UNTIL I NOT = 0   CLOSE CONFIG-FILE.
           IF I = 1 PERFORM ALREADY-EXISTS GO TO SUB-2-2.
       ACPT-CONFIG.
           DISPLAY "Enter Model Name (up to 8 characters) "
               LINE 4 POSITION 5 ERASE EOL.
           ACCEPT CONFIG-NAME POSITION 0 TAB.
           IF CONFIG-NAME = SPACES MOVE "DEFAULT " TO CONFIG-NAME
               DISPLAY CONFIG-NAME LINE 4 POSITION 43
             ELSE IF CONFIG-NAME = "ALL     " MOVE 19 TO E
                 PERFORM ERROR-PARA GO TO ACPT-CONFIG.
           OPEN I-O CONFIG-FILE   READ CONFIG-FILE NEXT RECORD.
           MOVE 0 TO I J   PERFORM READ-CONFIG UNTIL I NOT = 0.
           IF I = 2 MOVE 15 TO E PERFORM ERROR-PARA
               CLOSE CONFIG-FILE   GO TO ACPT-CONFIG.
           PERFORM DISP-CONFIG-INFO THRU CONFIG-REC-TO-DISP.
           PERFORM B-TAB-DISP   MOVE 0 TO B   PERFORM UPDT-LOOP-2.
       CHECK-CONFIG-ACPT.
           PERFORM CHECK-PAGE.
           IF R = "N" OR R = "n" MOVE 0 TO B
               PERFORM UPDT-LOOP-2 GO TO CHECK-CONFIG-ACPT
             ELSE IF R = "E" OR R = "e" CLOSE CONFIG-FILE GO TO PARA-2.
           PERFORM WRITE-MESSAGE.
           CLOSE CONFIG-FILE   OPEN I-O CONFIG-FILE.
           MOVE 0 TO I MOVE 0 TO J PERFORM FND-END UNTIL I = 1.
           MOVE J TO REL-KEY   PERFORM DISP-TO-CONFIG-REC.
           MOVE KEY-SAVE TO CONFIG-KEY.
           MOVE "USED" TO CONFIG-REC-USED.
           WRITE CONFIG-REC   PERFORM WRITTEN-MESSAGE.
           PERFORM CONFIG-LOOP.
      *
       FND-END.
           READ CONFIG-FILE NEXT RECORD AT END MOVE 1 TO I.
           ADD 1 TO J.
           IF CONFIG-REC = LOW-VALUES MOVE 1 TO I. 
           IF I NOT = 1 AND
           ( CONFIG-REC-USED NOT = "USED" AND
             CONFIG-KEY NOT = "DEFAULT" )
              MOVE J TO REL-KEY DELETE CONFIG-FILE RECORD
              MOVE 1 TO I.
      /
       PARA-3.
           PERFORM TITLE.
           DISPLAY "Patch Menu" LINE 4 POSITION 5
               "1.  Patch Runtime with existing entry" POSITION 10
               "2.  Patch Compiler with existing entry" POSITION 10.
           PERFORM DISP-RTN   PERFORM DISP-EXIT.
       ACPT-3.
           MOVE 4 TO D   PERFORM ACPT-N.
           GO TO FND-CNFG, FND-CNFG, TITLE, STOP-PARA DEPENDING ON N.
       FND-CNFG.
           PERFORM SUB-2-1 THRU CONFIG-REC-TO-DISP MOVE OS-NUM TO I.
           DISPLAY "Patching  " LINE 22 POSITION 1.
           IF N = 1 ACCEPT RUN-NAME (I) POSITION 0 UPDATE TAB SIZE 69 
               MOVE RUN-NAME (I) TO FILE-NAME
             ELSE ACCEPT RM-NAME (I) POSITION 0 UPDATE TAB SIZE 69 
                 MOVE RM-NAME (I) TO FILE-NAME.
           CLOSE CONFIG-FILE   PERFORM CHECK-PAGE.
           IF R NOT = "Y" AND R NOT = "y" GO TO FND-CNFG.
       CALL-PARA.
           PERFORM PATCH-MESSAGE.
           MOVE CONFIG-DATA-1 TO RUN-1 MOVE TERM-INFO TO RUN-2.
           MOVE CONFIG-DATA-2 TO RUN-3 MOVE DATA-REC TO DATA-BUF.
           MOVE 2 TO FUNC MOVE OS-NUM TO RTN CALL "RMCSYS.COB"
               USING FILE-NAME DATA-BUF FUNC RTN.
           IF RTN = 0 PERFORM PATCH-ERROR ELSE PERFORM PATCH-COMPLETE.
       PATCH-COMPLETE.
           DISPLAY "Patch Complete" LINE 23 POSITION 40.
           PERFORM RETURN-PARA   GO TO PARA-3.
       PATCH-ERROR.
           DISPLAY "Error during Patch " LINE 23 POSITION 40.
           PERFORM RETURN-PARA   GO TO PARA-3.
      *
       END PROGRAM.
