00001  IDENTIFICATION DIVISION.                                         11/05/98
00002  PROGRAM-ID.    DTSBU090.                                         DTSBU090
00003  AUTHOR.        MT DEPT OF LABOR/UI PROGRAMMING SECTION.             LV003
00004  DATE-WRITTEN.  SEPT 1994.                                        DTSBU090
00005  DATE-COMPILED.                                                   DTSBU090
00006      SKIP3                                                        DTSBU090
00007 ******************************************************************DTSBU090
00008 *                                                                *DTSBU090
00009 *    FUNCTION: FORMS PARAGRAPH LINES FROM WORDS OR GROUPS OF     *DTSBU090
00010 *              WORDS, SCRUNCHING EXTRANEOUS SPACES AT THE END OF *DTSBU090
00011 *              WORD GROUPINGS (NOT AT THE BEGINNING OR MIDDLE)   *DTSBU090
00012 *                                                                *DTSBU090
00013 *                                                                *DTSBU090
00014 * MODIFICATION HISTORY:                                          *DTSBU090
00015 * 09-03-94 INITIAL DEVELOPMENT                                   *DTSBU090
00016 *          REFERENCE RFP #RAP             AUTHOR OF CHANGE - SFW *DTSBU090
00017 *                                                                *DTSBU090
00018 * 02-28-95 ADDED L090-INDENT AND L090-SPECIAL-CHAR FIELDS AND    *DTSBU090
00019 *          CODING.  INCREASED L090-PHRASE TO 80 CHARACTERS.      *DTSBU090
00020 *          THESE FEATURES WERE ADDED SO THAT THIS MODULE COULD   *DTSBU090
00021 *          BE MORE EASILY USED BY DTSBD995.                      *   CL**2
00022 *                                                                *DTSBU090
00023 *          NOTE: L090-INDENT DOES NOT APPLY TO L090-PHRASE(1).   *DTSBU090
00024 *          REFERENCE RFP #RAP             AUTHOR OF CHANGE - RHC *DTSBU090
00025 *                                                                *DTSBU090
00026 * 11-05-1998 MODIFIED TO CONFORM TO DUTAS PROGRAM SPECIFICATIONS *   CL**2
00027 *          REFERENCE RFP #****            AUTHOR OF CHANGE - DVS *   CL**2
00028 *                                                                *DTSBU090
00029 * MM-DD-YY XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX *   CL**2
00030 *          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX *   CL**2
00031 *          REFERENCE RFP #****            AUTHOR OF CHANGE - XXX *   CL**2
00032 *                                                                *   CL**2
00033 *    RETURN CODES:                                               *DTSBU090
00034 *      0 - SUCCESSFUL COMPLETION                                 *DTSBU090
00035 *      8 - PROBLEMS ENCOUNTERED                                  *DTSBU090
00036 *                                                                *DTSBU090
00037 *                                                                *DTSBU090
00038 *    IF THE CA-OPTIMIZER IS NOT USED, REMOVE REFERENCES TO       *DTSBU090
00039 *    THE 'CA-OPTIMIZER-FIX' FIELD.  (ERROR MESSAGE CAPP744E.)    *DTSBU090
00040 *                                                                *DTSBU090
00041 ******************************************************************DTSBU090
00042      SKIP3                                                        DTSBU090
00043  ENVIRONMENT DIVISION.                                            DTSBU090
00044      SKIP3                                                        DTSBU090
00045  DATA DIVISION.                                                   DTSBU090
00046      EJECT                                                        DTSBU090
00047  WORKING-STORAGE SECTION.                                         DTSBU090
000475 77  PAN-VALET PICTURE X(24) VALUE '003DTSBU090  11/05/98'.       DTSBU090
00048      SKIP3                                                        DTSBU090
00049  01  WRK-AREA.                                                    DTSBU090
00050      05  WS-MAXIMUM-LINES            PIC S9(03)  COMP-3 VALUE +40.DTSBU090
00051                                                                   DTSBU090
00052      05  WS-PARAGRAPH-LINE-POSITION  PIC S9(04)  COMP.            DTSBU090
00053      05  WS-PHRASE-POSITION          PIC S9(04)  COMP.            DTSBU090
00054                                                                   DTSBU090
00055      05  WS-NEXT-WORD-LENGTH         PIC S9(04)  COMP.            DTSBU090
00056                                                                   DTSBU090
00057      05  WS-NEXT-SPECIAL-CHARACTER   PIC S9(04)  COMP.            DTSBU090
00058                                                                   DTSBU090
00059      05  WS-DUPE-PARAGRAPH-LINE      PIC  X(132).                 DTSBU090
00060      05  WS-PARAGRAPH-LINE-DUPE-IND  PIC  X(01).                  DTSBU090
00061          88  WS-PARAGRAPH-LINE-DUPE-88           VALUE 'Y'.       DTSBU090
00062      EJECT                                                        DTSBU090
00063  LINKAGE SECTION.                                                 DTSBU090
00064      SKIP3                                                        DTSBU090
00065  01  L090-LINK-AREA.                                              DTSBU090
00066  ++INCLUDE DTSIL090                                                  CL**3
00067      SKIP3                                                        DTSBU090
00068  01  CA-OPTIMIZER-FIX1       PIC X(01).                           DTSBU090
00069  01  CA-OPTIMIZER-FIX2       PIC X(01).                           DTSBU090
00070  01  CA-OPTIMIZER-FIX3       PIC X(01).                           DTSBU090
00071      EJECT                                                        DTSBU090
00072  PROCEDURE DIVISION                                               DTSBU090
00073      USING L090-LINK-AREA.                                        DTSBU090
00074                                                                   DTSBU090
00075      SET L090-SUCCESSFUL-88 TO TRUE.                              DTSBU090
00076                                                                   DTSBU090
00077      MOVE +0 TO L090-PARAGRAPH-LINE-CNT.                          DTSBU090
00078                                                                   DTSBU090
00079      IF (L090-DESIRED-LINE-LIMIT > +132)                          DTSBU090
00080                    OR                                             DTSBU090
00081         (L090-PHRASE-CNT > +99)                                   DTSBU090
00082          SET L090-UNSUCCESSFUL-88 TO TRUE                         DTSBU090
00083          GO TO MAINLINE-EXIT.                                     DTSBU090
00084                                                                   DTSBU090
00085      SET L090-PARAGRAPH-IDX TO +1.                                DTSBU090
00086                                                                   DTSBU090
00087      MOVE SPACES                                                  DTSBU090
00088         TO WS-PARAGRAPH-LINE-DUPE-IND                             DTSBU090
00089            WS-DUPE-PARAGRAPH-LINE                                 DTSBU090
00090            L090-PARAGRAPH-LINE-DUPE-IND (L090-PARAGRAPH-IDX)      DTSBU090
00091            L090-PARAGRAPH-LINE (L090-PARAGRAPH-IDX).              DTSBU090
00092                                                                   DTSBU090
00093      MOVE +1 TO WS-PARAGRAPH-LINE-POSITION.                       DTSBU090
00094                                                                   DTSBU090
00095      PERFORM P1000-BUILD-PARAGRAPH THRU P1000-EXIT                DTSBU090
00096         VARYING L090-PHRASE-IDX FROM +1 BY +1                     DTSBU090
00097         UNTIL L090-PHRASE-IDX > L090-PHRASE-CNT.                  DTSBU090
00098                                                                   DTSBU090
00099      IF L090-SUCCESSFUL-88                                        DTSBU090
00100          IF WS-PARAGRAPH-LINE-DUPE-88                             DTSBU090
00101              SET L090-PARAGRAPH-IDX UP BY +1                      DTSBU090
00102              IF L090-PARAGRAPH-IDX > WS-MAXIMUM-LINES             DTSBU090
00103                  SET L090-PARAGRAPH-IDX TO WS-MAXIMUM-LINES       DTSBU090
00104                  SET L090-UNSUCCESSFUL-88 TO TRUE                 DTSBU090
00105                  MOVE +0 TO L090-PARAGRAPH-LINE-CNT               DTSBU090
00106              ELSE                                                 DTSBU090
00107                  SET                                              DTSBU090
00108                  L090-PARAGRAPH-LINE-DUPE-88 (L090-PARAGRAPH-IDX) DTSBU090
00109                     TO TRUE                                       DTSBU090
00110                  MOVE WS-DUPE-PARAGRAPH-LINE                      DTSBU090
00111                     TO L090-PARAGRAPH-LINE (L090-PARAGRAPH-IDX)   DTSBU090
00112                  SET L090-PARAGRAPH-LINE-CNT                      DTSBU090
00113                     TO L090-PARAGRAPH-IDX                         DTSBU090
00114          ELSE                                                     DTSBU090
00115              SET L090-PARAGRAPH-LINE-CNT TO L090-PARAGRAPH-IDX    DTSBU090
00116      ELSE                                                         DTSBU090
00117          MOVE +0 TO L090-PARAGRAPH-LINE-CNT.                      DTSBU090
00118                                                                   DTSBU090
00119      IF L090-NO-SPECIAL-CHAR-88                                   DTSBU090
00120          NEXT SENTENCE                                            DTSBU090
00121      ELSE                                                         DTSBU090
00122          PERFORM P3000-DROP-SPECIAL-CHARACTERS THRU P3000-EXIT    DTSBU090
00123             VARYING L090-PARAGRAPH-IDX                            DTSBU090
00124             FROM L090-PARAGRAPH-LINE-CNT BY -1                    DTSBU090
00125             UNTIL L090-PARAGRAPH-IDX < +1.                        DTSBU090
00126      SKIP3                                                        DTSBU090
00127  MAINLINE-EXIT.                                                   DTSBU090
00128      GOBACK.                                                      DTSBU090
00129      SKIP3                                                        DTSBU090
00130      MOVE SPACE TO CA-OPTIMIZER-FIX1                              DTSBU090
00131                    CA-OPTIMIZER-FIX2                              DTSBU090
00132                    CA-OPTIMIZER-FIX3.                             DTSBU090
00133      EJECT                                                        DTSBU090
00134  P1000-BUILD-PARAGRAPH.                                           DTSBU090
00135                                                                   DTSBU090
00136      MOVE +1 TO WS-PHRASE-POSITION.                               DTSBU090
00137                                                                   DTSBU090
00138      PERFORM P1500-FIND-WORDS THRU P1500-EXIT                     DTSBU090
00139         UNTIL WS-PHRASE-POSITION > +80.                           DTSBU090
00140                                                                   DTSBU090
00141      IF L090-PARAGRAPH-LINE (L090-PARAGRAPH-IDX)                  DTSBU090
00142         (WS-PARAGRAPH-LINE-POSITION - 1:1) = '(' OR '$'           DTSBU090
00143          NEXT SENTENCE                                            DTSBU090
00144      ELSE                                                         DTSBU090
00145      IF L090-PARAGRAPH-LINE (L090-PARAGRAPH-IDX)                  DTSBU090
00146         (WS-PARAGRAPH-LINE-POSITION - 1:1) = '.'                  DTSBU090
00147          ADD +2 TO WS-PARAGRAPH-LINE-POSITION                     DTSBU090
00148      ELSE                                                         DTSBU090
00149          ADD +1 TO WS-PARAGRAPH-LINE-POSITION.                    DTSBU090
00150                                                                   DTSBU090
00151  P1000-EXIT.                                                      DTSBU090
00152      EXIT.                                                        DTSBU090
00153      EJECT                                                        DTSBU090
00154  P1500-FIND-WORDS.                                                DTSBU090
00155                                                                   DTSBU090
00156      MOVE +0 TO WS-NEXT-WORD-LENGTH.                              DTSBU090
00157                                                                   DTSBU090
00158      INSPECT L090-PHRASE (L090-PHRASE-IDX)                        DTSBU090
00159         (WS-PHRASE-POSITION:81 - WS-PHRASE-POSITION)              DTSBU090
00160         TALLYING WS-NEXT-WORD-LENGTH                              DTSBU090
00161         FOR LEADING SPACES.                                       DTSBU090
00162      IF WS-NEXT-WORD-LENGTH = 81 - WS-PHRASE-POSITION             DTSBU090
00163          MOVE +81 TO WS-PHRASE-POSITION                           DTSBU090
00164          GO TO P1500-EXIT.                                        DTSBU090
00165                                                                   DTSBU090
00166      ADD WS-NEXT-WORD-LENGTH TO WS-PHRASE-POSITION                DTSBU090
00167                                 WS-PARAGRAPH-LINE-POSITION.       DTSBU090
00168      MOVE +0 TO WS-NEXT-WORD-LENGTH.                              DTSBU090
00169      INSPECT L090-PHRASE (L090-PHRASE-IDX)                        DTSBU090
00170         (WS-PHRASE-POSITION:81 - WS-PHRASE-POSITION)              DTSBU090
00171         TALLYING WS-NEXT-WORD-LENGTH                              DTSBU090
00172         FOR CHARACTERS BEFORE INITIAL SPACE.                      DTSBU090
00173      PERFORM P1700-MOVE-WORD THRU P1700-EXIT.                     DTSBU090
00174                                                                   DTSBU090
00175      ADD WS-NEXT-WORD-LENGTH TO WS-PHRASE-POSITION.               DTSBU090
00176                                                                   DTSBU090
00177  P1500-EXIT.                                                      DTSBU090
00178      EXIT.                                                        DTSBU090
00179      EJECT                                                        DTSBU090
00180  P1700-MOVE-WORD.                                                 DTSBU090
00181                                                                   DTSBU090
00182      IF (WS-NEXT-WORD-LENGTH = +1)                                DTSBU090
00183                  AND                                              DTSBU090
00184         (L090-PHRASE (L090-PHRASE-IDX)                            DTSBU090
00185            (WS-PHRASE-POSITION:1)                                 DTSBU090
00186            = '.' OR ')' OR ',' OR '!' OR '?' OR '%' OR ';')       DTSBU090
00187                  AND                                              DTSBU090
00188         (WS-PARAGRAPH-LINE-POSITION > +1)                         DTSBU090
00189          SUBTRACT +1 FROM WS-PARAGRAPH-LINE-POSITION              DTSBU090
00190          IF WS-PARAGRAPH-LINE-POSITION > 132                      DTSBU090
00191              SET L090-UNSUCCESSFUL-88 TO TRUE                     DTSBU090
00192              MOVE +81 TO WS-PHRASE-POSITION                       DTSBU090
00193              SET L090-PHRASE-IDX TO L090-PHRASE-CNT               DTSBU090
00194              GO TO P1700-EXIT                                     DTSBU090
00195          ELSE                                                     DTSBU090
00196              NEXT SENTENCE                                        DTSBU090
00197      ELSE                                                         DTSBU090
00198      IF WS-NEXT-WORD-LENGTH + WS-PARAGRAPH-LINE-POSITION          DTSBU090
00199         > L090-DESIRED-LINE-LIMIT + 1                             DTSBU090
00200          IF WS-PARAGRAPH-LINE-DUPE-88                             DTSBU090
00201              SET L090-PARAGRAPH-IDX UP BY +1                      DTSBU090
00202              IF L090-PARAGRAPH-IDX > WS-MAXIMUM-LINES             DTSBU090
00203                  SET L090-PARAGRAPH-IDX TO WS-MAXIMUM-LINES       DTSBU090
00204                  SET L090-UNSUCCESSFUL-88 TO TRUE                 DTSBU090
00205                  MOVE +81 TO WS-PHRASE-POSITION                   DTSBU090
00206                  SET L090-PHRASE-IDX TO L090-PHRASE-CNT           DTSBU090
00207                  GO TO P1700-EXIT                                 DTSBU090
00208              END-IF                                               DTSBU090
00209              SET L090-PARAGRAPH-LINE-DUPE-88 (L090-PARAGRAPH-IDX) DTSBU090
00210                 TO TRUE                                           DTSBU090
00211              MOVE WS-DUPE-PARAGRAPH-LINE                          DTSBU090
00212                 TO L090-PARAGRAPH-LINE (L090-PARAGRAPH-IDX)       DTSBU090
00213          END-IF                                                   DTSBU090
00214          ADD L090-INDENT +1 GIVING WS-PARAGRAPH-LINE-POSITION     DTSBU090
00215          SET L090-PARAGRAPH-IDX UP BY +1                          DTSBU090
00216          IF L090-PARAGRAPH-IDX > WS-MAXIMUM-LINES                 DTSBU090
00217              SET L090-PARAGRAPH-IDX TO WS-MAXIMUM-LINES           DTSBU090
00218              SET L090-UNSUCCESSFUL-88 TO TRUE                     DTSBU090
00219              MOVE +81 TO WS-PHRASE-POSITION                       DTSBU090
00220              SET L090-PHRASE-IDX TO L090-PHRASE-CNT               DTSBU090
00221              GO TO P1700-EXIT                                     DTSBU090
00222          END-IF                                                   DTSBU090
00223          MOVE SPACES                                              DTSBU090
00224             TO WS-PARAGRAPH-LINE-DUPE-IND                         DTSBU090
00225                WS-DUPE-PARAGRAPH-LINE                             DTSBU090
00226                L090-PARAGRAPH-LINE-DUPE-IND (L090-PARAGRAPH-IDX)  DTSBU090
00227                L090-PARAGRAPH-LINE (L090-PARAGRAPH-IDX).          DTSBU090
00228                                                                   DTSBU090
00229      MOVE L090-PHRASE (L090-PHRASE-IDX)                           DTSBU090
00230             (WS-PHRASE-POSITION:WS-NEXT-WORD-LENGTH)              DTSBU090
00231         TO                                                        DTSBU090
00232           L090-PARAGRAPH-LINE (L090-PARAGRAPH-IDX)                DTSBU090
00233             (WS-PARAGRAPH-LINE-POSITION:WS-NEXT-WORD-LENGTH).     DTSBU090
00234                                                                   DTSBU090
00235      IF L090-PHRASE-UNDERLINE-88 (L090-PHRASE-IDX)                DTSBU090
00236          SET WS-PARAGRAPH-LINE-DUPE-88 TO TRUE                    DTSBU090
00237          MOVE ALL '_'                                             DTSBU090
00238             TO WS-DUPE-PARAGRAPH-LINE                             DTSBU090
00239                (WS-PARAGRAPH-LINE-POSITION:WS-NEXT-WORD-LENGTH)   DTSBU090
00240      ELSE                                                         DTSBU090
00241      IF L090-PHRASE-BOLD-88 (L090-PHRASE-IDX)                     DTSBU090
00242          SET WS-PARAGRAPH-LINE-DUPE-88 TO TRUE                    DTSBU090
00243          MOVE L090-PHRASE (L090-PHRASE-IDX)                       DTSBU090
00244                 (WS-PHRASE-POSITION:WS-NEXT-WORD-LENGTH)          DTSBU090
00245             TO WS-DUPE-PARAGRAPH-LINE                             DTSBU090
00246                (WS-PARAGRAPH-LINE-POSITION:WS-NEXT-WORD-LENGTH).  DTSBU090
00247                                                                   DTSBU090
00248      ADD WS-NEXT-WORD-LENGTH TO WS-PARAGRAPH-LINE-POSITION.       DTSBU090
00249                                                                   DTSBU090
00250  P1700-EXIT.                                                      DTSBU090
00251      EXIT.                                                        DTSBU090
00252      EJECT                                                        DTSBU090
00253  P3000-DROP-SPECIAL-CHARACTERS.                                   DTSBU090
00254                                                                   DTSBU090
00255      IF L090-PARAGRAPH-LINE-DUPE-88 (L090-PARAGRAPH-IDX)          DTSBU090
00256          MOVE +0 TO WS-NEXT-SPECIAL-CHARACTER                     DTSBU090
00257          INSPECT L090-PARAGRAPH-LINE (L090-PARAGRAPH-IDX - 1)     DTSBU090
00258             TALLYING WS-NEXT-SPECIAL-CHARACTER                    DTSBU090
00259             FOR CHARACTERS BEFORE INITIAL L090-SPECIAL-CHAR       DTSBU090
00260          PERFORM P3010-EXAMINE-ORIGINAL-LINE THRU P3010-EXIT      DTSBU090
00261             UNTIL WS-NEXT-SPECIAL-CHARACTER NOT < +132            DTSBU090
00262          SET L090-PARAGRAPH-IDX DOWN BY +1                        DTSBU090
00263      ELSE                                                         DTSBU090
00264          INSPECT L090-PARAGRAPH-LINE (L090-PARAGRAPH-IDX)         DTSBU090
00265             REPLACING ALL L090-SPECIAL-CHAR BY SPACE.             DTSBU090
00266                                                                   DTSBU090
00267  P3000-EXIT.                                                      DTSBU090
00268      EXIT.                                                        DTSBU090
00269      SKIP3                                                        DTSBU090
00270  P3010-EXAMINE-ORIGINAL-LINE.                                     DTSBU090
00271                                                                   DTSBU090
00272      ADD +1 TO WS-NEXT-SPECIAL-CHARACTER.                         DTSBU090
00273                                                                   DTSBU090
00274      MOVE SPACE TO L090-PARAGRAPH-LINE (L090-PARAGRAPH-IDX)       DTSBU090
00275                       (WS-NEXT-SPECIAL-CHARACTER:1)               DTSBU090
00276                    L090-PARAGRAPH-LINE (L090-PARAGRAPH-IDX - 1)   DTSBU090
00277                       (WS-NEXT-SPECIAL-CHARACTER:1).              DTSBU090
00278                                                                   DTSBU090
00279      MOVE +0 TO WS-NEXT-SPECIAL-CHARACTER.                        DTSBU090
00280                                                                   DTSBU090
00281      INSPECT L090-PARAGRAPH-LINE (L090-PARAGRAPH-IDX - 1)         DTSBU090
00282         TALLYING WS-NEXT-SPECIAL-CHARACTER                        DTSBU090
00283         FOR CHARACTERS BEFORE INITIAL L090-SPECIAL-CHAR.          DTSBU090
00284                                                                   DTSBU090
00285  P3010-EXIT.                                                      DTSBU090
00286      EXIT.                                                        DTSBU090
