- Home
·
- Math/Dates
·
- Function to convert COBOL formated numbers into VB
Function to convert COBOL formated numbers into VB
Function to convert COBOL formated numbers into VB
Rate Function to convert COBOL formated numbers into VB
(1(1 Vote))
Optional Dec As Byte = 2, _
Optional ConversionTable As String = "{ABCDEFGHI}JKLMNOPQR", _
Optional ConversionValues As String = "01234567890123456789") As Currency
' ================================================================================
'
' Created: Wed Feb-28-2001 @ 10:20 AM By: jfouch
' Revised: Wed Feb-28-2001 @ 10:20 AM By: jfouch
'
' Desc: This function will convert Cobol dollars into VB Currency Values
' ================================================================================
Dim p As Byte
Dim v As String * 1
If S = String(Len(S), "0") Then
GetCobolDollars = 0
Exit Function
End If
p = InStr(ConversionTable, Right(S, 1)) ' find Pos of last char in string
If p <> 0 Then
v = Mid(ConversionValues, p, 1) ' find the value for the Last Char
Else
v = "0"
End If
GetCobolDollars = CCur((Val(String(Abs(p > 10), "-") & _
Left(S, Len(S) - 1)) & v) / (10 ^ Dec))
End Function
Function to convert COBOL formated numbers into VB Comments
No comments yet — be the first to post one!
Post a Comment