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 

Convert Hex to Decimal in COBOL

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


Joined: 25 Dec 2006
Posts: 14
Topics: 6

PostPosted: Mon Jul 21, 2008 9:41 pm    Post subject: Convert Hex to Decimal in COBOL Reply with quote

Hi I have a requirement , ie, I have to read a file with HEX chars and write them to a file in a decimal or any readable format .. can anyone suggest how to make it in COBOL

Thanks
Back to top
View user's profile Send private message
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Mon Jul 21, 2008 10:55 pm    Post subject: Reply with quote

Do you need to convert just one character at a time or a combination? In other words: 0=0, 1=1, 2=2, ..., 9=9, A=10, B=11, C=12, ..., F=15. That would suffice for converting just 1 hex character at a time. Do you need to convert 2 at a time? 4 at a time? How many? Do they come in groups of a fixed length? Please give more detail as to your requirement.
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
saravanan80
Beginner


Joined: 25 Dec 2006
Posts: 14
Topics: 6

PostPosted: Tue Jul 22, 2008 12:39 am    Post subject: Reply with quote

YES I Would like to write the fetched data , which are in HEX format ( DATE & TIME ) to readable format in the output file, in COBOL program.
Back to top
View user's profile Send private message
CraigG
Intermediate


Joined: 02 May 2007
Posts: 202
Topics: 0
Location: Viginia, USA

PostPosted: Tue Jul 22, 2008 6:35 am    Post subject: Reply with quote

Would these "HEX" fields happen to be packed decimal or binary (COMP-3 or COMP) fields by any chance? If you show us what you need to convert we may be able to offer you some suggestions.
Back to top
View user's profile Send private message
saravanan80
Beginner


Joined: 25 Dec 2006
Posts: 14
Topics: 6

PostPosted: Tue Jul 22, 2008 11:57 am    Post subject: Reply with quote

Those HEX fields are packed decimal .. and I would like to display them in a output file in a printable format..

Thanks
Back to top
View user's profile Send private message
CraigG
Intermediate


Joined: 02 May 2007
Posts: 202
Topics: 0
Location: Viginia, USA

PostPosted: Tue Jul 22, 2008 12:09 pm    Post subject: Reply with quote

Move the packed decimal fields to a numeric display field (or numeric editted field), elementary COBOL.
Back to top
View user's profile Send private message
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Tue Jul 22, 2008 11:44 pm    Post subject: Reply with quote

Sometimes it's like pulling teeth, ain't it? bonk
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
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