Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.
Function Main()
TheDir = "c:\test\"
NewDir = "c:\testnew"
X = ""
Set fso = CreateObject("Scripting.FileSystemObject")
Set M = fso.CreateTextFile(NewDir & "inva.imp")
Set N = fso.CreateTextFile(NewDir & "imtr.imp")
Set O = fso.CreateTextFile(NewDir & "morv.imp")
Set P = fso.OpenTextFile(NewDir & "ALLMOVES.TXT")
sLine = P.ReadLine
Do While sLine <> ""
if Left(sLine,1) = """" Then
X = mid(sline, 2, 4)
if X = "IMTR" then
sCOMT = Split(sLine, ",", 24, 1)
elseif X = "INVA" then
sCOMT = Split(sLine, ",", 22, 1)
elseif X = "MORV" then
sCOMT = Split(sLine, ",", 40, 1)
end if
if sCOMT(4) = """9""" or sCOMT(4) = """0""" then
sCOMT(2) = left(sCOMT(2), 11) & " " & right(sCOMT(3),9)
sCOMT(3) = ""
if sCOMT(0) = """MORV00""" then
sCOMT(39) = ""
if sCOMT(34) = """""" then
sCOMT(34) ="N"
end if
elseif sCOMT(0) = """IMTR01""" then
sCOMT(23) = ""
elseif sCOMT(0) = """INVA01""" then
sCOMT(21) = ""
end if
sLine = Join(sCOMT, ",")
If Mid(sLine, 2, 4) = "IMTR" Then
N.WriteLine (sLine)
ElseIf Mid(sLine, 2, 4) = "MORV" Then
O.WriteLine (sLine)
ElseIf Mid(sLine, 2, 4) = "INVA" Then
sLine = Replace(sLine, ",.,", ",.0,")
M.WriteLine (sLine)
End If
End If
end if
if not P.AtEndOfStream then
sLine = P.ReadLine
else
exit do
end if
Loop
P.Close
O.Close
N.Close
M.Close
Main = DTSTaskExecResult_Success
End Function
ALLMOVES.txt"INVA01","BGG","03/07/2011","018:22:28","0","C","TPDLAW","NW","STAGE","O","NWIMTR","+",2,"R","01-000-0000-50401",2.96,2,1.48,"EA","N","","","","","","","","","","","","",,"","","","","","","","","","","","","","","","","","",.92,.56,.00,.00
"INVA01","BGG","03/07/2011","018:22:28","0","C","TPOSNP","NW","STAGE","O","NWIMTR","+",2,"R","01-000-0000-50401",4.42,2,2.21,"EA","N","","","","","","","","","","","","",,"","","","","","","","","","","","","","","","","","",1.57,.64,.00,.00
Function Main()
TheDir = "\\Mwwdc\MWW1\fs\mfgsys\" '"\\mww1\sys\fs\mfgsys\"
NewDir = "\\Mwwdc\MWW1\fs\mfgsys\MOVEFLDR\" '"\\mww1\sys\fs\mfgsys\MOVEFLDR\"
X = ""
Set fso = CreateObject("Scripting.FileSystemObject")
' Set A = fso.GetFile(NewDir & "fshift.imp") 'Change the file name to fshift.*** in case if you want to import data from a different file (in case if you forget to import)
' A.Copy NewDir & "fshift.imp"
Set M = fso.CreateTextFile(NewDir & "inva.imp")
Set N = fso.CreateTextFile(NewDir & "imtr.imp")
Set O = fso.CreateTextFile(NewDir & "morv.imp")
Set P = fso.OpenTextFile(NewDir & "ALLMOVES.TXT")
sLine = P.ReadLine
' iCount=0
Do While sLine <> ""
if Left(sLine,1) = """" Then
' iCount=iCount + 1
' if iCount >5 then exit Do
X = mid(sline, 2, 4)
if X = "IMTR" then
sCOMT = Split(sLine, ",", 24, 1)
elseif X = "INVA" then
sCOMT = Split(sLine, ",", 22, 1)
elseif X = "MORV" then
sCOMT = Split(sLine, ",", 40, 1)
end if
if sCOMT(4) = """9""" or sCOMT(4) = """0""" then
sCOMT(2) = left(sCOMT(2), 11) & " " & right(sCOMT(3),9)
sCOMT(3) = ""
if sCOMT(0) = """MORV00""" then
sCOMT(39) = ""
if sCOMT(34) = """""" then
sCOMT(34) ="N"
end if
elseif sCOMT(0) = """IMTR01""" then
sCOMT(23) = ""
elseif sCOMT(0) = """INVA01""" then
sCOMT(21) = ""
end if
sLine = Join(sCOMT, ",")
If Mid(sLine, 2, 4) = "IMTR" Then
N.WriteLine (sLine)
ElseIf Mid(sLine, 2, 4) = "MORV" Then
O.WriteLine (sLine)
ElseIf Mid(sLine, 2, 4) = "INVA" Then
sLine = Replace(sLine, ",.,", ",.0,")
M.WriteLine (sLine)
End If
' else
' msgbox "--------" & sCOMT(4) & "--------"
' exit do
End If
end if
if not P.AtEndOfStream then
sLine = P.ReadLine
else
exit do
end if
Loop
P.Close
O.Close
N.Close
M.Close
' Set P = fso.GetFile(NewDir & "fshift.imp")
' P.Delete
Main = DTSTaskExecResult_Success
End Function
Function Main()
Dim iCount As Integer
TheDir = "c:\0"
NewDir = "c:\test"
sCrap = """" & "0" & """"
x = ""
Set fso = CreateObject("Scripting.FileSystemObject")
Set M = fso.CreateTextFile(NewDir & "inva.imp")
Set N = fso.CreateTextFile(NewDir & "imtr.imp")
Set O = fso.CreateTextFile(NewDir & "morv.imp")
Set P = fso.OpenTextFile(NewDir & "ALLMOVES.TXT")
sline = P.ReadLine
Do While sline <> ""
If Left(sline, 1) = """" Then
x = Mid(sline, 2, 4)
If x = "IMTR" Then
sCOMT = Split(sline, ",", 24, 1)
ElseIf x = "INVA" Then
sCOMT = Split(sline, ",", 22, 1)
ElseIf x = "MORV" Then
sCOMT = Split(sline, ",", 40, 1)
End If
If sCOMT(4) = """9""" Or sCOMT(4) = """0""" Then
sCOMT(2) = Left(sCOMT(2), 11) & " " & Right(sCOMT(3), 9)
sCOMT(3) = ""
If sCOMT(0) = """MORV00""" Then
sCOMT(39) = ""
If sCOMT(34) = """""" Then
sCOMT(34) = "N"
End If
ElseIf sCOMT(0) = """IMTR01""" Then
sCOMT(23) = ""
ElseIf sCOMT(0) = """INVA01""" Then
sCOMT(21) = ""
End If
sline = Join(sCOMT, ",")
If Mid(sline, 2, 4) = "IMTR" Then
N.WriteLine (sline)
ElseIf Mid(sline, 2, 4) = "MORV" Then
If Mid(sline, 30, 3) <> sCrap Then
O.WriteLine (sline)
End If
ElseIf Mid(sline, 2, 4) = "INVA" Then
sline = Replace(sline, ",.,", ",.0,")
If Mid(sline, 30, 3) <> sCrap Then
M.WriteLine (sline)
End If
End If
End If
End If
If Not P.AtEndOfStream Then
sline = P.ReadLine
Else
Exit Do
End If
Loop
P.Close
O.Close
N.Close
M.Close
Main = DTSTaskExecResult_Success
End Sub