000100 ID DIVISION. 00010000 000200 PROGRAM-ID. TRPGM71. 00020000 000300*AUTHOR. Kenneth W. Caldwell. 00030000 000400*INSTALLATION. Train-Right. 00040000 000500*DATE-WRITTEN. December 5, 2010. 00050000 000600*DATE-COMPILED. 00060000 000700* 00070000 000800*SECURITY. This program is for students of Train-Right 00080000 000900* courses ONLY!. 00090000 001000* 00100000 001100*REMARKS. This program plays Rock, Paper, Scissors. 00110000 001200* It is a Non-Conversational program. 00120000 001300* 00130000 001400 DATA DIVISION. 00140000 001500 WORKING-STORAGE SECTION. 00150000 001600 01. 00160000 001700 05 pgm-choice PIC 9 PACKED-DECIMAL. 00170000 001800 05 result. 00180000 001900 10. 00190000 002000 15 user-input. 00200000 002100 20 user-tranid PIC X(5) VALUE SPACES. 00210000 002200 20 user-choice PIC X(8) VALUE SPACES. 00220000 002300 15 PIC X(67) VALUE SPACES. 00230000 002400 10 msg1 PIC X(80). 00240000 002500 10 msg2 PIC X(80) VALUE 00250000 002600 'Change your choice and press ENTER to play again. Cle00260000 002700- 'ar screen to stop playing.'. 00270000 002800 00280000 002900 PROCEDURE DIVISION. 00290000 003000 Main. 00300000 003100 COMPUTE pgm-choice ROUNDED = 00310000 003200 FUNCTION RANDOM(eibtaskn + eibtime) * 2 00320000 003300 END-COMPUTE. 00330000 003400 00340000 003500 Receive-Trans-Input. 00350000 003600 EXEC CICS IGNORE CONDITION LENGERR END-EXEC. 00360000 003700 EXEC CICS RECEIVE INTO(user-input) 00370000 003800 MAXFLENGTH(LENGTH OF user-input) 00380000 003900 END-EXEC. 00390000 004000 00400000 004100 Process-Data. 00410000 004200 EVALUATE user-choice ALSO pgm-choice 00420000 004300 WHEN 'ROCK' ALSO 0 00430000 004400 MOVE 'Two Rocks is a tie.' TO msg1 00440000 004500 WHEN 'PAPER' ALSO 1 00450000 004600 MOVE 'Two Papers is a tie.' TO msg1 00460000 004700 WHEN 'SCISSORS' ALSO 2 00470000 004800 MOVE 'Two Scissors is a tie.' TO msg1 00480000 004900 WHEN 'ROCK' ALSO 1 00490000 005000 MOVE 'Paper covers Rock - I win!' TO msg1 00500000 005100 WHEN 'ROCK' ALSO 2 00510000 005200 MOVE 'Rock smashes Scissors - You win!' TO msg1 00520000 005300 WHEN 'PAPER' ALSO 0 00530000 005400 MOVE 'Paper covers Rock - You win!' TO msg1 00540000 005500 WHEN 'PAPER' ALSO 2 00550000 005600 MOVE 'Scissors cut Paper - I win!' TO msg1 00560000 005700 WHEN 'SCISSORS' ALSO 0 00570000 005800 MOVE 'Rock smashes Scissors - I win!' TO msg1 00580000 005900 WHEN 'SCISSORS' ALSO 1 00590000 006000 MOVE 'Scissors cut Paper - You win!' TO msg1 00600000 006100 WHEN OTHER 00610000 006200 MOVE 'You did not select "Rock", "Paper", or "Scissors". Pl00620000 006300- 'ease try again.' TO msg1 00630000 006400 END-EVALUATE. 00640000 006500 00650000 006600 Send-Result. 00660000 006700 EXEC CICS SEND FROM(result) ERASE END-EXEC. 00670000 006800 EXEC CICS SEND CONTROL CURSOR(LENGTH OF user-tranid) 00680000 006900 END-EXEC. 00690000 007000 00700000 007100 Process-Exit. 00710000 007200 EXEC CICS RETURN END-EXEC. 00720000 007300* Dummy GOBACK. 00730000 007400 GOBACK. 00740000