**HERE IS PART OF MY CODE THAT REALLY MATTERS!

AND BELOW IS THE PRINT OUT I GET WITH THE Program
**    B200-LOGC.**
               INITIALIZE WS-MISC, P1-DTL1-LINE.**

               MOVE EMPL-FRST-NAME TO WS-FRST-NAME.
               MOVE EMPL-LAST-NAME TO WS-LAST-NAME.

               MOVE WS-NAME TO P1-EMP-NAME
               MOVE EMPL-GROS-SLRY TO P1-EMP-SLRY.

               IF EMPL-GNDR = "M"
                  MOVE "MALE" TO P1-EMP-GNDR
                  ADD 1 TO WS-MALE-CONT
                  ADD EMPL-GROS-SLRY TO WS-MALE-CONT-SAL

                   IF EMPL-MRTL-STAT = "S"
                      MOVE "SINGLE" TO P1-EMP-MRTL
                      ADD 1 TO WS-SNGL-CONT
                      ADD EMPL-GROS-SLRY TO WS-SNGL-CONT-SAL
                      ADD 1 TO WS-SNGL-MALE
                      ADD EMPL-GROS-SLRY TO WS-SNGL-MALE-SAL
                   ELSE
                      MOVE "MARRIED" TO P1-EMP-MRTL
                      ADD 1 TO WS-MRRD-CONT
                      ADD EMPL-GROS-SLRY TO WS-MRRD-CONT-SAL
                      ADD 1 TO WS-MRRD-MALE
                      ADD EMPL-GROS-SLRY TO WS-MRRD-MALE-SAL
                   END-IF
               ELSE
                  MOVE "FEMALE" TO P1-EMP-GNDR
                  ADD 1 TO WS-FEML-CONT
                  ADD EMPL-GROS-SLRY TO WS-FEML-CONT-SAL

                  IF EMPL-MRTL-STAT = "S"
                     MOVE "SINGLE" TO P1-EMP-MRTL
                     ADD 1 TO WS-SNGL-CONT
                     ADD EMPL-GROS-SLRY TO WS-SNGL-CONT-SAL
                     ADD 1 TO WS-SNGL-FEML
                     ADD EMPL-GROS-SLRY TO WS-SNGL-FEML-SAL
                  ELSE
                     MOVE "MARRIED" TO P1-EMP-MRTL
                     ADD 1 TO WS-MRRD-CONT
                     ADD EMPL-GROS-SLRY TO WS-MRRD-CONT-SAL
                     ADD 1 TO WS-MRRD-FEML
                     ADD EMPL-GROS-SLRY TO WS-MRRD-FEML-SAL
                  END-IF

               END-IF.

               ADD 1 TO WS-TOTL-CONT.
               ADD EMPL-GROS-SLRY TO WS-TOTL-SAL.

               WRITE OUTPUT-REC FROM P1-DTL1-LINE.
               PERFORM E000-PAGE-BRK.

            B2999-EXIT.
               EXIT.
          /
            C000-WRIT-DETL SECTION.
          ******************************************************************
          * Writing the Summary Report after writing the initial records.  *
          ******************************************************************
            C000-DETL-PROC.

               WRITE OUTPUT-REC FROM P1-HDR4-LINE.

               WRITE OUTPUT-REC FROM WS-BLNK-LINE.

               INITIALIZE P1-DTL2-LINE, WS-AVRG-SLRY.
               MOVE "SINGLE EMPLOYEES" TO P1-COL1.
               MOVE WS-SNGL-CONT TO P1-COL2.
               IF WS-SNGL-CONT = 0
                  CONTINUE
               ELSE
                  COMPUTE WS-AVRG-SLRY = WS-SNGL-CONT-SAL/WS-SNGL-CONT
               END-IF.
               MOVE WS-AVRG-SLRY TO P1-COL3.
               WRITE OUTPUT-REC FROM P1-DTL2-LINE.
               PERFORM E000-PAGE-BREK.
               WRITE OUTPUT-REC FROM WS-BLNK-LINE.
               PERFORM E000-PAGE-BREK.

               INITIALIZE P1-DTL2-LINE, WS-AVRG-SLRY.
               MOVE "MARRIED EMPLOYEES" TO P1-COL1.
               MOVE WS-MRRD-CONT TO P1-COL2.
               IF WS-MRRD-CONT = 0
                  CONTINUE
               ELSE
                  COMPUTE WS-AVRG-SLRY = WS-MRRD-CONT-SAL/WS-MRRD-CONT
               END-IF.
               MOVE WS-AVRG-SLRY TO P1-COL3.
               WRITE OUTPUT-REC FROM P1-DTL2-LINE.
               PERFORM E000-PAGE-BREK.
               WRITE OUTPUT-REC FROM WS-BLNK-LINE.
               PERFORM E000-PAGE-BREK.

               INITIALIZE P1-DTL2-LINE, WS-AVRG-SLRY.
               MOVE "FEMALE EMPLOYEES" TO P1-COL1.
               MOVE WS-FEML-CONT TO P1-COL2.
               IF WS-FEML-CONT = 0
                  CONTINUE
               ELSE
                  COMPUTE WS-AVRG-SLRY = WS-FEML-CONT-SAL/WS-FEML-CONT
               END-IF.
               MOVE WS-AVRG-SLRY TO P1-COL3.
               WRITE OUTPUT-REC FROM P1-DTL2-LINE.
               PERFORM E000-PAGE-BREK.
               WRITE OUTPUT-REC FROM WS-BLNK-LINE.
               PERFORM E000-PAGE-BREK.

               INITIALIZE P1-DTL2-LINE, WS-AVRG-SLRY.
               MOVE "MALE EMPLOYEES" TO P1-COL1.
               MOVE WS-MALE-CONT TO P1-COL2.
               IF WS-MALE-CONT = 0
                  CONTINUE
               ELSE
                  COMPUTE WS-AVRG-SLRY = WS-MALE-CONT-SAL/WS-MALE-CONT
               END-IF.
               MOVE WS-AVRG-SLRY TO P1-COL3.
               WRITE OUTPUT-REC FROM P1-DTL2-LINE.
               PERFORM E000-PAGE-BREK.
               WRITE OUTPUT-REC FROM WS-BLNK-LINE.
               PERFORM E000-PAGE-BREK.

               INITIALIZE P1-DTL2-LINE, WS-AVRG-SLRY.
               MOVE "SINGLE FEMALES" TO P1-COL1.
               MOVE WS-SNGL-FEML TO P1-COL2.
               IF WS-SNGL-FEML = 0
                   CONTINUE
               ELSE
                   COMPUTE WS-AVRG-SLRY = WS-SNGL-FEML-SAL/WS-SNGL-FEML
               END-IF.
               MOVE WS-AVRG-SLRY TO P1-COL3.
               WRITE OUTPUT-REC FROM P1-DTL2-LINE.
               PERFORM E000-PAGE-BREK.
               WRITE OUTPUT-REC FROM WS-BLNK-LINE.
               PERFORM E000-PAGE-BREK.

               INITIALIZE P1-DTL2-LINE, WS-AVRG-SLRY.
               MOVE "SINGLE MALES" TO P1-COL1.
               MOVE WS-SNGL-MALE TO P1-COL2.
               IF WS-SNGL-MALE = 0
                   CONTINUE
               ELSE
                   COMPUTE WS-AVRG-SLRY = WS-SNGL-MALE-SAL/WS-SNGL-MALE
               END-IF.
               MOVE WS-AVRG-SLRY TO P1-COL3.
               WRITE OUTPUT-REC FROM P1-DTL2-LINE.
               PERFORM E000-PAGE-BREK.
               WRITE OUTPUT-REC FROM WS-BLNK-LINE.
               PERFORM E000-PAGE-BREK.

               INITIALIZE P1-DTL2-LINE, WS-AVRG-SLRY.
               MOVE "MARRIED FEMALES" TO P1-COL1.
               MOVE WS-MRRD-FEML TO P1-COL2.
               IF WS-MRRD-FEML = 0
                  CONTINUE
               ELSE
                  COMPUTE WS-AVRG-SLRY = WS-MRRD-FEML-SAL/WS-MRRD-FEML
               END-IF.
               MOVE WS-AVRG-SLRY TO P1-COL3.
               WRITE OUTPUT-REC FROM P1-DTL2-LINE.
               PERFORM E000-PAGE-BREK.
               WRITE OUTPUT-REC FROM WS-BLNK-LINE.
               PERFORM E000-PAGE-BREK.

               INITIALIZE P1-DTL2-LINE, WS-AVRG-SLRY.
               MOVE "MARRIED MALES" TO P1-COL1.
               MOVE WS-MRRD-MALE TO P1-COL2.
               IF WS-MRRD-MALE = 0
                   CONTINUE
               ELSE
                   COMPUTE WS-AVRG-SLRY = WS-MRRD-MALE-SAL/WS-MRRD-MALE
               END-IF.
               MOVE WS-AVRG-SLRY TO P1-COL3.
               WRITE OUTPUT-REC FROM P1-DTL2-LINE.
               PERFORM E000-PAGE-BREK.
               WRITE OUTPUT-REC FROM WS-BLNK-LINE.
               PERFORM E000-PAGE-BREAK.</CODE>

**BASICALLY THE OUTPUT IS AS FOLLOW:
EMPLOYEE NAME                   SALARY      MARITAL      GENDER

     CAROL ANNE  WISSINK             $30,013     MARRIED      FEMALE
     BARB        AUSTIN              $20,013     MARRIED      FEMALE
     JOHN        TEUNE               $32,008     MARRIED      FEMALE
     ANNA        ELBERS              $12,506     SINGLE       FEMALE
     ELIZABETH   SCHOON              $14,006     SINGLE       FEMALE

PROBLEM IS THAT THE THIRD ONE DOWNSHOULD BE "MALE" NOT FEMALE
**
ANY THOUGHTS WHAT I DID WRONG?

At the risk of reviving a stale thread...

Since we can't see your data division, it's kind of tough to tell what's wrong. However, your logic says that if the value in EMPL_GNDR = 'M' then do something...otherwise tally the record as 'FEMALE'. So that means if there's garbage in EMPL_GNDR, it will default to 'FEMALE'. I would take a good hard look at how your input record maps to your data field specifications. My guess is you're either off a byte or two, or there's a mis-definition of the field size, or your data's bad, or any number of other things.

Hope this helps! Happy coding!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.