Page 4 of 6

Re: Need help with practice assignment!!

PostPosted: Mon Apr 06, 2015 1:09 am
by pintu1228
I HAVE ATTACHED MY OUTPUT FILE, ALL I SEE IS THE DUMP FROM BUILD AND NOTHING FROM COMPUTE SUBROUTINE.

IT'S KINDA ODD.


THANKS

Re: Need help with practice assignment!!

PostPosted: Mon Apr 06, 2015 3:46 am
by Robert Sample
1. The CMPUTE subprogram calculates data -- what output do you expect from it?
2. Your XDUMP on line 28 is still too small.
3. You have not placed an XDUMP TABLE,800 between line 32 and 33 as previously recommended.

Have you manually traced CMPUTE to see what happens? If you do such manual debugging, you should get something like:
- Enter CMPUTE
- Save registers and establish addressability
- Load 3 of the 4 parameters into registers 2, 3, 4
- Point R6 to the start of TABLE
- Point R7 to the end of TABLE
Cloop:
- Check to see if you've reached end of table and go to EXIT2 if so
- Increment R6 (thereby completely skipping the first record of data)
- Compare R6 to end of table (for no known reason and no purpose since there's no branch after)
Top:
- Zero out total and add price value to it (see note 1 below)
- Zero out discount sum and add discount to it
- Multiply number by price
- Compare product to CMP
- if not > zero tship and add noship to it
- else zero tship and add shipping charge to it
- Add shipping charge to total
- Subtract discount value from total
- Zero ttotal and add total to it (see note 2 below)
- Add total to grand total
- Add 1 to number sales
- Go back to Top
- Go back to Cloop

Note 1: Your loop goes to end of table -- what if you don't have 25 records of data? If so, will you have packed data to process?
Note 2: It looks like you have too many variables -- why have a total and a ttotal? Are they both going to be printed? You also don't have enough variables -- where are you counting the number of orders with free shipping? Where are you finding the largest single order value?

You should count the records while loading the table in BUILD so you can use the count in CMPUTE and hence not attempt to process invalid packed decimal data.

Re: Need help with practice assignment!!

PostPosted: Mon Apr 06, 2015 4:35 am
by pintu1228
1. The compute subroutine is supposed to calculate the Total Cost and store the Total Cost and Shipping amount (from the if/else statement) in the table. Also I have to find the Grand total (sum of Total Costs of all sales) and Count the number of sales.

2. XDUMP is only for the build subroutine, the teacher wants to see only 300.

3. I will put the XDUMP where is recommended.


As for how to make this compute routine work, can you provide the code to modify?

I need to do the PRINT subroutine and TOTALS routine also.

this is what the teacher said to change and I did (in order to get the CMPTE routine to work):

TOP CR ... where you check for EOT
BE DONE
move your process entry code to here in loop

B TOP

I have attached my code and the instructions for what the professor wants if you want to look at it.

Thanks

Re: Need help with practice assignment!!

PostPosted: Mon Apr 06, 2015 5:54 am
by steve-myers
You are dumping TABLE after you have run BUILD, and before you run CMPUTE. It might be a good idea to repeat the XDUMP macro after you run CMPUTE.

Re: Need help with practice assignment!!

PostPosted: Mon Apr 06, 2015 5:59 am
by Robert Sample
As for how to make this compute routine work, can you provide the code to modify?
We cannot provide you any such code as we do not know whether or not your compute routine is working. You have provided us with no evidence about what it is calculating, and it would be a waste of our time to continue.

You need to either (1) add an XDUMP after the compute routine is done to verify the results, or (2) proceed on the assumption that it is working and write the PRINT and TOTAL routines. Please stop asking us to tell you how to modify the compute routine because we don't know if it needs modification at this point. The only thing known for sure is that you had the increment of R6 in the wrong place and hence the first record would not have any calculations done.

Re: Need help with practice assignment!!

PostPosted: Mon Apr 06, 2015 6:03 am
by pintu1228
HERE YOU GO.

I VERIFIED COMPUTE WORKS, NOW FOR PRINT DOES IT LOOK RIGHT? WHATS WITH THE ERROR IN THE MAIN.

Re: Need help with practice assignment!!

PostPosted: Mon Apr 06, 2015 6:55 am
by Robert Sample
You have defined PRINT as a DSECT not a CSECT. Unless you allocate memory and establish addressability, PRINT is an unresolved external reference -- it does not exist in your program so it must exist outside your program (if it exists at all). PRITN has numerous errors but they won't show up until the unresolved external reference is resolved and PRINT actually gets executed.

Re: Need help with practice assignment!!

PostPosted: Mon Apr 06, 2015 7:06 am
by pintu1228
YES I SAW THAT BEFORE YOU REPLIED.

HERE IS THE DUMPS BUT NOT PRINTING TABLE WITH EACH COLUMN.

Re: Need help with practice assignment!!

PostPosted: Mon Apr 06, 2015 7:38 am
by Robert Sample
In line 77 you are still converting price from the card as 4 characters, so the quantity for the first record became 472 instead of 47.
In line 136 you ZAP $TTOTAL for 6 bytes, which causes the first byte of the next table entry to be changed. You can see this in the XDUMP after CMPUTE is done.
In line 173 you have LM R2,R2,0(R1) -- you passed 2 parameters but only loaded one into a register.
In line 177 you SHOULD be comparing R5 to the register containing EOT, but since you did not load that value into a register in line 173 you don't have access to it.
In line 178 you compare R5 to the value you just loaded so it is no wonder you branched to OVER immediately without printing anything.
In line 199 you print 89 characters, yet the print line is more than 89 characters.

There is a problem in CMPUTE with storing the shipping charge in the table as you are getting invalid packed decimal values (LOW-VALUES) for each of them. Lines 129 and 132 use 4 bytes for $TSHIP which means the last 2 bytes are overwritten with the final field in the table. You thus wind up with LOW-VALUES in $TSHIP every record.
You did not print the header before PLOOP; the header needs to be printed before starting the loop.
Your edit masks are drastically wrong and will NOT provide what you expect for your output.
You did not print the summary data after line 202 that your teacher is looking for.

Re: Need help with practice assignment!!

PostPosted: Mon Apr 06, 2015 8:03 am
by pintu1228
ok i made changes, can you clarify regarding line 77 (i chose it that way cause the teacher gave us the DSECT values and also the values that we are supposed to pack).

I am getting stuff to print but I can't get the column names to be printed under sales report. I inserted the summary report header.

Can you help me fix why my column names are not displayed with their associated data.


Thanks you been really helpful (this topic is confusing to me).