Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Global variable in ActiveX Script Task

Status
Not open for further replies.

ohmbru2

Technical User
Jul 24, 2001
51
US
I'm new to DTS. I'm trying to find the first file that matches a pattern, but this keeps returning the pattern, nmot the file name that matches it. So the source file is "polh*.dat" rather that "polh_06262006.dat"

Then, of course, the step to transfer the text file fails.


Function Main()

Dim oFSO
Dim sSourceFile
Dim sDestinationFile

Dim iFileName
Dim iDirectory
Dim iPattern
Dim iNewDirectory
Dim conTextFile
Dim Pkg

set pkg = DTSGlobalVariables.Parent
Set oFSO = CreateObject("Scripting.FileSystemObject")

iDirectory = "c:\test\"
iPattern = "polh*.dat"
iNewDirectory = iDirectory & "History\test\"
iFileName = (iDirectory & iPattern)


DTSGlobalVariables("hFile").Value = iFileName

set conTextFile = pkg.Connections("polh")
conTextFile.DataSource = DTSGlobalVariables("iFileName").Value

oFSO.CopyFile sSourceFile, sDestinationFile

' Clean Up
Set oFSO = Nothing

Main = DTSTaskExecResult_Success
End Function




 
Why do you have iFileName defined in parentheses?

Code:
iFileName = (iDirectory & iPattern)

If they are needed, should you have double quotes around the concatenation?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top