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

Reg:Moving of COMP-3 to a DISPLAY variable


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
muthuvel

Active User


Joined: 29 Nov 2005
Posts: 217
Location: Canada

PostPosted: Wed Dec 14, 2005 11:27 am
Reply with quote

Hi all,
When i move a COMP-3 variable S9(6) to a display variable S9(6).i don't get the sign moved from the COMP-3 variable to the display variable.
Why is it so?
Please provide suggestions for the same.
Thanks,
Muthuvel.
Back to top
View user's profile Send private message
jon_s_rice

Active User


Joined: 24 Mar 2005
Posts: 102
Location: Douglasville, GA USA

PostPosted: Wed Dec 14, 2005 5:47 pm
Reply with quote

If the display variable you are moving the field to is zone signed that is pic s9(6) without the trailing statement, then the sign will be in the zone bits of the last byte.
Back to top
View user's profile Send private message
iknow

Active User


Joined: 22 Aug 2005
Posts: 411
Location: Colarado, US

PostPosted: Wed Dec 14, 2005 6:04 pm
Reply with quote

Hi Muthuvel,


I have tested using MS-COBOL 85 and I found a peculiar result.

Quote:
01 a pic s9(6) comp-3 value 111111.
01 b pic s9(6) value 000000.

Inside procedure division,

Move a to b.
display b.


I am getting the result as 11111A.

Could someone explain this situation.
Back to top
View user's profile Send private message
jon_s_rice

Active User


Joined: 24 Mar 2005
Posts: 102
Location: Douglasville, GA USA

PostPosted: Wed Dec 14, 2005 11:02 pm
Reply with quote

The "A" represents +1. The display does not seperate the sign from a zoned decimal field.
Back to top
View user's profile Send private message
iknow

Active User


Joined: 22 Aug 2005
Posts: 411
Location: Colarado, US

PostPosted: Thu Dec 15, 2005 6:26 am
Reply with quote

Hi jon_s_rice,

Thanks for your valuable information. Your reply really helped me a lot to avoid confusion about the zoned decimal field.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
No new posts parsing variable length/position data... DFSORT/ICETOOL 5
Search our Forums:

Back to Top