IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Assembler - Packed Decimals - PACK instruction


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
madhavans

New User


Joined: 23 Dec 2020
Posts: 2
Location: India

PostPosted: Wed Dec 23, 2020 11:32 am
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10765
Location: italy

PostPosted: Wed Dec 23, 2020 12:24 pm
Reply with quote

the assembler manual has the reply icon_cool.gif
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
View user's profile Send private message
madhavans

New User


Joined: 23 Dec 2020
Posts: 2
Location: India

PostPosted: Wed Dec 23, 2020 12:38 pm
Reply with quote

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
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 882
Location: The Universe

PostPosted: Thu Dec 24, 2020 12:02 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Assembler test under mask question PL/I & Assembler 5
No new posts Negative value - packed field - Natur... Java & MQSeries 0
No new posts HOW TO OVERLAY A Packed decimal VALUE... DFSORT/ICETOOL 5
No new posts Calling Assembler from REXX PL/I & Assembler 5
No new posts To convert numeric to Packed Decimal DFSORT/ICETOOL 9
Search our Forums:

Back to Top