       IDENTIFICATION DIVISION.  
      *++++++++++++++++++++++++++++++++++++++++++++++++++++++++
      *++                                                    ++
      *++   I D E N T I F I C A T I O N    D I V I S I O N   ++
      *++                                                    ++   
      *++++++++++++++++++++++++++++++++++++++++++++++++++++++++

       PROGRAM-ID. VHS06.

       ENVIRONMENT DIVISION.
      *+++++++++++++++++++++++++++++++++++++++++++++++          
      *++                                           ++ 
      *++   E N V I R O N M E N T   D I V S I O N   ++
      *++                                           ++
      *+++++++++++++++++++++++++++++++++++++++++++++++

       CONFIGURATION SECTION.
      *______________________

       SOURCE-COMPUTER. P3500.
       OBJECT-COMPUTER. P3500.

       INPUT-OUTPUT SECTION.
      *_____________________

       FILE-CONTROL.
           SELECT KDAT ASSIGN TO INPUT "UMSATZ".
           SELECT KLISTE ASSIGN TO PRINT "PRINTER".


       DATA DIVISION.
      *+++++++++++++++++++++++++++++++++++
      *++                               ++
      *++   D A T A   D I V I S I O N   ++
      *++                               ++
      *+++++++++++++++++++++++++++++++++++ 

       FILE SECTION.
      *_____________

       FD  KDAT
           RECORD CONTAINS 27 CHARACTERS
           LABEL RECORD IS STANDARD
           DATA RECORD IS KSATZ.

       01  KSATZ.
           02 KSA       PIC        9.
           02 KNR       PIC     9(7).
           02 KUMSJAHR  PIC       99.
           02 KUMS      PIC 9(10)V99.          
           02 KLIM      PIC     9(5).

       FD  KLISTE 
           RECORD CONTAINS 80 CHARACTERS
           LABEL RECORD IS OMITTED
           DATA RECORD IS ZEILE.         

       01  ZEILE        PIC    X(80).

       WORKING-STORAGE SECTION.
      *________________________

       77  SEIZAE       PIC       99.
       77  ZEIZAE       PIC       99.

       01  KOZ1 PIC X(80) VALUE IS "LISTE DER UMSATZSTAERKSTEN KUNDEN".
       01  KOZ2 PIC X(80) VALUE IS "=================================".

       01  UEZ1 PIC X(80) VALUE IS "   KLNR     KUNDENUMSATZ".
       01  UEZ2 PIC X(80) VALUE IS "   ---------------------".     
                
       01  UEZ3.
           02 FILLER    PIC    X(68).
           02 SEITE     PIC     X(5).
           02 FILLER    PIC       XX.
           02 DSEIZAE   PIC       99.
           02 FILLER    PIC     X(3).

       01  KLSATZ.
           02 KLNR             PIC    Z(6)9.
           02 FILLER           PIC     X(4).
           02 KLUMS            PIC Z(9)9.99.      
           02 FILLER           PIC    X(56).



       PROCEDURE DIVISION.
      *+++++++++++++++++++++++++++++++++++++++++++++
      *++                                         ++
      *++   P R O C E D U R E   D I V I S I O N   ++
      *++                                         ++ 
      *+++++++++++++++++++++++++++++++++++++++++++++
       
       A0. OPEN INPUT KDAT.
           OPEN OUTPUT KLISTE.
           
           MOVE ZEROS TO SEIZAE.
       
       C1. 
           MOVE ZEROS TO ZEIZAE.
           ADD 1 TO SEIZAE.
           MOVE "SEITE" TO SEITE.
           MOVE SEIZAE TO DSEIZAE. 

           WRITE ZEILE FROM UEZ3 AFTER ADVANCING PAGE.    
           MOVE SPACES TO ZEILE.  

           WRITE ZEILE FROM KOZ1 AFTER ADVANCING 1 LINES.
           MOVE SPACES TO ZEILE. 

           WRITE ZEILE FROM KOZ2 AFTER ADVANCING 1 LINES.
           MOVE SPACES TO ZEILE.

           WRITE ZEILE FROM UEZ1 AFTER ADVANCING 3 LINES.
           MOVE SPACES TO ZEILE. 

           WRITE ZEILE FROM UEZ2 AFTER ADVANCING 1 LINES.

       B1.
           MOVE SPACES TO KLSATZ.
           MOVE SPACES TO ZEILE.

           ADD 1 TO ZEIZAE.

       A1. READ KDAT AT END GO TO EOF.

           IF KSA NOT EQUAL 1 GO TO A1.
           IF KUMSJAHR NOT EQUAL 82 GO TO A1.
           IF KUMS NOT GREATER THAN 100000 GO TO A1.

           MOVE KNR TO KLNR. 
           MOVE KUMS TO KLUMS. 
           WRITE ZEILE FROM KLSATZ AFTER ADVANCING 1 LINES. 

           IF ZEIZAE NOT GREATER THAN 50 GO TO B1.
           MOVE 0 TO ZEIZAE.
           GO TO C1.

       EOF.
           CLOSE KDAT.
           CLOSE KLISTE.
           STOP RUN.
 
 
    