View previous topic :: View next topic |
Author |
Message |
saravanan80 Beginner
Joined: 25 Dec 2006 Posts: 14 Topics: 6
|
Posted: Mon Jul 21, 2008 9:41 pm Post subject: Convert Hex to Decimal in COBOL |
|
|
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 |
|
 |
Terry_Heinze Supermod
Joined: 31 May 2004 Posts: 391 Topics: 4 Location: Richfield, MN, USA
|
Posted: Mon Jul 21, 2008 10:55 pm Post subject: |
|
|
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 |
|
 |
saravanan80 Beginner
Joined: 25 Dec 2006 Posts: 14 Topics: 6
|
Posted: Tue Jul 22, 2008 12:39 am Post subject: |
|
|
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 |
|
 |
CraigG Intermediate
Joined: 02 May 2007 Posts: 202 Topics: 0 Location: Viginia, USA
|
Posted: Tue Jul 22, 2008 6:35 am Post subject: |
|
|
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 |
|
 |
saravanan80 Beginner
Joined: 25 Dec 2006 Posts: 14 Topics: 6
|
Posted: Tue Jul 22, 2008 11:57 am Post subject: |
|
|
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 |
|
 |
CraigG Intermediate
Joined: 02 May 2007 Posts: 202 Topics: 0 Location: Viginia, USA
|
Posted: Tue Jul 22, 2008 12:09 pm Post subject: |
|
|
Move the packed decimal fields to a numeric display field (or numeric editted field), elementary COBOL. |
|
Back to top |
|
 |
Terry_Heinze Supermod
Joined: 31 May 2004 Posts: 391 Topics: 4 Location: Richfield, MN, USA
|
Posted: Tue Jul 22, 2008 11:44 pm Post subject: |
|
|
Sometimes it's like pulling teeth, ain't it?  _________________ ....Terry |
|
Back to top |
|
 |
|
|