000100 cbl fastsrt 000200 Identification Division. 000300 Program-Id. FARTYG2. 000400 Environment Division. 000500 Configuration Section. 000600 Special-Names. 000700 Decimal-Point is Comma 000800 . 000900 Input-Output Section. 001000 File-Control. 001100 Select Fartygs-Fil Assign to FARTINFO 001200 Organization is Sequential 001300 Access Is Sequential 001400 . 001500 Select Sort-Fil Assign to WORK 001600 . 001700 Select Sorterad-Fartygs-Fil Assign to FARTSORT 001800 Organization is Sequential 001900 Access Is Sequential 002000 . 002100 Select Rapport-Fil Assign to FARTRAPP 002200 Organization is Sequential 002300 Access Is Sequential 002400 . 002500 Select Regioner-Fil Assign to FARTREG 002600 Organization is Relative 002700 Access Is Random 002800 Relative Key is Reg-Rel-Rec-Num 002900 . 003000 Select Kostnader-Fil Assign to FARTKOST 003100 Organization is Sequential 003200 Access Is Sequential 003300 . 003400 Select Typer-Fil Assign to FARTTYP 003500 Organization is Sequential 003600 Access Is Sequential 003700 . 003800 Data Division. 003900 File Section. 004000 FD Fartygs-Fil Recording F. 004100 01 F-Post. 004200 05 F-Namn Pic X(20). 004300 05 F-Typ Pic 9(02). 004400 88 Ubat Value 5 6. 004500 05 F-Bruttovikt Pic 9(06). 004600 88 Storbat Value 3500 Thru 99999. 004700 05 F-Besattning Pic 9(05). 004800 05 F-Region Pic 9(01). 004900 05 Pic X(46). 005000 005100 SD Sort-Fil. 005200 01 SD-Post. 005300 05 S-Namn Pic X(20). 005400 05 S-Typ Pic 9(02). 005500 05 S-Bruttovikt Pic 9(06). 005600 05 S-Besattning Pic 9(05). 005700 05 S-Region Pic 9(01). 005800 05 Pic X(46). 005900 006000 FD Sorterad-Fartygs-Fil Recording F. 006100 01 SF-Post. 006200 05 SF-Namn Pic X(20). 006300 05 SF-Typ Pic 9(02). 006400 05 SF-Bruttovikt Pic 9(06). 006500 05 SF-Besattning Pic 9(05). 006600 05 SF-Region Pic 9(01). 006700 05 Pic X(46). 006800 006900 FD Rapport-Fil Recording F. 007000 01 RAP-Post Pic X(120). 007100 007200 FD Regioner-Fil. 007300 01 REG-Post. 007400 05 Reg-Namn Pic X(80). 007500 007600 FD Kostnader-Fil Recording F. 007700 01 Kost-Post. 007800 05 Pic X(03). 007900 05 Kost-Post-Regkost Pic X(77). 008000 008100 FD Typer-Fil Recording F. 008200 01 TYP-Post. 008300 05 Typ-Kod Pic 9(02). 008400 05 Typ-Namn Pic X(25). 008500 05 Pic X(53). 008600 008700 Working-Storage Section. 008800 008900 01 Villkor Pic 9(01) Value 0. 009000 88 Inga-Fler-Fartyg Value 1. 009100 88 Inga-Fler-Typer Value 2. 009200 88 Inga-Fler-Kostnader Value 3. 009300 88 Inga-Fler-Sorterade-Fartyg Value 4. 009400 009500 01 Reg-Rel-Rec-Num Pic 9(01). 009600 01 Kostnader-Regnum Pic 9(02) Value 0. 009700 01 Sparad-Region Pic 9(02). 009800 01 Sparad-Typ Pic 9(02). 009900 010000 01 Typ-Antal Pic 9(02) Value 0. 010100 01 Typ-Tabell. 010200 05 Tab-Typ-Rad Occurs 50 Depending on 010300 Typ-Antal 010400 Indexed By Tx1. 010500 10 Tab-Typ Pic X(03). 010600 10 Tab-Namn Pic X(25). 010700 010800 010900 01 Kostnads-Tabell. 011000 05 Kostnad-Region Occurs 5. 011100 10 Kostnad-Manad Occurs 12. 011200 15 Kostnad-Typ Pic 9(04). 011300* 011400*01 Kostnads-Tabell. 011500* 05 Kostnad-Region Occurs 5. 011600* 10 Kostnad-Typ Occurs 12 Pic 9(04). 011700* 011800 011900 01 Blank-Rad Pic X(10) VAlue Space. 012000 012100 01 Rapport-Slutrad. 012200 05 Pic X(20). 012300 05 Pic X(60) Value '*** S L U T på rapport ***'. 012400 012500 01 Rapport-Rubrik. 012600 05 Pic X(20). 012700 05 Pic X(60) Value 'USSR Fartygsinventering'. 012800 012900 01 Sid-Rubrik. 013000 05 Pic X(20) Value 'Region'. 013100 05 Pic X(20) Value 'Fartygs-Typ'. 013200 05 Pic X(20) Value 'Fartygs-Namn'. 013300 05 Pic X(12) Value 'Bruttovikt'. 013400 05 Pic X(12) Value 'Besättning'. 013500 05 Pic X(15) Value 'Månadskostnad'. 013600 013700 01 Detalj-Rad. 013800 05 DR-Reg-Namn Pic X(20). 013900 05 DR-Typ Pic X(20). 014000 05 DR-Namn Pic X(20). 014100 05 Pic X(03). 014200 05 DR-Bruttovikt Pic Z(03).9(03). 014300 05 Pic X(07). 014400 05 DR-Besattning Pic Z(05). 014500 05 Pic X(04). 014600 05 DR-Manadskostnad Pic Z(03).Z(03).9(03). 014700 014800 Procedure Division. 014900 Perform Oppna-Alla-Filer 015000 Sort Sort-FIl 015100 On Ascending Key S-Region S-Typ 015200 Input Procedure Valj-Fartygsposter 015300 Giving Sorterad-Fartygs-Fil 015400 015500 If Sort-return Not = 0 015600 Display 'Sorteringsfel, kod: ' Sort-Return 015700 Move Sort-Return to Return-Code 015800 GoBack 015900 End-If 016000 Perform Fyll-Typ-Tabell 016100 Perform Fyll-Kostnad-Tabell 016200 Perform Skriv-Rubriker 016300 016400 Open Input Sorterad-Fartygs-Fil 016500 Read Sorterad-Fartygs-Fil 016600 At End 016700 Set Inga-Fler-Sorterade-Fartyg to True 016800 End-Read 016900 017000 Perform Skriv-Rapport Until Inga-Fler-Sorterade-Fartyg 017100 017200 Perform Skriv-Slutrad 017300 017400 GoBack 017500 . 017600 Skriv-Rapport. 017700 Move SF-Region to Sparad-Region Reg-Rel-Rec-Num 017800 Display '*** Skall läsa Regioner-Fil. nyckel: ' 017900 Reg-Rel-Rec-Num 018000 Read Regioner-Fil 018100 Invalid Key 018200 Display 'Region saknas för: ' Reg-Rel-Rec-Num 018300 Move 99 To Return-Code 018400 GoBack 018500 Not Invalid Key 018600 Display 'Läst region: ' Reg-Namn 018700 Move Reg-Namn to DR-Reg-Namn 018800 Perform Skriv-Rapport-For-Region 018900 Until SF-Region Not = Sparad-Region 019000 OR Inga-Fler-Sorterade-Fartyg 019100 . 019200 Skriv-Rapport-For-Region. 019300 Move SF-Typ to Sparad-Typ 019400 Set Tx1 to 1 019500 Display 'Fartyg: ' SF-NAmn 019600 Display 'Typ : ' SF-Typ 019700 Search Tab-Typ-Rad 019800 At End 019900 Display 'Typ saknas för: ' SF-Typ 020000 Move 98 to Return-Code 020100 GoBack 020200 When Tab-Typ(Tx1) = SF-Typ 020300 Move Tab-Namn(Tx1) to DR-Typ 020400 Display 'Typ: ' DR-Typ 020500 Display Space 020600 End-Search 020700 020800 Perform Skriv-Rapport-For-Typ 020900 Until SF-Typ Not Equal Sparad-Typ OR 021000 SF-Region Not Equal Sparad-Region OR 021100 Inga-Fler-Sorterade-Fartyg 021200 . 021300 Skriv-Rapport-For-Typ. 021400 Multiply SF-Besattning by Kostnad-Typ(SF-Region SF-Typ) 021500 Giving DR-Manadskostnad 021600 Move SF-Namn to DR-Namn 021700 Move SF-Besattning to DR-Besattning 021800 Move SF-Bruttovikt to DR-Bruttovikt 021900 022000 Write Rap-Post from Detalj-Rad 022100 022200 Move Spaces to Detalj-Rad 022300 022400 Read Sorterad-Fartygs-Fil 022500 At End 022600 Set Inga-Fler-Sorterade-Fartyg to True 022700 End-Read 022800 . 022900 Fyll-Kostnad-Tabell. 023000 Perform Until Inga-Fler-Kostnader 023100 Read Kostnader-Fil 023200 At End 023300 Set Inga-Fler-Kostnader to True 023400 Not AT End 023500 Add 1 to Kostnader-Regnum 023600 Move Kost-Post-Regkost 023700 to Kostnad-Region(Kostnader-Regnum) 023800 End-Read 023900 End-Perform 024000 . 024100 Fyll-Typ-Tabell. 024200 Perform Until Inga-Fler-Typer 024300 Read Typer-Fil 024400 At End 024500 Set Inga-Fler-Typer to True 024600 Display 'Har fyllt TYP-Tabellen med ' 024700 Typ-Antal ' rader' 024800 Not At End 024900 Add 1 to Typ-Antal 025000 Move Typ-Post to Tab-Typ-Rad(Typ-Antal) 025100 Display '==> ' Tab-Namn(Typ-Antal) 025200 End-Read 025300 End-Perform 025400 . 025500 Skriv-Rubriker. 025600 Write Rap-Post from Rapport-Rubrik 025700 Write Rap-Post from Blank-Rad 025800 Write Rap-Post from Sid-Rubrik 025900 Write Rap-Post from Blank-Rad 026000 . 026100 Skriv-Slutrad. 026200 Write Rap-Post from Rapport-Slutrad 026300 . 026400 Valj-Fartygsposter. 026500 Perform Until Inga-Fler-Fartyg 026600 Read Fartygs-Fil 026700 At End 026800 Set Inga-Fler-Fartyg to True 026900 Not AT End 027000 If Ubat Or Storbat 027100 Release SD-Post from F-Post 027200 Display '==> ' F-Post(1:15) 027300 End-If 027400 End-Read 027500 End-Perform 027600 . 027700 Oppna-Alla-Filer. 027800 Open Input Fartygs-Fil 027900 Open Output Rapport-Fil 028000 Open Input Regioner-Fil 028100 Open Input Kostnader-Fil 028200 Open Input Typer-Fil 028300 Display 'Alla filer är öppnade...' 028400 . 028500 End Program FARTYG2.