Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
3.9 kB
1
Indexable
Never
Private Sub MOF08E(ByVal code As String)
Dim lines() As String
Dim line As String
Dim i As Long
lines = Split(sline, vbLf)
If UCase(code) = "MOF08EX" Then
    For i = LBound(lines) To UBound(lines)
        If Trim(lines(i)) <> "RECORD_ID|RIC_CODE|DESCRIPT|I_S_I_N|PRICE_CURRENCY|LAST_PRICE|DATE_LAST_PRICE|TOTAL_POSITION|INPUTTER|INPUTTER_CODE|DATE_TIME" Then
        Tabit = Split(lines(i), "|")
            If UBound(Tabit) > 0 Then
                Sql_Rst.AddNew
                    CC = CC + 1
                    Sql_Rst![MOF08E_batchdate] = Format(Logsdate, "yyyy/mm/dd")
                    Sql_Rst![MOF08E_Counter] = CC
                    Sql_Rst![MOF08E_Ccy] = Trim(Tabit(4))
                    Sql_Rst![MOF08E_Date_Pricing] = Trim(Tabit(6)) 'DateSerial(Trim(Mid(sline, 114, 4)), Trim(Mid(sline, 118, 2)), Trim(Mid(sline, 120, 2)))
                    Sql_Rst![MOF08E_Description] = Trim(Tabit(2))
                    Sql_Rst![MOF08E_Globus_ID] = Trim(Tabit(0))
                    Sql_Rst![MOF08E_ISIN] = Trim(Tabit(3))
                    Sql_Rst![MOF08E_Mkt_Price] = Get_number(Trim(Tabit(5)))
                    Sql_Rst![MOF08E_Position] = Get_number(Trim(Tabit(7)))
                    Sql_Rst![MOF08E_RIC] = Trim(Tabit(1))
                    If Trim(Tabit(9)) = "0" Then
                        Sql_Rst![MOF08E_Pricing_Source] = "NE DSS"
                        Sql_Rst![MOF08E_Pricing_Source_Code] = Trim(Tabit(9))
                    Else
                        Sql_Rst![MOF08E_Pricing_Source] = "EQ DSS"
                        Sql_Rst![MOF08E_Pricing_Source_Code] = Trim(Tabit(9))
                    End If
                        
                    If Trim(Tabit(9)) = 0 Then
                        Sql_Rst![MOF08E_Position_SOURCE] = "EQ ZERO"
                    Else
                        Sql_Rst![MOF08E_Position_SOURCE] = "NE ZERO"
                    End If
                    Dim day, Month, Year, time, dateTime As String
                    'time = Mid(Trim(Tabit(10)), 6, 4)
                    Sql_Rst![MOF08E_DATETIME] = ConvertToDateTime(Trim(Tabit(10))) 'DateAdd("d", Trim(Tabit(10)) - 1, "1899-12-30") 'DateSerial(Mid(Trim(Tabit(10)), 4, 2), Mid(Trim(Tabit(10)), 2, 2), Mid(Trim(Tabit(10)), 0, 2))
                    Sql_Rst![MOF08E_File_CODE] = code
                    Sql_Rst.Update
                End If
            End If
    Next i
ElseIf Trim(Mid(lines(i), 2, 12)) <> "" Then
        Sql_Rst.AddNew
        CC = CC + 1
        Sql_Rst![MOF08E_batchdate] = Format(Logsdate, "yyyy/mm/dd")
        Sql_Rst![MOF08E_Counter] = CC
        Sql_Rst![MOF08E_Ccy] = Trim(Mid(sline, 88, 3))
        Sql_Rst![MOF08E_Date_Pricing] = DateSerial(Trim(Mid(sline, 114, 4)), Trim(Mid(sline, 118, 2)), Trim(Mid(sline, 120, 2)))
        Sql_Rst![MOF08E_Description] = Trim((Mid(sline, 37, 35)))
        Sql_Rst![MOF08E_Globus_ID] = Trim(Mid(sline, 1, 12))
        Sql_Rst![MOF08E_ISIN] = Trim(Mid(sline, 74, 12))
        Sql_Rst![MOF08E_Mkt_Price] = Get_number(Trim(Mid(sline, 93, 16)))
        Sql_Rst![MOF08E_Position] = Get_number(Trim(Mid(sline, 124, 18)))
        Sql_Rst![MOF08E_RIC] = Trim(Mid(sline, 15, 20))
        If Trim(Mid(sline, 146, 1)) = "0" Then
            Sql_Rst![MOF08E_Pricing_Source] = "NE DSS"
            Sql_Rst![MOF08E_Pricing_Source_Code] = Trim(Mid(sline, 146, 1))
        Else
            Sql_Rst![MOF08E_Pricing_Source] = "EQ DSS"
            Sql_Rst![MOF08E_Pricing_Source_Code] = Trim(Mid(sline, 146, 1))
        End If
                        
        If Get_number(Trim(Mid(sline, 124, 18))) = 0 Then
            Sql_Rst![MOF08E_Position_SOURCE] = "EQ ZERO"
        Else
            Sql_Rst![MOF08E_Position_SOURCE] = "NE ZERO"
        End If
        Sql_Rst![MOF08E_DATETIME] = Trim(Mid(sline, 150, 20))
        Sql_Rst![MOF08E_File_CODE] = code
        Sql_Rst.Update
Else
End If
End Sub
Leave a Comment