MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

COBOL datatype

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
Nabanita Das
Beginner


Joined: 09 Nov 2005
Posts: 33
Topics: 10

PostPosted: Wed Nov 09, 2005 8:16 am    Post subject: COBOL datatype Reply with quote

Can anyone please explain why thi s happens?

Suppose I am defining 2 variables as

01 DT-value.
05 DT-VAL1 pic 999.9.
01 HA-DT-VAL pic 999.9.

and in the procedure division

Move DT-VAL1 to HA-dt-val.

If I use DT-VAL1 as 0aa.0 HA-dt-val is dispalyed as 011.0.Why?

Please explain this datatype 999.9 also.
Thanks
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Nov 09, 2005 9:43 am    Post subject: Reply with quote

Nabanita Das,

Check this link which explains in detail about the numeric data in cobol.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3PG10/1.3.2?DT=20020923143836

Make sure that you read these sections in the above link

"Examples: numeric data and internal representation" in topic 1.3.4.7
"Controlling how numeric data is stored" in topic 1.3.3
"Defining numeric data" in topic 1.3.1
"Performing arithmetic" in topic 1.3.8

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ikumar
Beginner


Joined: 09 Nov 2005
Posts: 6
Topics: 3

PostPosted: Wed Nov 09, 2005 9:46 am    Post subject: Reply with quote

Because you are moving an alphabetic value to the numeric data item, system stores the data in zoned decimal numbers and the corresponding value for A is 1, in when it interpret the alphabetic value.

correct me if i am wrong...

Thanks,
Kumar.
Back to top
View user's profile Send private message
ANIL SARATHY
Beginner


Joined: 30 Aug 2005
Posts: 88
Topics: 3
Location: Syracuse,New york

PostPosted: Thu Nov 10, 2005 12:08 am    Post subject: Reply with quote

hex representation of 0aa.0 is 'F0C1C14BF0'.


In zone decimal every byte has 0-3 bits for sign ( f - unsigned , C - positive , d -negative ) and 4 -7 bits for numeric value


that is why HA-DT-VAL has 011.0 .
_________________
Anil Sarathy
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group