CSCI 360 | Spring 2014 |
For this assignment, write a program that will build and print a table of numbers.
The program should have a read loop that will process an input file one record at a time. For each input record, execute an XDECI loop that will get values from the input record and put them into the table. Once all of the values in the input file have been placed into the table, write a loop that will print all of the numbers in the table, 7 per line. Then write a loop that will print all of the numbers in the table that are multiples of 6. Again, there should be a maximum of 7 values per line of output.
The table should be defined in storage so that it can hold 60 integer values.
The input to the program will be a file with an unknown number of 80 byte records. Each record contains an unknown number of integer values separated by at least one space. For example:
1 -2005 360 515 90 50 -1 114 240 172219 60205 3 7534 204914 141 0 606031 -419 218 111 9001 27 -9090 312909 -517 9 62 89 306 464 250 118 -84 131 402 -8426 5106 121 -89 15 95220 -80 -999999 58 -77 516 14789 12 6
As mentioned above, an XDECI loop should be used to process the values on the input records. This means that there should be a non-numeric marker immediately after the storage area for the input buffer in order to stop the XDECI scan. So something like:
INPUTREC DS CL80 DC C'*'
The input file for this program has been set up so that when the entire table of numbers is displayed each output line will have exactly 7 numbers, and when the multiples of 6 are displayed each output line will have exactly 7 numbers. This means that you can write the program with 1 print line that can be used for printing both the entire table and just the multiples of 6.
Use at least one literal in the program.
Use line documentation, documentation boxes, TITLE, EJECT
, and
SPACE
as before.
Hand in a copy of your source code AND a listing of the Marist output on Blackboard.
Use the following JCL statement to specify the input file:
//FT05F001 DD DSN=KC02330.CSCI360.FILES(DATA4),DISP=SHR
Write this program incrementally. It will be much easier to debug. Initially write the program so that it reads and processes one record. Once you know it does that correctly, implement the loop.
When you are debugging logic errors, don't be reluctant to use XDUMP instructions to display registers and/or memory. Once you get the program running, remove the XDUMPs from the run that is turned in for grading.
Feel free to test the program with your own data. Simply leave out the FT05F001 statement in the JCL that was given above and place your data after the assembly END statement. It is important that the data you enter follows the same format as the grade run input file. For example:
END MAIN 1 -2005 360 515 90 50 -1 114 240 172219 60205 3 7534 204914 141 0 606031 -419 218 111 9001 27 -9090 312909 -517 9 62 89 306 464 250 118 -84 131 402 -8426 5106 121 -89 15 95220 -80 -999999 58 -77 516 14789 12 6 /* //
Make sure that the run you hand in for grading uses the file specified above and contains nothing after the END statment.
The output for the program should resemble the following:
The numbers - All 1 -2005 360 515 90 50 -1 114 240 172219 60205 3 7534 204914 141 0 606031 -419 218 111 9001 27 -9090 312909 -517 9 62 89 306 464 250 118 -84 131 402 -8426 5106 121 -89 15 95220 -80 -999999 58 -77 516 14789 12 6 The numbers - Multiples of 6 360 90 114 240 0 -9090 306 -84 402 5106 95220 516 12 6
The page header for each listing of numbers should start at the top of a new page. The lines with the numbers should be single spaced.