Aufgabenstellung

Wer mir zu dieser unglaublichen  Programmierarbeit gratulieren möchte kann dies hier  tun.

Identification Division.
Program-ID. Ln070202.
Author. 7024405.
Date-Written. 07.02.02.

*------------------------------------------------------------
Environment Division.
Configuration Section.
    Source-Computer. PC.
    Object-Computer. PC.
Special-Names. Decimal-Point is Comma.

Input-Output Section.
File-Control.
Select Datei1 Assign To "Artik-is.TXT"
                     Organization is indexed
                     Access is sequential
                     Record Key is Art-Nr1.
Select Datei2 Assign To "Art-Umsq.txt".

Select Datei3 assign To "fil-bzis.txt"
                     Organization is indexed
                     Access is sequential
                     Record Key is Fil-Nr3.

Select Datei4 Assign To "ausgabe.txt"
                     Organization is line sequential.

*------------------------------------------------------------

Data Division.
File Section.
FD Datei1.
01 Satz1.
     02 Art-Nr1 Pic 9(5).
     02 Art-Bez1 Pic X(20).
     02 Menge1 Pic 9(5).
     02 Preis1 pic 9(4)V99.

FD Datei2.
01 Satz2.
     02 Fil-Nr2 pic 99.
     02 Art-Nr2 pic 9(5).
     02 Umsatz2 pic 9(5)V99.
 

FD Datei3.
01 Satz3.
     02 Fil-Nr3 pic 99.
     02 Ort3 pic x(10).

FD Datei4.
01 Satz4 Pic X(32).

working-Storage Section.
01 mb pic 9 value 0.
01 mc pic 9 value 0.
01 gs-summe pic 9(5)V99 value 0.
01 bz pic 9 value 0.
01 zz pic 99 value 0.

01 GW-N.
     02 g2N Pic 9 Value 1.
     02 g1N Pic X(10) Value Zero.

01 GW-A.
     02 g2A Pic 9 Value 1.
     02 g1A Pic X(10) Value Zero.

01 SGE.
     02 SGE1 Pic 9 Value Zero.
     02 SGE2 Pic 9 Value Zero.

01 SGA.
     02 SGA1 Pic 9 Value 1.
     02 SGA2 Pic 9 Value 1.


01 K1.
     02 k1-Art-nr pic 9(5) value all zero.
     02 filler pic x value space.
     02 k1-art-bez pic x(20) value all "x".
     02 filler pic xxxx value " BL ".
     02 K1-Blatt pic z9 value zero.

01 k2.
     02 Filler pic x(32) value "FIL-NR ORT
-         "Umsatz".

01 EZ.
     02 Filler pic xx value all space.
     02 EZ-Fil-Nr pic 99 value all zero.
     02 filler pic x(5) value all space.
     02 ez-ort pic x(10) value all "x".
     02 filler pic x(4) value all space.
     02 ez-umsatz pic zz.zz9,99 value all zero.

01 Leer.
     02 filler pic x(32) value all space.

01 GS.
     02 Filler pic x(22) value "GESAMTUMSATZ ".
     02 gs-Umsatz pic zzz.zz9,99 value all zero.

Copy "DS-CNTRL.MF".
Copy "maske.cpb".
01 Display-Error-No Pic 9(4).

procedure division.
PhA section.
PhA-1.
     Perform pha-Vorr.
     Perform pha-SB.
     Perform Until button = 2
            Perform pha-SV
            Perform pha-Sb
     End-Perform.
     Perform pha-Schl.
     Stop Run.
PhA-9.
    Exit.

*------------------------------------------------------------

Pha-Vorr Section.
pha-Vorr-1.
*----------- Initialisierung des Screensets
Initialize DS-Control-Block.
Initialize Data-Block.
Move Data-Block-Version-No To DS-Data-Block-Version-No
Move Version-No To DS-Version-No
Move DS-New-Set To DS-Control
Move "maske" To DS-Set-Name.


Open Output Datei4.
pha-Vorr-9.
     Exit.

*------------------------------------------------------------

pha-SB Section.
pha-SB-1.
If button not = 2
     move "bild1" to ds-procedure
     call "dsgrun" using ds-control-block data-block
     if not ds-no-error
          move ds-error-code to display-error-no
          display "ds-error-No: " display-error-no
          display "Programm-Abbruch" Stop run
     end-if
end-if.

pha-sb-9.
     exit.

*------------------------------------------------------------

pha-SV Section.
pha-SV-1.
     If button = 1
        Perform Ph-B.
pha-SV-9.
     Exit.

*-----------------------------------------------------------

pha-Schl Section.
pha-Schl-1.
     Close Datei4.
pha-Schl-9.
     Exit.

ph-b section.
Ph-B-1.
     Perform phb-Vorr.
     Perform phb-SB.
     Perform Until button = 4 or 2
              Perform phb-SV
              Perform phb-SB
     End-Perform.
     Perform phb-Schl.
Ph-B-9.
     Exit.

*------------------------------------------------------------

phb-Vorr Section.
phb-Vorr-1.
     Open Input Datei1.
     Move 0 To MB.
phb-Vorr-9.
    Exit.

*-----------------------------------------------------------------

phb-SB Section.
phb-SB-1.
     If MB = 0
         Move 1 To MB
         Move Art-Nr-m To Art-Nr1
         Start Datei1 Key is = art-Nr1
               Invalid Key Move 4 To button
               Move "Keine Artikel vorhanden" To Meldung
               Move "bild1" To DS-Procedure

               Move Zero To art-nr-m
               Go To phb-SB-9
          End-Start
     End-If.

   Read Datei1 At End
          Go To phb-sb-3.


phb-sb-2.
      Move Art-Nr1 To art-nr-m
      Move art-bez1 to art-bez-m
*    Move 0 To MB.
      Move Space To Meldung
      Move "bild2" To DS-Procedure
      call "dsgrun" using ds-control-block data-block
      Go To phb-SB-9.

phb-sb-3.
      Move "Dateiende" To Meldung
      Move "bild2" To DS-Procedure
      Move 0 To MB.


phb-SB-9.
      Exit.

*------------------------------------------------------------

phb-SV Section.
phb-SV-1.
     If button = 3
         Perform Ph-C.
phb-SV-9.
    Exit.

*------------------------------------------------------------

phb-Schl Section.
phb-Schl-1.
     Close Datei1.
phb-Schl-9.
     Exit.

ph-c section.
Ph-C-1.
      Perform ph-c-vorr.
Ph-C-2.
      Perform ph-c-SB.
      Perform GRSTC.
            If SGE1 = 1 Perform GRE1C.
            If SGE2 = 1 Perform GRE2C.
                If g2N = 3 Go To Ph-C-3.
            If SGA2 = 1 Perform GRA2C.
            If SGA1 = 1 Perform GRA1C.
       Perform ph-c-SV.
       Perform GWUMC.
Go To Ph-C-2.
Ph-C-3.
       Perform ph-c-Schl.
Ph-C-9.
Exit.

ph-c-Vorr Section.
ph-c-Vorr-1.
     Open Input Datei2 datei3.
     Move 100 To GW-N GW-A.
     Move 0 To MC Gs-Summe bz.
     move 90 to zz.
ph-c-Vorr-9.
     Exit.


ph-c-sb section.

ph-c-sB-1.
     Move art-nr1 to art-nr2
     read datei2 at end move 3 to g2n.

     if mc = 0
         move 1 to mc
         move fil-nr2 to fil-nr3
             Start Datei3 Key is = fil-nr3
              Invalid Key Move "Dateiende erreicht" To Meldung
              Move "bild1" To DS-Procedure
              Move 3 To g2N
              Move Space To g1N
              Go To phc-sb-9
             End-Start
     End-If


     Read Datei3 at End Move 3 To g2N
           Go To phc-sb-9
     End-Read
     If fil-nr2 = fil-nr3
          Move 2 To g2N
          Move ort3 To g1N
      Else
           Move 3 To g2N
      End-If.

phc-SB-9.
     Exit.



GRSTC Section.
GRSTC-1.
     Move All Zero To SGA SGE.

     If g2N = 2 AND g2A = 1
         Move All "1" To SGA.

         If g2N = 2 AND g2A = 2
         If g1N Not = g1A
             Move 1 To SGE1 SGA1
         End-If
      End-If.

     If g2A = 2 AND g2N = 3
          Move All "1" To SGE.

GRSTC-9.
     Exit.


GRE1C Section.
GRE1C-1.
*----- Ende art-nr
GRE1C-2.
      move gs-summe to gs-umsatz.
GRE1C-9.
    Exit.
*------------------------------------------------------------

GRE2C Section.
GRE2C-1.
GRE2C-9.
    Exit.

*------------------------------------------------------------

GRA2C Section.
GRA2C-1.
GRA2C-2.
    Exit.

*------------------------------------------------------------
GRA1C Section.
GRA1C-1.
    Move 0 To gs-summe.
GRA1C-9.
    Exit.

*------------------------------------------------------------

ph-c-SV Section.
ph-c-sv-1.
    add umsatz2 to gs-summe.
    Move Ort3 To ez-ort
    Move fil-nr3 To ez-fil-nr
    Move umsatz2 to ez-umsatz
    Perform BWM.
    Move EZ To Satz4 Write Satz4.
    move leer to satz4 write satz4.

ph-c-SV-9.
   Exit.

*------------------------------------------------------------

GWUMC Section.
GWUMC-1.
    Move g2N To g2A
    Move g1N To g1A.
GWUMC-9.
   Exit.

*------------------------------------------------------------

Ph-c-schl section.
ph-c-schl-1.
    If g2A = 2
        Move gs-summe to gs-umsatz
        Move GS To Satz4 Write Satz4
        Move All "-" To Satz4 Write Satz4
        Move "Liste gedruckt" To Meldung
        Move "bild2" To DS-Procedure.
        call "dsgrun" using ds-control-block data-block.

     If g2A = 1
         Move "keine umsätze" To Meldung
         Move "bild2" To DS-Procedure.
         call "dsgrun" using ds-control-block data-block.
 

      close datei2 datei3.

ph-c-schl-9.
     exit.

BWM Section.
BWM-1.
     Compute ZZ = ZZ + 1
     If ZZ > 4
         Then
         Add 1 To BZ
         Move 1 To ZZ
         Move All "-" To Satz4 Write Satz4
         Move BZ To k1-blatt
         move art-nr1 to k1-art-nr
         Move art-bez1 to k1-art-bez
         Move K1 To Satz4 Write Satz4
         Move K2 To Satz4 Write Satz4.

BWM-9.
    Exit.