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