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