Processing NEXT file

Processing NEXT file

Post by Rocky Perkin » Fri, 23 Aug 2002 03:50:38



I am using an active X script as a loop to scan a
directory and bring in files to a DTS package.  the
problem I am having is that, if the file is still in the
process of being ftp'd to the directory, the DTS package
fails, instead of moving on to the next available file, or
simply terminating.

I am wokring on the following script, but am uncertain as
to how to direct the statement to take the next file. I
appreciate any help given.

Function DateAccessed

dim fso
dim fil
set fold = fso.Getfolder("R:\Files1\")

for each fil in fold.Files
        if DateDiff("s", fil.DateLastAccessed, Now()) <= 1
then

END IF
NEXT
End Function

Thanks
Rocky

 
 
 

Processing NEXT file

Post by Andrés Taylo » Fri, 23 Aug 2002 04:51:38


Rocky,

You should try posting the same question to microsoft.public.sqlserver.dts

HTH,

--

Andrs Taylor


http://www.sql.nu/


Quote:> I am using an active X script as a loop to scan a
> directory and bring in files to a DTS package.  the
> problem I am having is that, if the file is still in the
> process of being ftp'd to the directory, the DTS package
> fails, instead of moving on to the next available file, or
> simply terminating.

> I am wokring on the following script, but am uncertain as
> to how to direct the statement to take the next file. I
> appreciate any help given.

> Function DateAccessed

> dim fso
> dim fil
> set fold = fso.Getfolder("R:\Files1\")

> for each fil in fold.Files
> if DateDiff("s", fil.DateLastAccessed, Now()) <= 1
> then

> END IF
> NEXT
> End Function

> Thanks
> Rocky


 
 
 

1. Need script for processing next row of data if error is encountered in row

Hi!

I am a newbie to DTS. Below is a sample code which copies
the data from a source text file to a destination text
file.

Assuming that there are 3 columns in the source text,
if one of the rows has a missing column (the last column),
DTS encouters an error and then stops processing the
succeeding rows. What is the best way to make DTS continue
processing those rows of data even if an error is
encountered (which is then logged into an error log).

Your help will be very much appreciated.

Thanks.

Elgar

'**********************************************************
************
'  Visual Basic Transformation Script
'**********************************************************
**************

'  Copy each source column to the destination column
Function Main()
 DTSDestination("name") = DTSSource("name")
 DTSDestination("company") = DTSSource("company")
 DTSDestination("phone") = DTSSource("phone")

 ' Check if any is NULL
 MsgBox DTSSource("name")
 MsgBox DTSSource("company")
 MsgBox DTSSource("phone")

 If DTSSource("name") = "" OR DTSSource("company") = ""
OR  DTSSource("phone") = "" Then
  Main = DTSTransformStat_SkipRow
 Else
  Main = DTSTransformStat_OK
 End If
End Function

Data from sample.txt
'name','company','phone'
'employee1','electriccompany','28668989'
'employee2','electriccompany',
'employee3','company','28668989'

2. Found a reliable way to detect row change in grid

3. The process cannot access the file because it is being used by another process

4. Oracle and TDateTime

5. The Process cannot access the file because it is being used by another process

6. need help printing to a file!

7. Moving to Next record problem(rs.Next())

8. Question: Relating Screens in FoxPro Mac 2.5

9. Enter,Next Row and Clear for Next record

10. user process,server process,application process

11. How do we know if a process is user process or system process

12. Read next line in a text file

13. paste from one file to the next