how to convert alphanumeric to numeric



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

how to convert alphanumeric to numeric

Postby mohd dalib » Sat Jul 26, 2008 12:54 pm

I need the difference between two alphanumeric numbers.
like if
temp-num1 = "ABCDEF"
and
temp-num2 = "ABCDEH"


I need the temp-num2 - temp-num1 to be stored in third numeric veeriable.
like

temp 9(6).

compute temp = temp-num2 - temp-num1

but since temp-num2 and temp-num1 are alphanumeric
so is there any way to get the difference between these two.
mohd dalib
 
Posts: 6
Joined: Thu Jul 03, 2008 9:08 pm
Has thanked: 0 time
Been thanked: 0 time

Re: how to convert alphanumeric to numeric

 

Re: how to convert alphanumeric to numeric

Postby dick scherrer » Sat Jul 26, 2008 2:56 pm

Hello,

so is there any way to get the difference between these two.
Of course there is. . .

Now is where you have to do some work. Post the rule(s) describing how to calculate the difference. Also, rather than the "simple" example you've used (you'd expect a difference of 2, right?) you need to post what you would expect the difference between "AVRDEW" and "JYREXS" to be and how you determined that difference. Once the rule is understood, coding might follow.

Another thought is that you might describe what you are trying to accomplish and someone may have a suggestion.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post