DonationCoder.com Software > Post New Requests Here
DONE: How do I convert (wtf is this? Cobol?) to numbers? Examples included
dementedmuppet:
Yes, it is logical and convenient for transmissions but I need to figure out precisely what the standard is so I can write the code to convert it back to currency.
COBOL 'making sense' is why it doesn't die. From accounting/finance perspective, COBOL is beautiful. It is the backbone of financial systems since it is the best tool for the job. Just today, while I'm frustrated, "tool" takes on a different meaning.
tinjaw:
I understand in general want you want to do, i.e. convert from "COBOL" to currency.
What do you want to do in practical terms? Are you looking to input a text file and output a text file? If you already have the data in Excel, write a VBA macro to do the conversion.
dementedmuppet:
VBA maro would be ideal
Either to convert the values while keeping them in the Excel cells they currently occupy, or create a new tab that has the converted values.
The sample code is VBA used to create "COBOL" values. Theoretically, I could edit & rearrange it to reverse the process. My failure to understand the code makes that difficult.
Any reference sites you've found helpful?
tinjaw:
I have never actually done VBA in Excel before, but try this...
--- ---Function format_currency2(ByVal money As String) As String
'convert from internal format to currency
Select Case Right(money, 1)
'positive numbers
Case "{"
money = Left(money, Len(money) - 1) & "0"
Case "A"
money = Left(money, Len(money) - 1) & "1"
Case "B"
money = Left(money, Len(money) - 1) & "2"
Case "C"
money = Left(money, Len(money) - 1) & "3"
Case "D"
money = Left(money, Len(money) - 1) & "4"
Case "E"
money = Left(money, Len(money) - 1) & "5"
Case "F"
money = Left(money, Len(money) - 1) & "6"
Case "G"
money = Left(money, Len(money) - 1) & "7"
Case "H"
money = Left(money, Len(money) - 1) & "8"
Case "I"
money = Left(money, Len(money) - 1) & "9"
'negative numbers
Case "}"
money = "-" + Left(money, Len(money) - 1) & "0"
Case "J"
money = "-" + Left(money, Len(money) - 1) & "1"
Case "K"
money = "-" + Left(money, Len(money) - 1) & "2"
Case "L"
money = "-" + Left(money, Len(money) - 1) & "3"
Case "M"
money = "-" + Left(money, Len(money) - 1) & "4"
Case "N"
money = "-" + Left(money, Len(money) - 1) & "5"
Case "O"
money = "-" + Left(money, Len(money) - 1) & "6"
Case "P"
money = "-" + Left(money, Len(money) - 1) & "7"
Case "Q"
money = "-" + Left(money, Len(money) - 1) & "8"
Case "R"
money = "-" + Left(money, Len(money) - 1) & "9"
End Select
format_currency2 = money * 0.01
End Function
dementedmuppet:
It works. If my child did not already have a cool name, he woud be "chaim"
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version