View previous topic :: View next topic
|
Author |
Message |
madhavans
New User
Joined: 23 Dec 2020 Posts: 2 Location: India
|
|
|
|
Hi!
My first post here. i am just trying to figure the following out.
Given
Code: |
VAR1 DC CL8'12345678'
AVAR1 DS CL4 |
Upon Execution of
Code: |
PACK AVAR1,VAR1
--VAR1-|--avar1
12345678.áű
FFFFFFFF2468
12345678357F |
Which is expected behavior
However, when i execute
Code: |
PACK AVAR1,VAR1+1
--VAR1-|--avar1
12345678.îÌ.
FFFFFFFF3570
123456784680 |
The result is not a valid Packed decimal.
I have been unable to locate any documentation to help me figure out why the last byte is x'00'.
Just wondering if any of you can help with this.
Coded for you |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
the assembler manual has the reply
anyway PACK is a two lengths instruction and the length used by the assembler are those implied by the variable definition,
so You are packing from VAR1+1 for the VAR1 length so You get the one byte of garbage stored after VAR1,
You could have also seen that from the assembler listing looking at the left side with the hex of the instructions |
|
Back to top |
|
|
madhavans
New User
Joined: 23 Dec 2020 Posts: 2 Location: India
|
|
|
|
implied by the variable definition....
You could have also seen that from the assembler listing looking at the left side with the hex of the instructions...
Thanks for the pointers, this just plugged some gaps in my understanding
Appreciate you taking the time to respond..
Thank you |
|
Back to top |
|
|
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
Code: |
PACK VAR2,VAR1
...
VAR1 DC CL8'12345678'
VAR2 DC XL4'00'
VAR2 DC XL4'2345678F' |
The second VAR2 is its contents after the PACK instruction. F is a valid alternate packed decimal sign. Read every word of the discussion about packed decimal numbers in Principles of Operation. |
|
Back to top |
|
|
|