Q:

Parse CSV text file

I have the following CSV file that I need to parse using VBScript.  The purpose of the script is too match dates. 
"LIRRR 1M",.412900,02/08/2016
"LIRRR 3M",.222700,02/08/2016
"LIRRR 6M",.333200,02/08/2016
"LIRRR12M",1.1333300,02/08/2016
"FEDFRRRR",.333000,02/08/2016
"CCC 1YR",.550330,02/08/2016
"2YRCMT",.743300,02/08/2016
"5YRCMT",1.2503300,02/08/2016
"10YRCMT",1.860000,02/08/2016
Here is the code that I have written:
On Error Resume Next
Const ForReading = 1

Dim strSearchFor
Dim MyDate, MyWeekDay

MyDate = Date ' Assign a date. 
MyWeekDay = Weekday(MyDate)

If MyWeekDay = 2 Then
    strSearchFor = Right("0" & DatePart("m", Date), 2) & "/" & _
                   Right("0" & DatePart("d", Date-3), 2) & "/" & _
                   DatePart("yyyy", Date)
Else 
    strSearchFor = Right("0" & DatePart("m", Date), 2) & "/" & _
                   Right("0" & DatePart("d", Date-1), 2) & "/" & _
                   DatePart("yyyy", Date)
End If

Set objFSO = CreateObject("Scripting. FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("C:\Users\rand.mahmwd\Desktop\index.txt", ForReading)

Do Until objTextFile. AtEndOfStream
    strLine = objTextFile. ReadLine()

    If InStr(strLine, strSearchFor) = 0 Then
        Set objFile = objFSO.CreateTextFile("C:\Users\rand.mahmwd\Desktop\error.txt")
        objFile. Write "date is not match" & vbCrLf
        Exit Do
    End If
Loop
objTextFile. Close

if the date match or not it always create error.txt 

A:

Your code works for me under the following conditions:

The input file must be ANSI encoded. 
All dates in the file must be of the previous work day. 
The file must not contain any other lines, including blank lines. 
The script is run on work days only. 
The previous work day isn't in the previous month. 

The last precondition is due to a bug in your script.  You calculate the month and year from the current date (DatePart("m", Date), DatePart("yyyy", Date)), but the day from the date of the previous work day (DatePart("d", Date-3), DatePart("d", Date-1)).  This can be fixed by using the same date for all calculations:
If WeekDay(Date) = 2 Then
    MyDate = Date - 3
Else
    MyDate = Date - 1
End If

strSearchFor = Right("0" & DatePart("m", MyDate), 2) & "/" & _
               Right("0" & DatePart("d", MyDate), 2) & "/" & _
               DatePart("yyyy", MyDate)

