Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Parsing file in DTS Package


Parsing file in DTS Package

Author
Message
phineas629
phineas629
Grasshopper
Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)

Group: General Forum Members
Points: 14 Visits: 145
I have to parse the following lines. I need a detailed explanation of how the functions and operators are working together to find the dates. First time with VB.



LOT!99!AA!!999999!19990101!!!!!19990102
LOT!01!AA!!999998!19990101!!!!!19990102
LOT!03!AA!!999997!19990101!!!!!19990102
LOT!99!AA!!999996!19990101!!!!!19990101
SAD!99!AA!!999995!19990101!!!!!19990101







''''''''''''""""""""""""""""""""""""""Open the Modified LOT for reading""""""""""""""""""""""""""""""""""""""""""""""""
Function Parse(c_strLOTFile)

strMsg = "Opening LOT data file for reading."
AddFileLogLine strMsg

'reads text file line by line
Do Until LOTFileOpen.AtEndOfStream
strTemp = LOTFileOpen.ReadLine

Const c_strLOT = "LOT"
''''''''''"""""""""""""""""""""""""""""" LOT Line """"""""""""""""""""""""""""""""""""""""""""""""
Dim strDelim 'Character used as delimiter
Dim strTOWNo 'TOW Number
Dim dteLOTDate 'LOT Date
Dim dteTOWDate 'TOW Date
Dim strLOTLoc01 'LOT01 location
Dim strLOTLoc02 'LOT02 location
Dim strLOTLoc03 'LOT03 location
Dim strLOTLoc04 'LOT04 location
Dim strLOTLoc05 'LOT05 location
Dim strLOTLoc06 'LOT06 location
Dim strLOTLoc07 'LOT07 location
Dim strLOTLoc08 'LOT08 location
Dim strLOTLoc09 'LOT09 location

Dim dblcount
dblcount = Null
dblcount = 1

'Set delimiter to !
strDelim = "!"

Case (Left(strTemp, 3) = c_strLOT) 'Start of Beginning Segment for LOT

'Resets values to Null
strTOWNo = Null
dteLOTDate = Null
dteTOWDate = Null
strLOTLoc01 = Null
strLOTLoc02 = Null
strLOTLoc03 = Null
strLOTLoc04 = Null
strLOTLoc05 = Null
strLOTLoc06 = Null
strLOTLoc07 = Null
strLOTLoc08 = Null
strLOTLoc09 = Null

'find all delimiter locations
strLOTLoc01 = Instr(strTemp, strDelim) + 1
strLOTLoc02 = Instr(strLOTLoc01, strTemp, strDelim) + 1
strLOTLoc03 = Instr(strLOTLoc02, strTemp, strDelim) + 1
strLOTLoc04 = Instr(strLOTLoc03, strTemp, strDelim) + 1
strLOTLoc05 = Instr(strLOTLoc04, strTemp, strDelim) + 1
strLOTLoc06 = Instr(strLOTLoc05, strTemp, strDelim) + 1
strLOTLoc07 = Instr(strLOTLoc06, strTemp, strDelim) + 1
strLOTLoc08 = Instr(strLOTLoc07, strTemp, strDelim) + 1
strLOTLoc09 = Instr(strLOTLoc08, strTemp, strDelim) + 1



strTOWNo = Mid(strTemp, strLOTLoc03, 7)

dteTOWDate = Trim(Mid(strTemp, (strLOTLoc04 + 4), 2) &"/"&Mid(strTemp, (strLOTLoc04 + 6), 2) &"/"&Mid(strTemp, strLOTLoc04, 4))

dteLOTDate = Trim(Mid(strTemp, (strLOTLoc09 + 4), 2) &"/"&Mid(strTemp, (strLOTLoc09 + 6), 2) &"/"&Mid(strTemp, strLOTLoc09, 4))

'running count of segments
dblcount = (dblcount + 1)

End Select
Loop


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search