The games division of Attosoft has been developing a game called LifeSim. It is now in beta testing with a number of players. There are several files of information about players and the scores they have achieved.
Attosoft needs a report listing players and their average scores, and a second report listing errors detected in the processing.
Input Files
The first input file is named KC02314.SUMMER09.CSCI465.HW6.NAMES and contains records having the following format:
Last Name 15 characters
First Name 10 characters
Telephone 10 digits
The second input file is named KC02314.SUMMER09.CSCI465.HW6.SCORES and contains records having the following format:
Last Name 15 characters
First Name 10 characters
Date 8 digits in DDMMYYYY format
Score 5 digits with a trailing sign (6 bytes in all)
Both files are catalogued, and each has been sorted in ascending order by Last Name (1st key) and First Name (2nd key).
Notice that a score can be negative, a unique feature of this game. To read this, use the "Sign is Trailing Separate" clause on the Pic clause.
Processing
Make a dynamic call to ERROROUT, passing it a 120-byte field containing a page heading titled "LifeSim Scores Error Report".
Read through the two files together. For each player in the Names File, there are zero or more records in the Scores file. (Some people played repeatedly and some forgot to do it at all.)
For each player, accumulate a count of the number of games played, the highest score achieved, the lowest score achived and the total score.
For each player, make a static call to an ASM subprogram called IDCODE, passing it the player's First Name, Last Name and Telephone and an 8-byte field in which to return an ID number. (In the main report, we will identify players by ID number, not by name, for the sake of privacy.) See below for a description of IDCODE.
For each player, make a static call to a COBOL subprogram called AVERAGE, passing it the player's number of games and total score and a numeric field in which to return the average score (with 1 digit to the right of the decimal point). See below for a description of AVERAGE.
If the return codes from both subprograms are 0, print a line in the main report containing the ID number, highest score, lowest score and average score.
If either of the return codes from the subprograms is not 0, make a dynamic call to a subprogram called ERROROUT, passing it a 120-byte detail line containing the player's Last Name, First Name, Telephone (in 999-999-9999 format) and (if possible) average score, as well as an error message such as "Missing Telephone Number" or "No games for this player" or both.
When all other processing is done, make one last call to ERROROUT passing it a 120-byte detail line which is entirely blank. (This will cause ERROROUT to close its output file.)
ERROROUT subprogram
This has already been written for you. The load module for it is in a PDS called KC02314.SUMMER09.CSCI465.HW6.LIB.
ERROROUT writes to a DD statement:
//ERRORS DD SYSOUT=*
List this DD statement after the the DD statement for your main report.
IDCODE subprogram
The IDCODE subprogram is written in ASM. It creates an ID number which consists of the first 2 letters of the Last Name followed by the last 4 digits of the Telephone followed by the first 2 characters of the First Name.
If the Telephone number is blank (all spaces), IDCODE should provide a return code of 8. Otherwise the return code should be 0.
AVERAGE subprogram
The AVERAGE subprogram is written in COBOL.
If the number of games played is 0, the subprogram should end with a return code of 16. Otherwise it should calculate the average score and end with a return code of 0.
Other Requirements
The main program should accept an EXEC-line PARM of the form 'YYYYDDMM,N', where YYYYDDMM is the date to put in the heading of the main report, and N is 1, 2 or 3 to indicate whether detail lines in the main report are to be single-spaced, double-spaced or triple-spaced. The main program should check the PARM. If it is missing or invalid, the main program should end immediately with a return code of 999. For the PARM to be valid, we need the following: the PARM length should be correct; the date and the value N must be numeric; DD must be between 1 and 31; MM must be between 1 and 12; and N must be between 1 and 3.
You should write your own JCL for this assignment, using the COBOL compiler (twice), the assembler, the linkage editor, and two fetch steps. In one fetch step, use the correct PARM = '20092207,3', and in the other fetch step, omit the PARM altogether.
Make your load library a temporary file.
The main report should have a title = 'LifeSim Scores Report'. It should have a second title stating 'Report prepared by Your Name'. It should include a date (taken from the PARM) and a page number.
Include page numbers in your report and print no more than 52 lines per page including page headings and column headings.
The ERROROUT subprogram is not your responsibility. You simply need to use it. When you send it a line, as an argument, do not worry about a carriage control character.
You may need to use the Linkage Editor ENTRY control statement to identify to the Linkage Editor which of the three object modules is to be considered the entry point (i.e., the first program to be executed). This will be discussed in class.
Linkage Editor control statements (if you need them) are included in SYSLIN as an in-stream data set concatenated with the object modules, as in:
//SYSLIN DD DSN=&&OBJ1,UNIT=PUB,DISP=(OLD,DELETE)
// DD DSN=&&OBJ2,UNIT=SYSALLDA,DISP=(OLD,DELETE)
// DD DSN=&&OBJ3,UNIT=SYSALLDA,DISP=(OLD,DELETE)
// DD *
ENTRY MAIN
/*
It is also possible that you will need the control statement AMODE(24) for the Linkage Editor. This will also be discussed in class.
You should pass the MAP option to the Linkage Editor.
Include facilities to help you debug this program.
You may want to use TERMTHDACT(DUMP). Remember that if a dump is generated, it is written to a DD:
//CEEDUMP DD SYSOUT=*
If you want to use the DISPLAY verb, remember that it writes to the SYSOUT data set. Do not use the DD name SYSOUT for anything else if you want to use it for DISPLAY.
You may want to include an XSNAPOUT DD statement in the execution step so you can use XSNAP in your Assembler code. If you want to use XSNAP, you may need to use AMODE(24), and you may experience some difficulty with the Linkage Editor. You may want to develop your program using the Loader instead and switch to using the Linkage Editor and Fetch later.