Question: This assignment is an introduction to working with packed decimal data and instructions. It is not meant to be difficult but rather help you understand
This assignment is an introduction to working with packed decimal data and instructions. It is not meant to be difficult but rather help you understand the radically different instructions and how packed decimal and zoned decimal numbers are stored and manipulated. Refer to the Lecture Notes on Packed Decimal on Blackboard to help you.
To start, copy your ASSIGN7 PDSE member and name it ASSIGN8 (Don't forget to change the END statement too!). You can also refer to the sample program provided alongside this document on Blackboard.
Replace the beginning CSECT and USING statements with the following standard entry linkage (more about this later):
ASSIGN8 CSECT
PRINT NOGEN DO NOT EXPAND MACROS
STM 14,12,12(13) SAVE REGS IN CALLER'S SAVE AREA
LR 12,15 COPY CSECT ADDRESS INTO R12
USING ASSIGN8,12 ESTABLISH R12 AS THE BASE REG
LA 14,SAVEAREA R14 POINTS TO THIS CSECT's SAVE AREA
ST 14,8(,13) STORE ADDRESS OF THIS CSECT's SAVE AREA
ST 13,4(,14) STORE ADDRESS OF CALLER'S SAVE AREA
LR 13,14 POINT R13 AT THIS CSECT'S SAVE AREA
Replace the final BR 14 statement in your program with the following standard exit linkage (more about this later):
SR 15,15 R15 = RETURN CODE OF 0
L 13,4(,13) POINT R13 TO CALLER'S SAVE AREA
L 14,12(,13) RESTORE REGISTER 14
LM 0,12,20(13) RESTORE R0 THRU R12
BR 14 RETURN TO CALLER
At the top of your storage area following the LTORG, declare the following:
SAVEAREA DC 18F'-1' REGISTER SAVE AREA
Like every Assembler program in the real world, your code for this program will be written between the standard entry linkage and the standard exit linkage. At this point, see if you can get it to completely execute. If you get the same results as you did with your Assignment 7 program, you will know you've copied the standard entry and exit linkage into your program correctly. Note that register 12 will now be used as the base register of your entire program, not register 15.
Note also that the standard exit linkage first zeros out register 15 and also note that, although we are restoring ALL of the other registers, we are not restoring register 15 before the BR 14 in the standard exit linkage. If we did, this would put something different in register 15 and the SR 15,15 would have been worthless. So, this is the standard way we send back a return code of 0 to the caller.
Now that you're done with the above, here we go!
This program will be very much like your Assignment 7 program but the arithmetic will all change. We are going to use packed decimal arithmetic instead of binary arithmetic. The input data set is:
DSN=KC02322.CSCI360.DATAFA18(DATA8),DISP=SHR
Each record has the following format:
| Cols. | Field Name | Range |
| 1-8 | Employee ID | 00000000 to 99999999 |
| 9-13 | Hourly Pay | $000.01 to $999.99 |
| 14-18 | Hours Worked | 000.01 to 999.99 |
| 19-23 | Deduction Amount | $000.01 to $999.99 |
| 24-28 | Bonus Amount | $000.01 to $999.99 |
| 29-53 | Employee Name | alphanumeric |
Employee ID, Hourly Pay, Hours Worked, Deduction Amount and Bonus Amount are all zoned decimal numbers in the data set.
Hourly Pay, Hours Worked, Deduction Amount and Bonus Amount all have two implied decimal places (dollars and cents).
The definition of the input record could be defined in storage as follows.
RECORD DS 0H
IEMPID DS ZL8
IHRPAY DS ZL5
IHOURS DS ZL5
IDEDUCT DS ZL5
IBONUS DS ZL5
IEMPNME DS CL25
DS CL27
Remember that, when you work with packed decimal numbers, it is your responsibility to keep track of where the decimal point is implied in the packed decimal field. Decimal points are NEVER stored in numeric storage!
A good example of where this is especially important is the result of multiplication. If you will remember from your elementary school math, when you multiply two numbers with decimal places, the product has as many decimal places as the number of decimal places of the multiplier added to the number of decimal places of the number being multiplied. For example, if you multiply a number with four decimal places by one with two, the product will have six decimal places.
Hint: This becomes important when you multiply the Hourly Pay by the Hours Worked.
All of the Deductions, Bonuses and Gross Pay Amounts should be accumulated and printed as shown in the exact output provided.
Make sure that your output looks as close to the example output as possible. The TA cannot take off points if yours matches the example.
Document your program completely and submit your single .txt file on Blackboard as before.
EXACT OUTPUT
EMPLOYEE PAYROLL REPORT EMPLOYEE EMPLOYEE HOURLY HOURS DEDUCTION BONUS EMPLOYEE PAYCHECK ID NAME PAY RATE WORKED AMOUNT AMOUNT AMOUNT -------- ------------------------- -------- ------- ---------- ---------- ------------------ 02345245 JOAN TOWER $15.25 80.50 $25.10 $500.22 $1,702.75 03456322 WOLFGANG AMADEUS MOZART $19.00 80.75 $0.00 $13.44 $1,547.69 04032233 RICHARD STRAUSS $10.29 80.00 $31.23 $254.00 $1,045.97 06465120 AMY BEACH $22.00 80.00 $15.09 $900.25 $2,645.16 06560023 DAME ETHEL SMYTHE $23.75 28.25 $34.15 $70.85 $707.64 13870322 PETER ILYICH TCHAIKOVSKY $22.95 80.50 $21.25 $0.00 $1,826.23 14966277 ANTON BRUCKNER $20.20 78.67 $0.79 $210.23 $1,798.57 -------- ------------------------- ---------- ---------- ------------------ TOTALS: 7 EMPLOYEE(S) $127.61 $1,948.99 $11,274.01
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
