Need help with practice assignment!!



High Level Assembler(HLASM) for MVS & VM & VSE

Need help with practice assignment!!

Postby pintu1228 » Fri Apr 03, 2015 8:43 am

I need help with figure out how to do the Compute subroutine...I am lost on how to do this once I called the Dsect into a register. Can someone help me start the code to do the subroutine?


I have attached the pdf of the instructions for the assignment and also a text file with the code that I have so far.


Thanks
You do not have the required permissions to view the files attached to this post.
pintu1228
 
Posts: 48
Joined: Mon Mar 23, 2015 12:41 am
Has thanked: 5 times
Been thanked: 0 time

Re: Need help with practice assignment!!

Postby enrico-sorichetti » Fri Apr 03, 2015 12:41 pm

i find odd that Your teacher/trainer/prof/whatever did not explained the subroutine and call logic
review the course note that You took and You will find out Yourself how to do it :geek:
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Need help with practice assignment!!

Postby steve-myers » Fri Apr 03, 2015 4:12 pm

You are addressing the table in your BUILD subroutine. You can do the same in your COMPUTE subroutine.

I'd make these changes.
  • I would move TABLE to the end of your MAIN program. I think you will find you will need to expand TABLE.
  • I don't think you need the complicated ORG Assembler instruction just before the start of your table.
  • I would change the initial contents of EOT to the address of the end of TABLE.
    EOT      DC    A(TABLE+32*25)
    You will have to change this address if you add more entries to your table.
  • In your BUILD subroutine, test if you are about to overflow the TABLE -
             LA    R5,32(,R5)
             C     R5,0(,R3)
             BL    BLOOP
    You can do something similar in your COMPUTE subroutine.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Need help with practice assignment!!

Postby pintu1228 » Fri Apr 03, 2015 6:11 pm

Thanks..so the professor said I have to do computation with dsect and put answer in table with dsect, how do I go about doing this? He also says I need to zap them to a temp field and do an mp.

This is the part I'm confused about, I need to do a loop with the if formula to calculate the total cost and figure out the shipping for each entry.

Thanks
pintu1228
 
Posts: 48
Joined: Mon Mar 23, 2015 12:41 am
Has thanked: 5 times
Been thanked: 0 time

Re: Need help with practice assignment!!

Postby steve-myers » Fri Apr 03, 2015 7:44 pm

You're starting to use the TAB DSECT in BUILD. You do the same in COMPUTE. You use the same loop in COMPUTE as you used in BUILD.

It took me a bit to analyze the comment about the MP. Then (I think) I got it

ZAP $TTOTAL,$TPRICE
MP $TTOTAL,$TNUM

The MP instruction has some oddball rules about data lengths so it won't overflow. Study the instruction in Principles of Operation very carefully. I do packed decimal arithmetic very infrequently; about 5 years ago those rules tripped me up and embarrassed me. I'm not certain the ZAP/MP I just wrote are OK. If not, try

ZAP TEMP,$TPRICE
MP TEMP,$TNUM
ZAP $TTOTAL,TEMP
...
TEMP DC PL8'0'

which I think will work.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Need help with practice assignment!!

Postby pintu1228 » Sat Apr 04, 2015 3:30 am

HI, thanks, quick question if I need to declare constant such as the shipping 0 and 500 would I declare these values as fullwords or packed decimals in storage?
pintu1228
 
Posts: 48
Joined: Mon Mar 23, 2015 12:41 am
Has thanked: 5 times
Been thanked: 0 time

Re: Need help with practice assignment!!

Postby steve-myers » Sat Apr 04, 2015 4:36 am

It depends on how they are used. If they are used with packed decimal values, then they have to be defined as packed decimal. If they are used with binary data, then they have to be be defined as binary of an appropriate length.

Going back to the MP question, my fuzzy brain remembered the lengths of $TPRICE and $TNUM wrong. You'll have to use the temporary variable. Just to be sure, I wrote this -
TESTMP   CSECT               
         USING *,15         
         ZAP   TEMP,$TPRICE 
         MP    TEMP,$TNUM   
         ZAP   $TPRICEX,TEMP
         MP    $TPRICE,$TNUM
         SR    15,15         
         BR    14           
$TPRICEX DC    PL3'0'       
$TPRICE  DC    PL3'100'     
$TNUM    DC    PL2'25'       
TEMP     DC    PL8'0'       
         END   TESTMP       
Sure enough, it failed on MP $TPRICE,$TNUM. MP TEMP,$TNUM went through OK. I think TEMP could be PL4, but I was too lazy to test it. Better too big than too small!

You will notice I initialized TEMP and $TPRICEX using the DC Assembler instruction. I almost always initialize storage like this; I always think it's safer.

I did not save and restore registers; the program only alters register 15 so it will be the return code; no other register was altered.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Need help with practice assignment!!

Postby pintu1228 » Sat Apr 04, 2015 4:37 am

Ok I managed to put some code in but i get an ABEND error, can anyone help me fix this so I can move onto the PRINT subroutine.


Thanks
You do not have the required permissions to view the files attached to this post.
pintu1228
 
Posts: 48
Joined: Mon Mar 23, 2015 12:41 am
Has thanked: 5 times
Been thanked: 0 time

Re: Need help with practice assignment!!

Postby steve-myers » Sat Apr 04, 2015 5:34 am

I noticed you did not change the loop in BUILD as I proposed.

I also noticed there does not seem any way to to terminate the loop in CMPUTE. I am no expert in analyzing Assist output, but I think if you pay attention to the two points I made you might correct the problem.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Need help with practice assignment!!

Postby Robert Sample » Sat Apr 04, 2015 8:34 am

1. I find it interesting that you define TABLE as 25CL32 while your DSECT defines 33 bytes of data (6 + 6 + 3 + 2 + 5 + 3 + 2 + 6 does not add up to 32).
2. For debugging, putting an XDUMP in CMPUTE (within the loop) would be helpful and can easily be removed when the debugging is done.
3. You have absolutely NOTHING to halt the loop in CMPUTE. Furthermore, you don't have any code to exit CMPUTE (such as restore the save area and BR 14), even if you do get out of the loop.
4. Your XDUMP after BUILD is too small. 25 times 32 is 800 bytes, which is still too small since 32 bytes is NOT the size of your table. You dumped 300 bytes -- less than half the table.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Next

Return to Assembler