000100 ID DIVISION. 00010000 000200 PROGRAM-ID. DOGPGM. 00020000 000300 AUTHOR. Kenneth Caldwell. 00030000 000400 DATE-WRITTEN. February 28, 2001. 00040000 000500 DATE-COMPILED. 00050000 000600* 00060000 000700*SECURITY. This program is for students of the 00070000 000800* Train-Right JCL courses only. 00080000 000900* 00090000 001000*REMARKS. This program produces a dog report and a sorted 00100000 001100* dog file from an input dog file. You must code 00110000 001200* the proper JCL to execute the program and provide 00120000 001300* the proper files. 00130000 001400* 00140000 001500 ENVIRONMENT DIVISION. 00150000 001600 INPUT-OUTPUT SECTION. 00160000 001700 FILE-CONTROL. 00170000 001800 00180000 001900 SELECT dog-file ASSIGN TO DOGFILE. 00190000 002000 SELECT dog-report ASSIGN TO DOGRPT. 00200000 002100 SELECT dog-sorted ASSIGN TO DOGSORT. 00210000 002200 SELECT sort-file ASSIGN TO SORTWK01. 00220000 002300 EJECT 00230000 002400 DATA DIVISION. 00240000 002500 FILE SECTION. 00250000 002600 00260000 002700 FD dog-file 00270000 002800 RECORDING MODE IS F 00280000 002900 LABEL RECORDS ARE STANDARD 00290000 003000 RECORD CONTAINS 80 CHARACTERS 00300000 003100 BLOCK CONTAINS 0 records. 00310000 003200 01 dog-record. 00320000 003300 05 dog-name PIC X(10). 00330000 003400 05 dog-weight PIC 999. 00340000 003500 05 dog-breed PIC X(27). 00350000 003600 05 PIC X(40). 00360000 003700 00370000 003800 FD dog-report 00380000 003900 RECORDING MODE IS F 00390000 004000 LABEL RECORDS ARE OMITTED 00400000 004100 RECORD CONTAINS 132 CHARACTERS 00410000 004200 BLOCK CONTAINS 0 records. 00420000 004300 01 dog-report-record. 00430000 004400 05 PIC X(132). 00440000 004500 00450000 004600 FD dog-sorted 00460000 004700 RECORDING MODE IS F 00470000 004800 LABEL RECORDS ARE STANDARD 00480000 004900 RECORD CONTAINS 80 CHARACTERS 00490000 005000 BLOCK CONTAINS 0 records. 00500000 005100 01 dog-sorted-record. 00510000 005200 05 PIC X(80). 00520000 005300 00530000 005400 SD sort-file 00540000 005500 RECORD CONTAINS 80 CHARACTERS. 00550000 005600 01 sort-record. 00560000 005700 05 PIC X(10). 00570000 005800 05 sort-dog-weight PIC 999. 00580000 005900 05 PIC X(27). 00590000 006000 05 PIC X(40). 00600000 006100 EJECT 00610000 006200 WORKING-STORAGE SECTION. 00620000 006300 00630000 006400 77 ws-dog-count PIC S9(4) BINARY VALUE ZERO. 00640000 006500 00650000 006600 01 ind-eof PIC X VALUE LOW-VALUES. 00660000 006700 88 ind-eof-yes VALUE HIGH-VALUES. 00670000 006800 00680000 006900 01 dog-report-title. 00690000 007000 05 PIC X(5) VALUE SPACES. 00700000 007100 05 dog-report-requestor 00710000 007200 PIC X(21) VALUE SPACES. 00720000 007300 05 PIC X(5) VALUE SPACES. 00730000 007400 05 PIC X(11) VALUE 'Train-Right'. 00740000 007500 05 PIC X(11) VALUE ' Dog Report'. 00750000 007600 05 PIC X(30) VALUE SPACES. 00760000 007700 05 PIC X(53) VALUE SPACES. 00770000 007800 00780000 007900 01 dog-report-header. 00790000 008000 05 PIC X(5) VALUE SPACES. 00800000 008100 05 PIC X(8) VALUE 'Dog Name'. 00810000 008200 05 PIC X(5) VALUE SPACES. 00820000 008300 05 PIC X(10) VALUE 'Dog Weight'. 00830000 008400 05 PIC X(5) VALUE SPACES. 00840000 008500 05 PIC X(9) VALUE 'Dog Breed'. 00850000 008600 05 PIC X(5) VALUE SPACES. 00860000 008700 05 PIC X(33) VALUE SPACES. 00870000 008800 05 PIC X(52) VALUE SPACES. 00880000 008900 00890000 009000 01 dog-report-detail. 00900000 009100 05 PIC X(5) VALUE SPACES. 00910000 009200 05 dog-report-name PIC X(10). 00920000 009300 05 PIC X(5) VALUE SPACES. 00930000 009400 05 dog-report-weight PIC zz9. 00940000 009500 05 PIC X(10) VALUE SPACES. 00950000 009600 05 dog-report-breed PIC X(27). 00960000 009700 05 PIC X(33) VALUE SPACES. 00970000 009800 05 PIC X(52) VALUE SPACES. 00980000 009900 00990000 010000 01 dog-report-total. 01000000 010100 05 PIC X(5) VALUE SPACES. 01010000 010200 05 PIC X(12) VALUE 'Total Dogs: '. 01020000 010300 05 dog-report-count PIC ZZZ9. 01030000 010400 05 PIC X(59) VALUE SPACES. 01040000 010500 05 PIC X(52) VALUE SPACES. 01050000 010600 01060000 010700 LINKAGE SECTION. 01070000 010800 01080000 010900 01 parm-area. 01090000 011000 05 parm-length PIC S9(4) BINARY. 01100000 011100 05 parm-data. 01110000 011200 10 parm-chars OCCURS 0 TO 100 TIMES 01120000 011300 DEPENDING ON parm-length 01130000 011400 PIC X. 01140000 011500 EJECT 01150000 011600 PROCEDURE DIVISION USING parm-area. 01160000 011700 A000-START. 01170000 011800 01180000 011900 DISPLAY SPACE. 01190000 012000 DISPLAY ' Program DOGPGM has begun.'. 01200000 012100 DISPLAY SPACE. 01210000 012200 01220000 012300 PERFORM S000-Sort-Dogs. 01230000 012400 01240000 012500 PERFORM P000-Prepare-Report. 01250000 012600 01260000 012700 PERFORM B100-Read-Next-Dog. 01270000 012800 01280000 012900 PERFORM B000-Dog-Report 01290000 013000 UNTIL ind-eof-yes. 01300000 013100 01310000 013200 PERFORM F000-Finish-Dog-Report. 01320000 013300 01330000 013400 DISPLAY SPACE. 01340000 013500 DISPLAY ' Program DOGPGM has completed.'. 01350000 013600 DISPLAY SPACE. 01360000 013700 01370000 013800 MOVE ZERO TO RETURN-CODE. 01380000 013900 GOBACK. 01390000 014000 01400000 014100 B000-Dog-Report. 01410000 014200 01420000 014300 MOVE dog-name TO dog-report-name. 01430000 014400 MOVE dog-weight TO dog-report-weight. 01440000 014500 MOVE dog-breed TO dog-report-breed. 01450000 014600 01460000 014700 WRITE dog-report-record FROM dog-report-detail 01470000 014800 AFTER ADVANCING 1 LINE. 01480000 014900 01490000 015000 PERFORM B100-Read-Next-Dog. 01500000 015100 01510000 015200 B100-Read-Next-Dog. 01520000 015300 01530000 015400 READ dog-file NEXT RECORD 01540000 015500 AT END MOVE HIGH-VALUES TO ind-eof 01550000 015600 NOT AT END ADD +1 TO ws-dog-count 01560000 015700 END-READ. 01570000 015800 EJECT 01580000 015900 F000-Finish-Dog-Report. 01590000 016000 01600000 016100 MOVE ws-dog-count TO dog-report-count. 01610000 016200 01620000 016300 WRITE dog-report-record FROM dog-report-total 01630000 016400 AFTER ADVANCING 3 LINES. 01640000 016500 01650000 016600 CLOSE dog-file, 01660000 016700 dog-report. 01670000 016800 01680000 016900 P000-Prepare-Report. 01690000 017000 01700000 017100 IF parm-length = ZERO 01710000 017200 THEN MOVE 'No Requestor' TO dog-report-requestor 01720000 017300 ELSE MOVE parm-data TO dog-report-requestor 01730000 017400 END-IF. 01740000 017500 01750000 017600 OPEN INPUT dog-file, 01760000 017700 OUTPUT dog-report. 01770000 017800 01780000 017900 WRITE dog-report-record FROM dog-report-title 01790000 018000 AFTER ADVANCING PAGE. 01800000 018100 01810000 018200 WRITE dog-report-record FROM dog-report-header 01820000 018300 AFTER ADVANCING 3 LINES. 01830000 018400 01840000 018500 MOVE SPACES TO dog-report-record. 01850000 018600 WRITE dog-report-record 01860000 018700 AFTER ADVANCING 1 LINE. 01870000 018800 01880000 018900 S000-Sort-Dogs. 01890000 019000 01900000 019100 SORT sort-file 01910000 019200 ON ASCENDING KEY sort-dog-weight 01920000 019300 USING dog-file 01930000 019400 GIVING dog-sorted. 01940000