000100 Identification Division. 000200 Program-Id. CAMPBOOK. 000300 000400 Environment Division. 000500 Input-Output Section. 000600 File-Control. 000700 Select Purchase-Req-File Assign to PREQDD 000800 Organization is Indexed 000900 Access Mode is Dynamic 001000 Record Key is Pr-Number 001100 Alternate Record Key is Pr-Lecturer-Name 001200 With Duplicates 001300 Alternate Record Key is Pr-Book-Num 001400 with duplicates 001500 . 001600 Select Book-File Assign to BOOKDD 001700 Organization is Indexed 001800 Access Mode is Dynamic 001900 Record Key is Bf-Book-Num 002000 Alternate Record Key is Bf-Publisher-Num 002100 with duplicates 002200 . 002300 Select Publisher-File Assign to PUBDD 002400 Organization is Indexed 002500 File Status is Pf-Status 002600 Access Mode is Dynamic 002700 Record Key is Pf-Publisher-Num 002800 Alternate Record Key is Pf-Publisher-Name 002900 . 003000 Select Report-File Assign to RPTDD 003100 . 003200 Data Division. 003300 File Section. 003400 FD Purchase-Req-File. 003500 01 Rec. 003600 05 Pr-Number Pic X(04). 003700 05 Pr-Lecturer-Name Pic X(20). 003800 05 Pr-Book-Num Pic X(04). 003900 05 Pr-Module-Code Pic X(05). 004000 05 Pr-Copies-Required Pic 9(03). 004100 05 Pr-Semester Pic 9(01). 004200 05 Pic X(43). 004300 004400 FD Book-File. 004500 01 Book-Rec. 004600 05 Bf-Book-Num Pic X(04). 004700 05 Bf-Publisher-Num Pic X(04). 004800 05 Bf-Book-Title Pic X(30). 004900 05 Pic X(42). 005000 005100 005200 FD Publisher-File. 005300 01 Publisher-Rec. 005400 05 Pf-Publisher-Num Pic X(04). 005500 05 Pf-Publisher-Name Pic X(20). 005600 05 Pf-Publisher-Address Pic X(40). 005700 05 Pic X(16). 005800 005900 FD Report-File Recording Mode F. 006000 01 Report-Rec Pic X(120). 006100 006200 Working-Storage Section. 006300 01 WS-Page-Number Pic 9(02) Value 0. 006400 01 WS-Line-Number Pic 9(02) Value 0. 006500 88 Line-Max Value 15. 006600 88 Line-Start Value 0. 006700 006800 01 File-StatusIndicators. 006900 05 Pf-Status Pic X(02). 007000 007100 01 Previous-Publisher-Name Pic X(20). 007200 007300 01 Current-Semester Pic 9. 007400 007500 01 Eof-Names. 007600 05 Pic 9(01) Value 0. 007700 88 End-Of-Pr-File Value 1. 007800 88 Not-End-Of-Pr-File Value 0. 007900 008000 05 Pic 9(01) Value 0. 008100 88 End-Of-Books Value 1. 008200 88 Not-End-Of-Books Value 0. 008300 008400 05 Pic 9(01) Value 0. 008500 88 End-Of-Publishers Value 1. 008600 88 Not-End-Of-Publishers Value 0. 008700 008800 01 Report-Heading1. 008900 05 Pic X(25) Value Space. 009000 05 Pic X(50) Value 'Purchase-Requirements-Report'. 009100 009200 01 Report-Heading2. 009300 05 Pic X(25) Value Space. 009400 05 Pic X(28) Value All '-'. 009500 009600 01 Report-Footing1. 009700 05 Pic X(10) Value Space. 009800 009900 01 Report-Footing2. 010000 05 Pic X(50) Value '*** End Of Report ***'. 010100 010200 01 Page-Heading1. 010300 05 Pic X(25) Value 'Publisher Name'. 010400 05 Pic X(35) Value 'Book Title'. 010500 05 Pic X(08) Value 'Qty'. 010600 05 Pic X(20) Value 'Lecturer Name'. 010700 05 Pic X(08) Value 'Page : '. 010800 05 Page-Heading1-Page-Number Pic ZZ. 010900 011000 01 Page-Heading2. 011100 05 Pic X(10) Value Space. 011200 011300 01 PL-Print-Line. 011400 05 Pl-Publisher-Name Pic X(20). 011500 05 Pic X(05) Value Space. 011600 05 Pl-Book-Title Pic X(30). 011700 05 Pic X(05) Value Space. 011800 05 Pl-Copies-Required Pic X(03). 011900 05 Pic X(05) Value Space. 012000 05 Pl-Lecturer-Name Pic X(20). 012100 05 Pic X(08) Value Space. 012200 012300 Linkage Section. 012400 01 JCL-Parameter. 012500 05 JCL-Parameter-Length Pic S9(04) Binary. 012600 05 JCL-Parameter-Data Pic X. 012700 88 Valid-JCL-Parameter Value '1', '2'. 012800 012900 Procedure Division Using JCL-Parameter. 013000 Perform Validate-Parameter 013100 If Not Valid-JCL-Parameter 013200 GoBack 013300 Else 013400 Move JCL-Parameter-Data to Current-Semester 013500 End-If 013600 013700 Open Input Purchase-Req-File 013800 Open Input Book-File 013900 Open Input Publisher-File 014000 Open Output Report-File 014100 014200 Perform Print-Report-Headings 014300 Perform Print-Page-Headings 014400 014500 Move Low-Values to Pf-Publisher-Name. 014600 Start Publisher-File 014700 Key is >= Pf-Publisher-Name 014800 Invalid Key 014900 Display 'START Pub file error' 015000 Display ' file status ' Pf-Status 015100 Move 97 to Return-Code 015200 GoBack 015300 Not Invalid Key 015400 Perform Read-Publisher-File-Next 015500 End-Start 015600 015700 Perform Print-Report-Footing 015800 Close Purchase-Req-File 015900 Close Book-File 016000 Close Publisher-File 016100 Close Report-File 016200 GoBack 016300 . 016400 Read-Publisher-File-Next. 016500 Perform Until End-Of-Publishers 016600 Read Publisher-File Next Record 016700 At End 016800 Set End-Of-Publishers to True 016900 Display '*** Slut på Publisher' 017000 Not At End 017100 Display '*** Read : ' PF-Publisher-Name 017200 Perform Read-Book-File 017300 End-Read 017400 End-Perform 017500 . 017600 017700 Read-Book-File. 017800 017900 Display '*** Print Req Pub Num ' Pf-Publisher-Num 018000 Display '*** Print Req Pub Name ' Pf-Publisher-Name 018100 Display Space 018200 018300 Move Pf-Publisher-Num to Bf-Publisher-Num 018400 Read Book-File 018500 Key is Bf-Publisher-Num 018600 Invalid Key 018700 Display 'No book for Publisher :' Publisher-Rec 018800 Move Zeros to Bf-Publisher-Num 018900 Not Invalid Key 019000 Display '*** Found book no: ' Bf-Book-Num 019100 Perform Read-Preq-File Until 019200 (Pf-Publisher-Num NOT = Bf-Publisher-Num) 019300 OR 019400 End-Of-Books 019500 End-Read 019600 . 019700 Read-Preq-File. 019800 Move Bf-Book-Num TO Pr-Book-Num 019900 Read Purchase-Req-File 020000 Key is Pr-Book-Num 020100 Invalid Key 020200 Display 'No request for bookno : ' Bf-Book-Num 020300 Move Zeros to BF-Book-Num 020400 Not Invalid Key 020500 Display '*** Found req for book: ' Bf-Book-Num 020600 End-Read 020700 Display Space 020800 Perform Until Bf-Book-Num NOT EQUAL TO Pr-Book-Num 020900 OR End-Of-Pr-File 021000 If Pr-Semester = Current-Semester 021100 Display '*** Printing... ' BF-Book-Num 021200 Perform Print-PL-Print-Line 021300 End-If 021400 Read Purchase-Req-File NEXT RECORD 021500 At End 021600 Display '*** End of Preq-File' 021700 Set End-Of-Pr-File TO TRUE 021800 Not At End 021900 Display '*** Found (2) Req for book : ' Bf-Book-Num 022000 End-Read 022100 End-Perform 022200 022300 Read Book-File Next Record 022400 AT End 022500 Set End-Of-Books to True 022600 Not At End 022700 Display '*** Book-Number: ' BF-Book-Num 022800 End-Read 022900 . 023000 Print-Pl-Print-Line. 023100 Add 1 to WS-Line-Number 023200 If Line-Max 023300 Perform Print-Page-Headings 023400 Set Line-Start to True 023500 End-If 023600 023700 If PF-Publisher-Name = Previous-Publisher-NAme 023800 Move Space to Pl-Publisher-Name 023900 Else 024000 Move PF-Publisher-Name to Pl-Publisher-Name 024100 Previous-Publisher-Name 024200 End-If 024300 Move BF-Book-Title to Pl-Book-Title 024400 Move Pr-Copies-Required to Pl-Copies-Required 024500 Move Pr-Lecturer-Name to Pl-Lecturer-Name 024600 Write Report-Rec from Pl-Print-Line 024700 . 024800 Print-Report-Footing. 024900 Write Report-Rec from Report-Footing1 025000 Write Report-Rec from Report-Footing2 025100 . 025200 Print-Report-Headings. 025300 Write Report-Rec from Report-Heading1 025400 Write Report-Rec from Report-Heading2 025500 . 025600 Print-Page-Headings. 025700 Write Report-Rec from Page-Heading2 025800 Add 1 to WS-Page-Number 025900 Move WS-Page-Number to Page-Heading1-Page-Number 026000 Write Report-Rec from Page-Heading1 026100 Write Report-Rec from Page-Heading2 026200 . 026300 Validate-Parameter. 026400 If JCL-Parameter-Length = 0 026500 Display 'Parameter missing in JCL' 026600 Move 99 to Return-Code 026700 Else If Not Valid-JCL-Parameter 026800 Display 'JCL-parameter NOT 1 or 2' 026900 Move 97 to Return-Code 027000 End-If 027100 End-If 027200 .