000100 Identification Division. 000200 Program-ID. AROMA2. 000300 000400 Environment Division. 000500 Configuration Section. 000600 Special-Names. 000700 Decimal-Point is Comma. 000800 000900 Input-Output Section. 001000 File-Control. 001100 Select Sales-File Assign to AROMA2S 001200 Organization is Sequential 001300 . 001400 Select Customer-File Assign to AROMA2C 001500 Organization is Indexed 001600 Access is Random 001700 Record Key is CF-Cust-ID 001800 . 001900 Select Oils-File Assign to AROMA2O 002000 Organization is Indexed 002100 Access is Dynamic 002200 Record Key is OF-Oil-Id 002300 . 002400 Select Work-File Assign to AROMA2W 002500 . 002600 Select Summary-Report Assign to AROMA2R 002700 Organization is Sequential 002800 . 002900 Data Division. 003000 File Section. 003100 FD Sales-File Recording Mode F. 003200 01 Sales-Rec. 003300 88 End-Of-Sales-File Value High-Values. 003400 05 SF-Cust-Id Pic X(05). 003500 05 SF-Oil-Id. 003600 10 SF-Oil-Type Pic X(01). 003700 88 Essential-Oil Value 'E'. 003800 10 SF-Oil-Nr Pic X(02). 003900 05 SF-Unit-Size Pic 9. 004000 05 SF-Units-Sold Pic 999. 004100 05 Filler Pic X(68). 004200 004300 FD Customer-File. 004400 01 Customer-Rec. 004500 88 End-Of-Customer-File Value High-Values. 004600 05 CF-Cust-ID Pic X(5). 004700 05 CF-Cust-Name Pic X(25). 004800 05 CF-Cust-Address Pic X(30). 004900 05 Filler Pic X(20). 005000 005100 FD Oils-File. 005200 01 Oils-Rec. 005300 88 End-Of-Oil-File Value High-Values. 005400 05 OF-Oil-Id Pic X(03). 005500 05 OF-Oil-Name Pic X(20). 005600 05 OF-Cost-Per-Mls Pic 99V99. 005700 05 Filler Pic X(53). 005800 005900 SD Work-File. 006000 01 Work-Rec. 006100 88 End-Of-Work-File Value High-Values. 006200 05 WF-Cust-Id Pic X(05). 006300 05 WF-Oil-Id Pic X(03). 006400 05 WF-Unit-Size Pic 9. 006500 05 WF-Units-Sold Pic 999. 006600 05 Filler Pic X(78). 006700 006800 FD Summary-Report Recording Mode F. 006900 01 Print-Line Pic X(79). 007000 007100 Working-Storage Section. 007200 77 OT-Rows Pic 99 Value 0. 007300 007400 01 Oils-Table. 007500 05 Oil-Cost-Values Occurs 35 Depending on OT-Rows. 007600 10 OT-Oil-Id Pic X(03). 007700 10 OT-Oil-Name Pic X(20). 007800 10 OT-Cost-Per-Ml Pic 99V99. 007900 008000 01 Report-Heading-Line. 008100 05 Pic X(15) Value Space. 008200 05 Pic x(35) Value 'Aromamora Summary Sales Report'. 008300 008400 01 Report-Heading-Spaceline. 008500 05 Pic X(50) Value Space. 008600 008700 01 Report-Heading-Underline. 008800 05 Pic X(15) Value Space. 008900 05 Pic X(32) Value All '-'. 009000 009100 01 Topic-Heading-Line. 009200 05 Pic X(18) Value 'Customer Name'. 009300 05 Pic X(08) Value Space. 009400 05 Pic X(10) Value 'Cust-Id'. 009500 05 Pic X(08) Value 'Sales'. 009600 05 Pic X(11) Value 'Qty-Sold'. 009700 05 Pic X(11) Value 'Sales Value'. 009800 009900 77 UCLC-Cust-Name Pic X(25). 010000 77 UCLC-Blank-Pos Pic 9(02) Value 0. 010100 010200 01 Cust-Sales-Line. 010300 05 Prn-Cust-Name Pic X(25). 010400 05 Prn-Cust-Id Pic BBB9(5). 010500 05 Prn-Cust-Sales Pic BBBBBZZ9. 010600 05 Prn-Qty-Sold Pic BBBBBZZ.ZZ9. 010700 05 Prn-Sales-Value Pic BBBBZZZ.ZZ9,99. 010800 010900 01 Total-Sales-Line. 011000 05 Pic X(35) Value Space. 011100 05 Pic X(19) Value 'Total Sales :'. 011200 05 Prn-Total-Sales Pic BBBBBBZZ.ZZ9. 011300 011400 01 Total-Qty-Sold-Line. 011500 05 Pic X(35) Value Space. 011600 05 Pic X(19) Value 'Total Qty Sold :'. 011700 05 Prn-Total-Qty-Sold Pic BBBBBZZZ.ZZ9. 011800 011900 01 Total-Sales-Value-Line. 012000 05 Pic X(35) Value Space. 012100 05 Pic X(19) Value 'Total Sales Value :'. 012200 05 Prn-Total-Sales-Value Pic BZZZZ.ZZ9,99. 012300 012400 01 Cust-Totals. 012500 05 Cust-Sales Pic 999. 012600 05 Cust-Qty-Sold Pic 9(05). 012700 05 Cust-Sales-Value Pic 9(05)V99. 012800 012900 01 Final-Totals. 013000 05 Total-Sales Pic 9(05) Value Zero. 013100 05 Total-Qty-Sold Pic 9(06) Value Zero. 013200 05 Total-Sales-Value Pic 9(06)V99 Value Zero. 013300 013400 01 Temp-Variables. 013500 05 Sale-Qty-Sold Pic 99999. 013600 05 Value-Of-Sale Pic 999999V99. 013700 05 Prev-Cust-Id Pic X(05). 013800 013900 Procedure Division. 014000 Produce-Summary-Report. 014100 Open Input Customer-File 014200 Open Input Oils-File 014300 014400 Sort Work-File On Ascending WF-Cust-Id 014500 Input Procedure Select-Essential-Oils 014600 Output Procedure Print-Summary-Report 014700 014800 If Sort-Return Not = 0 014900 Display 'Sort-Return-Code ' Sort-Return 015000 Move 99 to Return-Code 015100 End-If 015200 015300 Close Sales-File 015400 Close Summary-Report 015500 015600 GoBack 015700 . 015800 Select-Essential-Oils. 015900* Display '*** SORT Input Procedure' 016000 Open INPUT Sales-File 016100 Perform Read-Sales-File 016200 016300 016400 Perform Until End-Of-Sales-File 016500 If Essential-Oil 016600 Release Work-Rec From Sales-Rec 016700 End-If 016800 Perform Read-Sales-File 016900 End-Perform 017000 017100 . 017200 Read-Sales-File. 017300 Read Sales-File 017400 At End 017500 Set End-Of-Sales-File to True 017600 Not At End 017700 Display '*** Sales-Rec: ' Sales-Rec(1:20) 017800 End-Read 017900 . 018000 Print-Summary-Report. 018100* Display '*** SORT Output Procedure' 018200 Open Output Summary-Report 018300 Perform Print-Heading 018400 018500 018600 Perform Return-Work-File 018700 018800 Perform Print-Customer-Lines 018900 Until End-Of-Work-File 019000 019100 Write Print-Line 019200 From Report-Heading-Spaceline 019300 After Advancing 1 Line 019400 019500 Move Total-Sales to Prn-Total-Sales 019600 Write Print-Line 019700 From Total-Sales-Line 019800 After Advancing 3 Lines 019900 020000 Move Total-Qty-Sold to Prn-Total-Qty-Sold 020100 Write Print-Line 020200 From Total-Qty-Sold-Line 020300 After Advancing 2 Lines 020400 020500 Move Total-Sales-Value to Prn-Total-Sales-Value 020600 Write Print-Line 020700 From Total-Sales-Value-Line 020800 After Advancing 2 Lines 020900 . 022400 Print-Customer-Lines. 022500 Move Zero to Cust-Totals 022600 Move WF-Cust-Id to Prn-Cust-Id, Prev-Cust-Id 022700 022800 Perform Until WF-Cust-Id NOT = Prev-Cust-Id 022900 Add 1 to Cust-Sales, Total-Sales 023000 023100 Compute Sale-Qty-Sold = 023200 WF-Unit-Size * WF-Units-Sold 023300 023400 Add Sale-Qty-Sold 023500 to Cust-Qty-Sold, Total-Qty-Sold 023600 Move WF-Oil-Id to OF-Oil-Id 023700 Read Oils-File 023800 Invalid Key 023900 Display '??? WF-Oil-Id: ' WF-Oil-Id 024000 Move 0 to OF-Cost-Per-Mls 024100 Move 55 to Return-Code 024200 End-Read 024300 024400 Compute Value-Of-Sale = 024500 Sale-Qty-Sold * OF-Cost-Per-Mls 024600 Add Value-Of-Sale 024700 to Cust-Sales-Value, Total-Sales-Value 024800 024900 Perform Return-Work-File 025000 End-Perform 025100 025200 Move Prev-Cust-Id to CF-Cust-Id 025300 025400 Read Customer-File 025500 Invalid Key 025600 Move '*** N/A ***' to Prn-Cust-Name 025700 Not Invalid Key 025800 Move CF-Cust-Name to Prn-Cust-Name 025900 End-Read 026000 026100 Move Cust-Sales to Prn-Cust-Sales 026200 Move Cust-Qty-Sold to Prn-Qty-Sold 026300 Move Cust-Sales-Value to Prn-Sales-Value 026400 026500 Write Print-Line 026600 From Cust-Sales-Line 026700 After Advancing 2 Lines 026800 . 026810 Print-Heading. 026820 Write Print-Line 026830 From Report-Heading-Line 026840 After Advancing 1 Line 026850 Write Print-Line 026860 From Report-Heading-Underline 026870 After Advancing 1 Line 026880 Write Print-Line 026890 From ToPic-Heading-Line 026891 After Advancing 3 Lines 026892 Write Print-Line 026893 From Report-Heading-Spaceline 026894 After Advancing 1 Line 026895 . 026900 Return-Work-File. 027000 Return Work-File 027100 At End 027200 Set End-Of-Work-File to TRUE 027300 End-Return 027400 . 027500 027600 End Program AROMA2.