00001  IDENTIFICATION DIVISION.                                         06/13/05
00002  PROGRAM-ID.             DTSBX464.                                DTSBX464
00003  AUTHOR.                 NGC.                                        LV001
00004  DATE-WRITTEN.           MARCH 2005.                              DTSBX464
00005  DATE-COMPILED.                                                   DTSBX464
00006      SKIP3                                                        DTSBX464
00007 *****                                                             DTSBX464
00008 *                                                                 DTSBX464
00009 *    FUNCTION:  FIND EMPLOYERS NEWLY ADDED                        DTSBX464
00010 *                                                                 DTSBX464
00011 *                                                                 DTSBX464
00012 *  MODIFICATION LOG:                                              DTSBX464
00013 *                                                                 DTSBX464
00014 *    03/17/2005  INITIAL DEVELOPMENT.                             DTSBX464
00015 *                REFERENCE:                      PROGRAMMER: GD   DTSBX464
00016 *                                                                 DTSBX464
00017 *****                                                             DTSBX464
00018      SKIP3                                                        DTSBX464
00019  ENVIRONMENT DIVISION.                                            DTSBX464
00020      SKIP2                                                        DTSBX464
00021  INPUT-OUTPUT SECTION.                                            DTSBX464
00022  FILE-CONTROL.                                                    DTSBX464
00023      SELECT NEW-EMP-FILE                                          DTSBX464
00024         ASSIGN TO NEWEMP                                          DTSBX464
00025         FILE STATUS IS NEW-EMP-STATUS.                            DTSBX464
00026                                                                   DTSBX464
00027      SELECT OLD-EMP-FILE                                          DTSBX464
00028         ASSIGN TO OLDEMP                                          DTSBX464
00029         ORGANIZATION IS INDEXED                                   DTSBX464
00030         RECORD KEY IS OLD-EMP-FEIN                                DTSBX464
00031         ACCESS IS SEQUENTIAL                                      DTSBX464
00032         FILE STATUS IS OLD-EMP-STATUS.                            DTSBX464
00033                                                                   DTSBX464
00034      SELECT EMP-UPDATE-FILE                                       DTSBX464
00035         ASSIGN TO EMPUPD                                          DTSBX464
00036         FILE STATUS IS EMP-UPD-STATUS.                            DTSBX464
00037                                                                   DTSBX464
00038  DATA DIVISION.                                                   DTSBX464
00039      SKIP3                                                        DTSBX464
00040  FILE SECTION.                                                    DTSBX464
00041  FD  NEW-EMP-FILE                                                 DTSBX464
00042      LABEL RECORDS ARE STANDARD.                                  DTSBX464
00043  01  NEW-EMP-REC.                                                 DTSBX464
00044      05  NEW-EMP-FEIN                PIC 9(09).                   DTSBX464
00045      05  FILLER                      PIC X(80).                   DTSBX464
00046                                                                   DTSBX464
00047  FD  OLD-EMP-FILE                                                 DTSBX464
00048      LABEL RECORDS ARE STANDARD.                                  DTSBX464
00049  01  OLD-EMP-REC.                                                 DTSBX464
00050      05  OLD-EMP-FEIN                PIC 9(09).                   DTSBX464
00051      05  FILLER                      PIC X(80).                   DTSBX464
00052                                                                   DTSBX464
00053  FD  EMP-UPDATE-FILE                                              DTSBX464
00054      LABEL RECORDS ARE STANDARD.                                  DTSBX464
00055  01  EMP-UPD-REC                     PIC X(89).                   DTSBX464
00056                                                                   DTSBX464
00057      EJECT                                                        DTSBX464
00058  WORKING-STORAGE SECTION.                                         DTSBX464
000585 77  PAN-VALET PICTURE X(24) VALUE '001DTSBX464  06/13/05'.       DTSBX464
00059      SKIP3                                                        DTSBX464
00060  01  WRK-AREA.                                                    DTSBX464
00061      05  WRK-ABEND-CD                PIC S9(04)  COMP  VALUE +462.DTSBX464
00062                                                                   DTSBX464
00063      05  WRK-MOD-NAME                PIC  X(08)  VALUE 'DTSBX462'.DTSBX464
00064                                                                   DTSBX464
00065      05  WRK-NEW-EMP-CNT             PIC S9(07)  COMP-3 VALUE 0.  DTSBX464
00066      05  WRK-OLD-EMP-CNT             PIC S9(07)  COMP-3 VALUE 0.  DTSBX464
00067      05  WRK-EMP-UPD-CNT             PIC S9(07)  COMP-3 VALUE 0.  DTSBX464
00068                                                                   DTSBX464
00069      05  NEW-EMP-STATUS                PIC  X(02).                DTSBX464
00070          88  NEW-EMP-STATUS-OK-88    VALUE '00', '97'.            DTSBX464
00071          88  NEW-EMP-STATUS-EOF-88   VALUE '10'.                  DTSBX464
00072                                                                   DTSBX464
00073      05  OLD-EMP-STATUS                PIC  X(02).                DTSBX464
00074          88  OLD-EMP-STATUS-OK-88    VALUE '00', '97'.            DTSBX464
00075          88  OLD-EMP-STATUS-EOF-88   VALUE '10'.                  DTSBX464
00076                                                                   DTSBX464
00077      05  EMP-UPD-STATUS                PIC  X(02).                DTSBX464
00078          88  EMP-UPD-STATUS-OK-88    VALUE '00', '97'.            DTSBX464
00079                                                                   DTSBX464
00080      05  WRK-ERROR-IND               PIC  X(01).                  DTSBX464
00081          88 WRK-ERROR-YES-88        VALUE 'Y'.                    DTSBX464
00082          88 WRK-ERROR-NO-88         VALUE 'N'.                    DTSBX464
00083                                                                   DTSBX464
00084                                                                   DTSBX464
00085  01  WRK-XVEM-REC.                                                DTSBX464
00086  ++INCLUDE DTSIXVEM                                               DTSBX464
00087                                                                   DTSBX464
00088  PROCEDURE DIVISION.                                              DTSBX464
00089                                                                   DTSBX464
00090  DTSBX464-MAIN.                                                   DTSBX464
00091      PERFORM I0000-INITIATE THRU I0000-EXIT.                      DTSBX464
00092      IF WRK-ERROR-YES-88                                          DTSBX464
00093         GO TO DTSBX464-MAIN-EXIT.                                 DTSBX464
00094                                                                   DTSBX464
00095      PERFORM P0000-PROCESS THRU P0000-EXIT.                       DTSBX464
00096                                                                   DTSBX464
00097      PERFORM T0000-TERMINATE THRU T0000-EXIT.                     DTSBX464
00098                                                                   DTSBX464
00099  DTSBX464-MAIN-EXIT.                                              DTSBX464
00100      GOBACK.                                                      DTSBX464
00101      EJECT                                                        DTSBX464
00102  I0000-INITIATE.                                                  DTSBX464
00103      SET WRK-ERROR-NO-88 TO TRUE.                                 DTSBX464
00104                                                                   DTSBX464
00105      PERFORM I1000-OPEN-FILES          THRU I1000-EXIT.           DTSBX464
00106                                                                   DTSBX464
00107  I0000-EXIT.                                                      DTSBX464
00108      EXIT.                                                        DTSBX464
00109  I1000-OPEN-FILES.                                                DTSBX464
00110      PERFORM S1200-OPEN-NEW-EMP      THRU S1200-EXIT.             DTSBX464
00111      IF WRK-ERROR-YES-88                                          DTSBX464
00112         GO TO I1000-EXIT                                          DTSBX464
00113      END-IF.                                                      DTSBX464
00114                                                                   DTSBX464
00115      PERFORM S1300-OPEN-OLD-EMP      THRU S1300-EXIT.             DTSBX464
00116      IF WRK-ERROR-YES-88                                          DTSBX464
00117         GO TO I1000-EXIT                                          DTSBX464
00118      END-IF.                                                      DTSBX464
00119                                                                   DTSBX464
00120      PERFORM S1400-OPEN-EMP-UPDATE    THRU S1400-EXIT.            DTSBX464
00121      IF WRK-ERROR-YES-88                                          DTSBX464
00122         SET WRK-ERROR-YES-88 TO TRUE                              DTSBX464
00123         GO TO I1000-EXIT                                          DTSBX464
00124      END-IF.                                                      DTSBX464
00125                                                                   DTSBX464
00126  I1000-EXIT.                                                      DTSBX464
00127      EXIT.                                                        DTSBX464
00128                                                                   DTSBX464
00129  P0000-PROCESS.                                                   DTSBX464
00130      PERFORM S1210-READ-NEW-EMP       THRU S1210-EXIT.            DTSBX464
00131      IF NOT NEW-EMP-STATUS-OK-88                                  DTSBX464
00132         DISPLAY 'BAD FIRST READ OF NEW EMP FILE '                 DTSBX464
00133             NEW-EMP-STATUS                                        DTSBX464
00134         GO TO P0000-EXIT                                          DTSBX464
00135      END-IF.                                                      DTSBX464
00136                                                                   DTSBX464
00137      PERFORM S1310-READ-OLD-EMP       THRU S1310-EXIT.            DTSBX464
00138      IF NOT OLD-EMP-STATUS-OK-88                                  DTSBX464
00139         DISPLAY 'BAD FIRST READ OF OLD EMP FILE '                 DTSBX464
00140             OLD-EMP-STATUS                                        DTSBX464
00141         GO TO P0000-EXIT                                          DTSBX464
00142      END-IF.                                                      DTSBX464
00143                                                                   DTSBX464
00144      PERFORM P1000-FIND-UPDATES          THRU P1000-EXIT          DTSBX464
00145        UNTIL NEW-EMP-STATUS-EOF-88                                DTSBX464
00146        OR WRK-ERROR-YES-88.                                       DTSBX464
00147                                                                   DTSBX464
00148  P0000-EXIT.                                                      DTSBX464
00149      EXIT.                                                        DTSBX464
00150                                                                   DTSBX464
00151  P1000-FIND-UPDATES.                                              DTSBX464
00152      IF NEW-EMP-FEIN < OLD-EMP-FEIN                               DTSBX464
00153         PERFORM S1410-WRITE-EMP-UPDATE   THRU S1410-EXIT          DTSBX464
00154         PERFORM S1210-READ-NEW-EMP       THRU S1210-EXIT          DTSBX464
00155      ELSE                                                         DTSBX464
00156         IF NEW-EMP-FEIN = OLD-EMP-FEIN                            DTSBX464
00157            PERFORM S1210-READ-NEW-EMP    THRU S1210-EXIT          DTSBX464
00158            PERFORM S1310-READ-OLD-EMP    THRU S1310-EXIT          DTSBX464
00159         ELSE                                                      DTSBX464
00160            PERFORM S1310-READ-OLD-EMP    THRU S1310-EXIT          DTSBX464
00161         END-IF                                                    DTSBX464
00162      END-IF.                                                      DTSBX464
00163                                                                   DTSBX464
00164  P1000-EXIT.                                                      DTSBX464
00165      EXIT.                                                        DTSBX464
00166                                                                   DTSBX464
00167  T0000-TERMINATE.                                                 DTSBX464
00168                                                                   DTSBX464
00169      DISPLAY ' '.                                                 DTSBX464
00170                                                                   DTSBX464
00171      DISPLAY '*** DTSBX464 TERMINATION STATISTICS ***'.           DTSBX464
00172                                                                   DTSBX464
00173      DISPLAY ' '.                                                 DTSBX464
00174                                                                   DTSBX464
00175      DISPLAY 'NUMBER OF NEW EMPLOYER RECORDS READ     : '         DTSBX464
00176              WRK-NEW-EMP-CNT.                                     DTSBX464
00177                                                                   DTSBX464
00178      DISPLAY 'NUMBER OF OLD EMPLOYER RECORDS READ     : '         DTSBX464
00179              WRK-OLD-EMP-CNT.                                     DTSBX464
00180                                                                   DTSBX464
00181      DISPLAY 'NUMBER OF UPDATED EMPLOYERS WRITTEN     : '         DTSBX464
00182              WRK-EMP-UPD-CNT.                                     DTSBX464
00183                                                                   DTSBX464
00184      PERFORM S1220-CLOSE-NEW-EMP           THRU S1220-EXIT.       DTSBX464
00185      PERFORM S1320-CLOSE-OLD-EMP           THRU S1320-EXIT.       DTSBX464
00186      PERFORM S1420-CLOSE-EMP-UPDATE        THRU S1420-EXIT.       DTSBX464
00187                                                                   DTSBX464
00188                                                                   DTSBX464
00189  T0000-EXIT.                                                      DTSBX464
00190      EXIT.                                                        DTSBX464
00191      EJECT                                                        DTSBX464
00192                                                                   DTSBX464
00193  S1200-OPEN-NEW-EMP.                                              DTSBX464
00194      OPEN INPUT NEW-EMP-FILE.                                     DTSBX464
00195      IF NOT NEW-EMP-STATUS-OK-88                                  DTSBX464
00196         DISPLAY 'CANNOT OPEN NEW EMP ' NEW-EMP-STATUS             DTSBX464
00197         SET WRK-ERROR-YES-88 TO TRUE                              DTSBX464
00198      END-IF.                                                      DTSBX464
00199                                                                   DTSBX464
00200  S1200-EXIT.                                                      DTSBX464
00201      EXIT.                                                        DTSBX464
00202                                                                   DTSBX464
00203  S1210-READ-NEW-EMP.                                              DTSBX464
00204      READ NEW-EMP-FILE.                                           DTSBX464
00205      IF NEW-EMP-STATUS-OK-88                                      DTSBX464
00206         ADD +1 TO WRK-NEW-EMP-CNT                                 DTSBX464
00207      ELSE                                                         DTSBX464
00208         IF NOT NEW-EMP-STATUS-EOF-88                              DTSBX464
00209            DISPLAY 'S1210 BAD READ ON NEW EMP '                   DTSBX464
00210               NEW-EMP-STATUS                                      DTSBX464
00211            SET WRK-ERROR-YES-88      TO TRUE                      DTSBX464
00212         END-IF                                                    DTSBX464
00213      END-IF.                                                      DTSBX464
00214                                                                   DTSBX464
00215  S1210-EXIT.                                                      DTSBX464
00216      EXIT.                                                        DTSBX464
00217                                                                   DTSBX464
00218  S1220-CLOSE-NEW-EMP.                                             DTSBX464
00219      CLOSE NEW-EMP-FILE.                                          DTSBX464
00220                                                                   DTSBX464
00221  S1220-EXIT.                                                      DTSBX464
00222      EXIT.                                                        DTSBX464
00223                                                                   DTSBX464
00224  S1300-OPEN-OLD-EMP.                                              DTSBX464
00225      OPEN INPUT OLD-EMP-FILE.                                     DTSBX464
00226      IF NOT OLD-EMP-STATUS-OK-88                                  DTSBX464
00227         DISPLAY 'CANNOT OPEN OLD EMP ' OLD-EMP-STATUS             DTSBX464
00228         SET WRK-ERROR-YES-88 TO TRUE                              DTSBX464
00229      END-IF.                                                      DTSBX464
00230                                                                   DTSBX464
00231  S1300-EXIT.                                                      DTSBX464
00232      EXIT.                                                        DTSBX464
00233                                                                   DTSBX464
00234  S1310-READ-OLD-EMP.                                              DTSBX464
00235      READ OLD-EMP-FILE NEXT.                                      DTSBX464
00236      IF OLD-EMP-STATUS-OK-88                                      DTSBX464
00237         ADD +1 TO WRK-OLD-EMP-CNT                                 DTSBX464
00238      ELSE                                                         DTSBX464
00239         IF NOT OLD-EMP-STATUS-EOF-88                              DTSBX464
00240            DISPLAY 'S1310 BAD READ ON OLD EMP '                   DTSBX464
00241               OLD-EMP-STATUS                                      DTSBX464
00242            SET WRK-ERROR-YES-88 TO TRUE                           DTSBX464
00243         END-IF                                                    DTSBX464
00244      END-IF.                                                      DTSBX464
00245                                                                   DTSBX464
00246  S1310-EXIT.                                                      DTSBX464
00247      EXIT.                                                        DTSBX464
00248                                                                   DTSBX464
00249  S1320-CLOSE-OLD-EMP.                                             DTSBX464
00250      CLOSE OLD-EMP-FILE.                                          DTSBX464
00251                                                                   DTSBX464
00252  S1320-EXIT.                                                      DTSBX464
00253      EXIT.                                                        DTSBX464
00254                                                                   DTSBX464
00255  S1400-OPEN-EMP-UPDATE.                                           DTSBX464
00256      OPEN OUTPUT EMP-UPDATE-FILE.                                 DTSBX464
00257      IF NOT EMP-UPD-STATUS-OK-88                                  DTSBX464
00258         DISPLAY 'CANNOT OPEN EMP UPDATE FILE '                    DTSBX464
00259             EMP-UPD-STATUS                                        DTSBX464
00260         SET WRK-ERROR-YES-88 TO TRUE                              DTSBX464
00261      END-IF.                                                      DTSBX464
00262                                                                   DTSBX464
00263  S1400-EXIT.                                                      DTSBX464
00264      EXIT.                                                        DTSBX464
00265                                                                   DTSBX464
00266  S1410-WRITE-EMP-UPDATE.                                          DTSBX464
00267      WRITE EMP-UPD-REC FROM NEW-EMP-REC.                          DTSBX464
00268      IF NOT EMP-UPD-STATUS-OK-88                                  DTSBX464
00269         DISPLAY 'S1410 BAD WRITE ON EMP-UPDATE '                  DTSBX464
00270                  EMP-UPD-STATUS                                   DTSBX464
00271         SET WRK-ERROR-YES-88       TO TRUE                        DTSBX464
00272      ELSE                                                         DTSBX464
00273         ADD +1 TO WRK-EMP-UPD-CNT                                 DTSBX464
00274      END-IF.                                                      DTSBX464
00275                                                                   DTSBX464
00276  S1410-EXIT.                                                      DTSBX464
00277      EXIT.                                                        DTSBX464
00278                                                                   DTSBX464
00279  S1420-CLOSE-EMP-UPDATE.                                          DTSBX464
00280      CLOSE EMP-UPDATE-FILE.                                       DTSBX464
00281                                                                   DTSBX464
00282  S1420-EXIT.                                                      DTSBX464
00283      EXIT.                                                        DTSBX464
00284                                                                   DTSBX464
00285                                                                   DTSBX464
00286  S999-ABEND.                                                      DTSBX464
00287      CALL 'DTSBU999' USING WRK-ABEND-CD.                          DTSBX464
00288  S999-EXIT.                                                       DTSBX464
00289      EXIT.                                                        DTSBX464
