Messages - dementedmuppet [ switch to compact view ]

Pages: prev1 2 [3] 4 5next
11
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.

12
It seems to be a COBOL standard but I haven't determined which standard
(How many standards did they need?? Ugh!)

0000568G = $56.87
0001651L = -$165.13

What is the likelihood that any of these will help?
http://download.oracle.com/docs/cd/E05557_01/MCA_API_Docs/com/bankframe/ei/txnhandler/dataformat/DataFormatUtils.html

13
The numbers start in a flat file (.txt) for EDI.  They are fixed width (not comma delimited)

I use a macro to format the data into columns for a more meaningful Excel spreadsheet with column headings.

Just knowing wtf type of system this is would help me with the conversion to currency.  Obviously it isn't hex :P 

While the sample code works to convert from currency to the (wtf) string, it isn't helful converting from (wtf) string to currency. 

ASCII??

Any hints?

14
The data is received in a funky format because negative values are not allowed.  The numbers are converted as:

On a positive number:                                On a negative number:

{ = 0                                                         } = 0
A = 1                                                         J = 1
B = 2                                                         K = 2
C = 3                                                         L = 3 
D = 4                                                        M = 4
E = 5                                                         N = 5
F = 6                                                         O = 6
G = 7                                                         P = 7
H = 8                                                         Q = 8
I = 9                                                          R = 9

Examples:

0000568G = $56.87
0001651L = -$165.13

I need to convert the wacky 0000568G types to currency types.  Anyone got code for this? 

I have sample code that does the opposite but reversing code I barely understand is a waste of time if someone already has code to do what I need:

 
Spoiler
Function format_currency1(ByVal money As String, ByVal width As Integer) As String

   'convert to internal format for currency

 

   Dim positive As Boolean

   Dim decmoney As Currency

 

   'need to convert to decimal to format number

   decmoney = money

 

   'set switch for positive/negative value

   If decmoney >= 0 Then

      positive = True

   Else

      positive = False

   End If

 

   'ensure there are no negative numbers

   decmoney = Math.Abs(decmoney)

 

   'format number to ensure the 2 right characters are the cents and convert back to string

   If Left(Right(decmoney, 3), 1) = "." Then

      money = decmoney

   Else

      money = decmoney & ".00"

   End If

 

   'omit decimal point

   money = Left(money, Len(money) - 3) & Right(money, 2)

 

   If positive = True Then

      'positive currency amount

      Select Case Right(money, 1)

        Case 0

            money = Left(money, Len(money) - 1) & "{"

        Case 1

            money = Left(money, Len(money) - 1) & "A"

        Case 2

            money = Left(money, Len(money) - 1) & "B"

        Case 3

            money = Left(money, Len(money) - 1) & "C"

        Case 4

            money = Left(money, Len(money) - 1) & "D"

        Case 5

            money = Left(money, Len(money) - 1) & "E"

        Case 6

            money = Left(money, Len(money) - 1) & "F"

        Case 7

            money = Left(money, Len(money) - 1) & "G"

        Case 8

            money = Left(money, Len(money) - 1) & "H"

        Case 9

            money = Left(money, Len(money) - 1) & "I"

      End Select

   Else

      'negative currency amount

      Select Case Right(money, 1)

        Case 0

            money = Left(money, Len(money) - 1) & "}"

        Case 1

            money = Left(money, Len(money) - 1) & "J"

        Case 2

            money = Left(money, Len(money) - 1) & "K"

        Case 3

            money = Left(money, Len(money) - 1) & "L"

        Case 4

            money = Left(money, Len(money) - 1) & "M"

        Case 5

            money = Left(money, Len(money) - 1) & "N"

        Case 6

            money = Left(money, Len(money) - 1) & "O"

        Case 7

            money = Left(money, Len(money) - 1) & "P"

        Case 8

            money = Left(money, Len(money) - 1) & "Q"

        Case 9

            money = Left(money, Len(money) - 1) & "R"

      End Select

   End If

           

   'pad left with leading zeros to meet field width requirements

   While Len(money) < width

      money = "0" & money

   Wend

           

   format_currency1 = money

 

End Function



Hoping for help
Sincerely
Muppet


edit by jgpaiva: added spoiler/code tag

15
The macro works great & you rock  :-*

Pages: prev1 2 [3] 4 5next
Go to full version