I have to parse the following lines. I don't know anything about VB. Can someone give me a detailed explanation how the parse is done for the variables strFARENo, dteCABDate, dteFAREDate? I got the general idea of how it works but I'd like a deep explanation of how the functions and operators are working together to find the dates.
CAB!99!AA!!999999!19990101!!!!!19990102
CAB!01!AA!!999998!19990101!!!!!19990102
CAB!03!AA!!999997!19990101!!!!!19990102
CAB!99!AA!!999996!19990101!!!!!19990101
SAD!99!AA!!999995!19990101!!!!!19990101
CAB!99!AA!!999999!19990101!!!!!19990102
CAB!01!AA!!999998!19990101!!!!!19990102
CAB!03!AA!!999997!19990101!!!!!19990102
CAB!99!AA!!999996!19990101!!!!!19990101
SAD!99!AA!!999995!19990101!!!!!19990101
Code:
''''''''''''""""""""""""""""""""""""""""""""""""""""""""""""Open the Modified CAB for reading""""""""""""""""""""""""""""""""""""""""""""""""
Function Parse(c_strCABFile)
strMsg = "Opening CAB data file for reading."
AddFileLogLine strMsg
'reads text file line by line
Do Until CABFileOpen.AtEndOfStream
strTemp = CABFileOpen.ReadLine
Const c_strCAB = "CAB"
''''''''''"""""""""""""""""""""""""""""""""""""""""""""""" CAB Line """"""""""""""""""""""""""""""""""""""""""""""""
Dim strDelim 'Character used as delimiter
Dim strFARENo 'FARE Number
Dim dteCABDate 'CAB Date
Dim dteFAREDate 'FARE Date
Dim strCABLoc01 'CAB01 location
Dim strCABLoc02 'CAB02 location
Dim strCABLoc03 'CAB03 location
Dim strCABLoc04 'CAB04 location
Dim strCABLoc05 'CAB05 location
Dim strCABLoc06 'CAB06 location
Dim strCABLoc07 'CAB07 location
Dim strCABLoc08 'CAB08 location
Dim strCABLoc09 'CAB09 location
Dim dblcount
dblcount = Null
dblcount = 1
'Set delimiter to !
strDelim = "!"
Case (Left(strTemp, 3) = c_strCAB) 'Start of Beginning Segment for CAB
'Resets values to Null
strFARENo = Null
dteCABDate = Null
dteFAREDate = Null
strCABLoc01 = Null
strCABLoc02 = Null
strCABLoc03 = Null
strCABLoc04 = Null
strCABLoc05 = Null
strCABLoc06 = Null
strCABLoc07 = Null
strCABLoc08 = Null
strCABLoc09 = Null
'find all delimiter locations
strCABLoc01 = Instr(strTemp, strDelim) + 1
strCABLoc02 = Instr(strCABLoc01, strTemp, strDelim) + 1
strCABLoc03 = Instr(strCABLoc02, strTemp, strDelim) + 1
strCABLoc04 = Instr(strCABLoc03, strTemp, strDelim) + 1
strCABLoc05 = Instr(strCABLoc04, strTemp, strDelim) + 1
strCABLoc06 = Instr(strCABLoc05, strTemp, strDelim) + 1
strCABLoc07 = Instr(strCABLoc06, strTemp, strDelim) + 1
strCABLoc08 = Instr(strCABLoc07, strTemp, strDelim) + 1
strCABLoc09 = Instr(strCABLoc08, strTemp, strDelim) + 1
strFARENo = Mid(strTemp, strCABLoc03, 7)
dteFAREDate = Trim(Mid(strTemp, (strCABLoc04 + 4), 2) &"/"&Mid(strTemp, (strCABLoc04 + 6), 2) &"/"&Mid(strTemp, strCABLoc04, 4))
dteCABDate = Trim(Mid(strTemp, (strCABLoc09 + 4), 2) &"/"&Mid(strTemp, (strCABLoc09 + 6), 2) &"/"&Mid(strTemp, strCABLoc09, 4))
'running count of segments
dblcount = (dblcount + 1)
End Select
Loop