Tuesday, March 27, 2012

ActiveX Vbscript still ok in Yukon ?

Will I still be able to use my current VBscripts (Active X) code in dts
packages in Yukon ?
Hi
In SQL Server 2005, there is an optional install of the SQL Server 2000 DTS
engine. this will allow the existing scripts to work (as long as you don't
use any T-SQL that is no longer supported in SQL Server 2005).
The new DTS engine in SQL Server 2005 is amazing and you will be very
tempted to convert your existing packages ASAP to the new engine.
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Rob C" <rwc1960@.bellsouth.net> wrote in message
news:I81xd.21621$rO2.720@.bignews1.bellsouth.net...
> Will I still be able to use my current VBscripts (Active X) code in dts
> packages in Yukon ?
>

ActiveX VBScript problem

Below is a code snippet that is throwing the following error:

Error Source: Microsoft DTS Package

Error Description: Error Code: 0
Error Source= Microsoft VBScript runtime error
Error Description: Object required: 'Server'

Error on line 13

In my code line 13 is the following:
Set Cnxn = Server.CreateObject("ADODB.connection")

I did set up a Microsoft OLE DB connection in my DTS package for this
ActiveX Task. I'm new to VBScript and ActiveX. Any help would be
appreciated.

Thanks,

-p

'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************

Function Main()
Main = DTSTaskExecResult_Success

' connection, command and recordset variables
Dim Cnxn, strCnxn

' create and open connection
Set Cnxn = Server.CreateObject("ADODB.connection")
strCnxn = "data source=Pluto;initial catalog=Stats;User Id=sa;password=;"
Cnxn.Open strCnxn

End FunctionThe Server object is only available when running scripts under IIS. You
don't need it when running scripts via DTS or stand-alone. Try:

Set Cnxn = CreateObject("ADODB.Connection")

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Pippen" <123@.hotmail.com> wrote in message
news:ESCWc.223077$eM2.87297@.attbi_s51...
> Below is a code snippet that is throwing the following error:
> Error Source: Microsoft DTS Package
> Error Description: Error Code: 0
> Error Source= Microsoft VBScript runtime error
> Error Description: Object required: 'Server'
> Error on line 13
> In my code line 13 is the following:
> Set Cnxn = Server.CreateObject("ADODB.connection")
> I did set up a Microsoft OLE DB connection in my DTS package for this
> ActiveX Task. I'm new to VBScript and ActiveX. Any help would be
> appreciated.
> Thanks,
> -p
> '************************************************* *********************
> ' Visual Basic ActiveX Script
> '************************************************* ***********************
> Function Main()
> Main = DTSTaskExecResult_Success
> ' connection, command and recordset variables
> Dim Cnxn, strCnxn
> ' create and open connection
> Set Cnxn = Server.CreateObject("ADODB.connection")
> strCnxn = "data source=Pluto;initial catalog=Stats;User Id=sa;password=;"
> Cnxn.Open strCnxn
> End Function|||"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:NNGWc.4935$N04.1043@.newssvr23.news.prodigy.co m...
> The Server object is only available when running scripts under IIS. You
> don't need it when running scripts via DTS or stand-alone. Try:
> Set Cnxn = CreateObject("ADODB.Connection")
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Pippen" <123@.hotmail.com> wrote in message
> news:ESCWc.223077$eM2.87297@.attbi_s51...
> > Below is a code snippet that is throwing the following error:
> > Error Source: Microsoft DTS Package
> > Error Description: Error Code: 0
> > Error Source= Microsoft VBScript runtime error
> > Error Description: Object required: 'Server'
> > Error on line 13
> > In my code line 13 is the following:
> > Set Cnxn = Server.CreateObject("ADODB.connection")
> > I did set up a Microsoft OLE DB connection in my DTS package for this
> > ActiveX Task. I'm new to VBScript and ActiveX. Any help would be
> > appreciated.
> > Thanks,
> > -p
> > '************************************************* *********************
> > ' Visual Basic ActiveX Script
'************************************************* ***********************
> > Function Main()
> > Main = DTSTaskExecResult_Success
> > ' connection, command and recordset variables
> > Dim Cnxn, strCnxn
> > ' create and open connection
> > Set Cnxn = Server.CreateObject("ADODB.connection")
> > strCnxn = "data source=Pluto;initial catalog=Stats;User
Id=sa;password=;"
> > Cnxn.Open strCnxn
> > End Function

That fixed it! Thanks for your help.

-p

ActiveX VBScript DTS IsDate

Can someone explian why I get a return of not a valid date when using
activeX vbscript for DTS:
Select (Date())
Case (IsDate(Date())
msgbox "OK"
Case Else
msbox "I cant figure this out"
End Select
msbox "I cant figure this out" pops rather than msgbox "OK"Your Select Case statement is malformed. Try:
Select Case IsDate(Date())
Case True
MsgBox "OK"
Case Else
MsgBox "I cant figure this out"
End Select
Hope this helps.
Dan Guzman
SQL Server MVP
<lebeau777@.hotmail.com> wrote in message
news:1143836184.567616.6570@.z34g2000cwc.googlegroups.com...
> Can someone explian why I get a return of not a valid date when using
> activeX vbscript for DTS:
> Select (Date())
> Case (IsDate(Date())
> msgbox "OK"
> Case Else
> msbox "I cant figure this out"
> End Select
> msbox "I cant figure this out" pops rather than msgbox "OK"
>|||Please ignore my previous response (copy/paste error). The script should
be:
Select Case IsDate(Date())
Case True
msgbox "OK"
Case Else
msgbox "I cant figure this out"
End Select
Hope this helps.
Dan Guzman
SQL Server MVP
"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:u45IViZVGHA.3716@.TK2MSFTNGP15.phx.gbl...
> Your Select Case statement is malformed. Try:
> Select Case IsDate(Date())
> Case True
> MsgBox "OK"
> Case Else
> MsgBox "I cant figure this out"
> End Select
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> <lebeau777@.hotmail.com> wrote in message
> news:1143836184.567616.6570@.z34g2000cwc.googlegroups.com...
>

Sunday, March 25, 2012

ActiveX transformations gone from SSIS?

In good old fashioned DTS there was the ability to perform custom transformations using activeX / vbscripty type language - does this still exist or are we stuck with the derived column editor?

I have never used DTS; but I know you can create Script tasks in the control flow and script components in the data flow.

Jamie Thomson has a series of post where he points some differences between DTS and SSIS:

http://blogs.conchango.com/jamiethomson/archive/2006/06/28/4156.aspx

|||

This does not still exist. You can either use the Derived Column transform or the Script Component transform.

One of the reasons this went away was the poor performance of using interpreted script. Another is that the built-in transforms in SSIS are so much more complete.

But the Derived Column transform could certainly use a better editor...

ActiveX to warm up Report Server ?

Because the IIS threads are recycled at night, the first user that calls up Report Manager in the morning has to wait 30 seconds before the page loads, as IIS is creating a thread.

I'd like to set up a job in SQL Agent that will navigate to http://localhost/reports/ every morning before users come in to work, so they won't have to wait.

I think a SAL Agent job of type ActiveX Script would be suitable for this, so I need to write the code to navigate to the reports page in VBScript.

Anyone knows how to navigate to a page in VBScript ?

tia.

I meant SQL Agent job, of course, not SAL.|||

Schedule a job with a simple plain empty record and schedule this before the needed time.

Jens K. Suessmeyer.

http://www.sqlserver2005.de

|||

I know how to schedule a job, but what is a "plain empty record" ? I have lots of RS subscriptions scheduled already and they don't affect the way the first user has to wait 30 secs for Report Manager to load up.

What I wanted to know was how to navigate to the report manager home page in VBScript. I couldn't find any example anywhere.

|||

This isnt a solution that you are looking for but maybe you dont need to reschedule the IIS worker process every night? My reportserver serves up about 800 reports per week and its hosted on a server which also hosts 9 other web applications.

I have set it in IIS that the worker process for report server does not recycle at all, and so far it hasnt recycled for 6 weeks. I occasionally manually recycle it and then go straight to the report server home page to start up the server quickly again.

Depends on your environment but maybe you dont need to recycle it every night.

sql

ActiveX to define presidence

I have a DTS package (SQL2000) which uses ActiveX scripts to check for records with certain criteria in a table. If the certain criteria is met, I want to initiate a child package that preforms a data-extraction. Otherwise move onto the next step which check for a different set of criteria. Currently if the criteria is met, I flag the task as success to dictate moving to one set of steps, otherwise failure & moving onto the next check.

The problem I am realizing, is that if I 'Fail' on of the check steps, subsequent steps furthur down the route that I am directing it to go, do not run. These are other ActiveX tasks that send email, and do furthur analysis.

Why is this the case? Can't you perform a logical check, and based upon the check have a decision to run certain steps? I attempted to use the result 'Main = DTSStepScriptResult_DontExecuteTask', but I must not be using it correctly, because it lists the task as returning failure.

Any help would be great.

Kevin Albrecht

DTS is called "SQL Server Integration Services" in the SQL Server 2005 generation. If you re-post your question in the SSIS forums (http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=80&SiteID=1) the DTS experts that hang out over there could likely answer your question.

Thanks,
Steve

|||Moving thread as per the suggestion to keep in SSIS related forums.|||Don't use success/fail as the flag to move to the next step. Set a variable and use an "Expression" precidence constraint to pick which one to move too.

ActiveX to copy and rename file

Hi,

I'm looking to use ActiveX in a DTS to copy a file from on elocation to another.
I have the code for this (attached below kindly supplied by a colleague), so that's cool.

dim filesys
set filesys=CreateObject("Scripting.FileSystemObject")

If filesys.FileExists("D:\Credits\Credits_MTD.mdb") Then
filesys.CopyFile "D:\Credits\Credits_MTD.mdb", _
"C:\Credits\Credits_200602.mdb"
End If

But what I'm looking to do is go one step further.
As you can see, it renames the file to yyyymm, but this is hard coded, and I'm looking for a coded solution so I can rename the file with yesterday's date.

Can anybody help me please?declare a variable path,get year,month,day-1 from system date,concatnate all and concatnate again with ur file path.
pass that variable.|||Cheers - sorry to be a apin but is it something like this:

dim newDate
newDate = FormatDateTime( Now()-1 , yyyymmdd )

....\Credits_" & NewDate & ".mdb"

I tried that, and it came back with Path Not Found|||Cheers - sorry to be a apin but is it something like this:

dim newDate
newDate = FormatDateTime( Now()-1 , yyyymmdd )

....\Credits_" & NewDate & ".mdb"



I tried that, and it came back with Path Not Found

Unforunatly I dont have vb platform to test it.

create the variable first and pass that variable.


dim path
path="C:\Credits\Credits_"&NewDate&".mdb"
filesys.CopyFile "D:\Credits\Credits_MTD.mdb", path|||Cheers,
Will try that now.

activeX step never finishes.

I have an activex script which executes a query that never finishes. If I recompile the query in Management Studio before I run this step, then the step will *usually* work fine. This is the last step in a very long update process so the data has changed a great deal when this step executes.

The query always works fine in Management studio btw.

I am using BI studio to run the package.

I have tried placing a step before this that marks the query for recompilation but that doesnt seem to work. Any ideas how to resolve this?

Why ActiveX?|||it loops through the result set and sends out an email for each record. The package was originally a dts 2000 package so I just kept it as is. If theres a better way to do this in SSIS I would love to know.|||Use an Execute SQL task to populate an object-typed variable. Hook the SQL task to a Foreach loop which "shreds" the variable. Inside that foreach loop you could use a Send Mail task.

See if this helps: http://blogs.conchango.com/jamiethomson/archive/2005/07/04/SSIS-Nugget_3A00_-Execute-SQL-Task-into-an-object-variable-_2D00_-Shred-it-with-a-Foreach-loop.aspx

ActiveX Scritping was not able to initialize the script execution

I get this error ActiveX Scritping was not able to initialize the script
execution engine
Whenever a VBScripts is exe agaist SQL Server. The oddity is all works under
my NT account fine. Use anybody elses account or our service account it will
not work and you recieve the message above.
any ideas?A google search on the error came back with many hits. See if this helps...
http://www.sqldts.com/default.aspx?224
"jG" <jG@.discussions.microsoft.com> wrote in message
news:E82F512F-E180-429D-9BC5-2E9290B4DDE9@.microsoft.com...
> I get this error ActiveX Scritping was not able to initialize the script
> execution engine
> Whenever a VBScripts is exe agaist SQL Server. The oddity is all works
under
> my NT account fine. Use anybody elses account or our service account it
will
> not work and you recieve the message above.
> any ideas?

ActiveX script to grab all users in Active Directory and tranfer to SQL Server.

Hello,

Does anyone has any idea, or information on how to write an ActiveX script to grab all the users from Active Directory and transfer it into a recordset, SQL server, etc..

Really need help.

Thank you very much.

I'm assuming that because this is a SSIS forum you are looking to use the SSIS ActiveX Script Task?

Don't do it. That task is only there for DTS 2000 migrated packages. Use a Script Task instead.

-Jamie|||

I am using SQL Server 2000. So, I do want to use a script task, and that's what I have (code snippet):


Dim con
Dim rs
Dim FileSystem
Set FileSystem = WScript.CreateObject("Scripting.FileSystemObject")
Set OutPutFile = FileSystem.CreateTextFile("marketing.txt", True)

set con = CreateObject("ADODB.connection")
set rs = CreateObject("ADODB.recordset")
con.Provider = "ADsDSOObject"
con.Open "Active Directory Provider"
Set rs = con.Execute("<LDAP://MyServerName/DC=MyDomain>;(objectClass=User);ADsPath;onelevel")


But when I execute I get an error message stating that table does not exist. That happens in the LDAP Provider. Any ides?

Thank you.

|||This isn't a DTS forum. Try microsoft.public.sqlserver.dts on USENET/NNTP/newsgroups/whatever they're call these days.sql

ActiveX Script Task] Error:

Hi,
I'm trying to reset the below Global varialbe in SSIS - Activex script.

Function Main()
DTSGlobalVariables("GxvFilename").value =null
Main = DTSTaskExecResult_Success
End Function

Getting the below Error when executing the package.

[ActiveX Script Task] Error: Retrieving the file name for a component failed with error code 0x060339E4

Please provide me solution for this.

Thanks,

You can read and write global variables from ActiveX Script, but I have to ask why bother when you have the much more powerfull VB.net in the Script Task.

I don't belive null is a valid keyword in VBScript. Nothing is more usual, and use a Set statement. Saying all that I tried and got the same error. Unless anyone can come up with something better I'd say this is a backward compatability issue, and you woudl be better off moving to the Script Task.

|||

Thanks Darren,

The Activex Script is not working as like SQL 2000. We nee to use " " instead of null for resting the global variables.
MS need to give some reasonable error message for this kind of error.

Anyway I made it work in Activex Script iteself.

ActiveX Script Task] Error:

Hi,
I'm trying to reset the below Global varialbe in SSIS - Activex script.

Function Main()
DTSGlobalVariables("GxvFilename").value =null
Main = DTSTaskExecResult_Success
End Function

Getting the below Error when executing the package.

[ActiveX Script Task] Error: Retrieving the file name for a component failed with error code 0x060339E4

Please provide me solution for this.

Thanks,

You can read and write global variables from ActiveX Script, but I have to ask why bother when you have the much more powerfull VB.net in the Script Task.

I don't belive null is a valid keyword in VBScript. Nothing is more usual, and use a Set statement. Saying all that I tried and got the same error. Unless anyone can come up with something better I'd say this is a backward compatability issue, and you woudl be better off moving to the Script Task.

|||

Thanks Darren,

The Activex Script is not working as like SQL 2000. We nee to use " " instead of null for resting the global variables.
MS need to give some reasonable error message for this kind of error.

Anyway I made it work in Activex Script iteself.

ActiveX Script Task/Function Not Found

We have a SQL Server 2005 Cluster that we are trying to send email from to notify when certain jobs have completed, failed, etc. We are having a bit of a problem getting the email to work and I believe that the failure is at the SMTP server, not at the SQL level.

That being said, I'm trying to create a simple SSIS package that I can use to test connectivity to the SMTP server with and send email. I've added an ActiveX Script Task that calls a COM object that actually sends the email. I keep getting a "Function not found." error when I try to execute the package, and I have no idea why I'm getting that. It says that the errors were found during validation.

Can anyone help?

Function not found is most likely the result of an invalid reference.

However, we do not recommend using the ActiveX script task - it is only for backwards compat. Better to move to the Script task which uses VB.Net and which enables a much better development and debugging experience.

Donald

ActiveX Script Task being ran twice?

I currently have a DTS package that contains an ActiveX Script Task. This script creates a report and saves the report in the database (for scalability reasons.) When I execute the step in Enterprise Manager it generates two entries in the database, it should only create one. If I take the script out of the DTS package and run it using CScript.exe it only creates one entry in the database.

Has anyone run into this problem before? Could I have done anything to the package that would cause it to execute the ActiveX Script Task twice?

Thanks for any advice to resolve this issue.

Have a great day,

CraigI figured it out, I was making the following call, "Call Main()" in my script and didn't realize that by default DTS packages call Main().

ActiveX Script Task - SSIS

Within a SQL 2000 DTS Package I have an ActiveX Script that would go within my transform tasks and update the queries by concatenating a "Where" clause with a date from a database table. This way I could keep track of when the last time I updated the table so that I could only bring down the rows since the last run. How can this be done within SSIS? I've been looking and I'm getting confused. Any help would be greatly appreciated.

The most analogous thing to an ActiveX Script in SSIS is the script component but that isn't what you want to use here. Instead, set the SQL statement that pulls data from your source dynamically like so: http://blogs.conchango.com/jamiethomson/archive/2005/12/09/2480.aspx

-Jamie

|||

Jamie,

Thank you for your response. We went ahead and used a data flow with a RecordSet Destination. Then we used a "ForEach" loop to cycle through the RecordSet and run our query based on each value and then stored the data in a raw table.

Thanks again for all your help on this issue and others.

Jerry

sql

ActiveX Script Task - Help!

I have a script that is run in Excel or Access that automatically runs the code I have cut/pasted below. I attempted to cut/paste into an activeX task, but doesn't work. Would anyone be able to convert this to vbscript?
Thank you in advance for your help,
clutch
Attribute VB_Name = "CD-1291"
Option Compare Database
Option Explicit
Public Function CD1291()
On Error GoTo CD1291_Err
Dim Y As String, M1 As String, M2 As String, D1 As String, D2 As String, d As String, L1, L2, sd As Date
d = Application.CurrentProject.Path
If Dir(d & "\CD1291.msl") <> "" Then Kill (d & "\CD1291.msl")
If Dir(d & "\CD1291.bat") <> "" Then Kill (d & "\CD1291.bat")
If Dir(d & "\CD1291.mod") <> "" Then Kill (d & "\CD1291.mod")
If Dir(d & "\CD1291.prj") <> "" Then Kill (d & "\CD1291.prj")
If Dir(d & "\CD1291.RPT") <> "" Then Kill (d & "\CD1291.RPT")
If Dir(d & "\CD1291.TMP") <> "" Then Kill (d & "\CD1291.TMP")
Y = Year(Now() - 1)
M1 = Month(Now() - 1)
If M1 < 10 Then
M1 = "0" & M1
End If
M2 = Month(Now() - 1)
If M2 < 10 Then
M2 = "0" & M2
End If
D1 = Day(Now() - 1)
If D1 < 10 Then
D1 = "0" & D1
End If
D2 = Day(Now() - 1)
If D2 < 10 Then
D2 = "0" & D2
End If
'MsgBox Y & "-" & M1 & "-" & D1
p = Application.CurrentProject.Path
''' MSL
Open p & "\CD1291.msl" For Output As #1
Print #1, "OPENTOPIC SERVERID 'OARS' TOPICNAME '5625' TOPICVERSIONID '" & Y & M1 & D1 & "001001' TOPICITEM 'CD-1291 1853 SYS E=" & M2 & D2 & "0" & Right(Y, 1) + 1 & "' REPORTID 'CD-1291' EXACTTOPICITEM"
Print #1, "EXPORT ASCII FILE '" & p & "\CD1291.TMP' ALL GROUP ''"
Print #1, "CLOSE"
Print #1, "RUN '" & p & "\CD1291.bat'"
Print #1, "EXIT"
Close #1
''' MOD
Open p & "\CD1291.mod" For Output As #1
Print #1, "MFWMOD12"
Print #1, "~Description"
Print #1, "Premier Bankcard, Inc."
Print #1, ""
Print #1, "~Settings"
Print #1, "M/D/Y"
Print #1, "50"
Print #1, "."
Print #1, "0"
Print #1, "1"
Print #1, "1"
Print #1, ","
Print #1, "0"
Print #1, "N"
Print #1, "N"
Print #1, "N"
Print #1, "Y"
Print #1, "~ExtendedSettings"
Print #1, "42"
Print #1, "N"
Print #1, "(Null)"
Print #1, "1"
Print #1, "1"
Print #1, "128128255"
Print #1, "128,32,96"
Print #1, "255,0,255"
Print #1, "160,0,224"
Print #1, "64128128"
Print #1, "255,0,128"
Print #1, "128128128"
Print #1, "85,85,255"
Print #1, "128,0,128"
Print #1, "193,0,193"
Print #1, "255115115"
Print #1, "128,64,255"
Print #1, "0,128,0"
Print #1, "128,64,64"
Print #1, "255,0,0"
Print #1, "255191255"
Print #1, "255255255"
Print #1, "225225225"
Print #1, "151151151"
Print #1, "N"
Print #1, "N"
Print #1, "N"
Print #1, "12"
Print #1, "Verdana"
Print #1, "0,0,0"
Print #1, "N"
Print #1, "N"
Print #1, "N"
Print #1, "10"
Print #1, "Verdana"
Print #1, "0,0,0"
Print #1, "N"
Print #1, "N"
Print #1, "N"
Print #1, "8"
Print #1, "Verdana"
Print #1, "0,0,0"
Print #1, "N"
Print #1, "~TableField"
Print #1, "Acct #"
Print #1, "16"
Print #1, "0"
Print #1, "0"
Print #1, "1"
Print #1, "C"
Print #1, "0"
Print #1, "16"
Print #1, "3"
Print #1, "N"
Print #1, "N"
Print #1, "16"
Print #1, "5"
Print #1, "0"
Print #1, "0"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Acct #"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Pymt Date"
Print #1, "10"
Print #1, "0"
Print #1, "0"
Print #1, "1"
Print #1, "C"
Print #1, "0"
Print #1, "10"
Print #1, "4"
Print #1, "N"
Print #1, "N"
Print #1, "10"
Print #1, "5"
Print #1, "0"
Print #1, "18"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Pymt Date"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Payment"
Print #1, "18"
Print #1, "2"
Print #1, "0"
Print #1, "1"
Print #1, "N"
Print #1, "0"
Print #1, "19"
Print #1, "5"
Print #1, "N"
Print #1, "N"
Print #1, "19"
Print #1, "5"
Print #1, "0"
Print #1, "30"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Payment"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Float Amount"
Print #1, "18"
Print #1, "2"
Print #1, "0"
Print #1, "1"
Print #1, "N"
Print #1, "0"
Print #1, "16"
Print #1, "6"
Print #1, "N"
Print #1, "N"
Print #1, "16"
Print #1, "5"
Print #1, "0"
Print #1, "53"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Float Amount"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Strat ID"
Print #1, "4"
Print #1, "0"
Print #1, "0"
Print #1, "1"
Print #1, "C"
Print #1, "0"
Print #1, "4"
Print #1, "7"
Print #1, "N"
Print #1, "N"
Print #1, "4"
Print #1, "5"
Print #1, "0"
Print #1, "70"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Strat ID"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Line"
Print #1, "4"
Print #1, "0"
Print #1, "0"
Print #1, "1"
Print #1, "C"
Print #1, "0"
Print #1, "4"
Print #1, "8"
Print #1, "N"
Print #1, "N"
Print #1, "4"
Print #1, "5"
Print #1, "0"
Print #1, "80"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Line"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Actn ID"
Print #1, "4"
Print #1, "0"
Print #1, "0"
Print #1, "1"
Print #1, "C"
Print #1, "0"
Print #1, "4"
Print #1, "9"
Print #1, "N"
Print #1, "N"
Print #1, "4"
Print #1, "5"
Print #1, "0"
Print #1, "86"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Actn ID"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Ltr #"
Print #1, "4"
Print #1, "0"
Print #1, "0"
Print #1, "1"
Print #1, "C"
Print #1, "0"
Print #1, "4"
Print #1, "10"
Print #1, "N"
Print #1, "N"
Print #1, "4"
Print #1, "5"
Print #1, "0"
Print #1, "96"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Ltr #"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Ltr Data"
Print #1, "4"
Print #1, "0"
Print #1, "0"
Print #1, "1"
Print #1, "C"
Print #1, "0"
Print #1, "4"
Print #1, "11"
Print #1, "N"
Print #1, "N"
Print #1, "4"
Print #1, "5"
Print #1, "0"
Print #1, "108"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Ltr Data"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Float %"
Print #1, "18"
Print #1, "0"
Print #1, "0"
Print #1, "1"
Print #1, "N"
Print #1, "0"
Print #1, "5"
Print #1, "12"
Print #1, "N"
Print #1, "N"
Print #1, "5"
Print #1, "5"
Print #1, "0"
Print #1, "119"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Float %"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Q Prio"
Print #1, "2"
Print #1, "0"
Print #1, "0"
Print #1, "1"
Print #1, "C"
Print #1, "0"
Print #1, "2"
Print #1, "13"
Print #1, "N"
Print #1, "N"
Print #1, "2"
Print #1, "5"
Print #1, "2"
Print #1, "18"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Q Prio"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Float Cycle"
Print #1, "3"
Print #1, "0"
Print #1, "0"
Print #1, "1"
Print #1, "C"
Print #1, "0"
Print #1, "3"
Print #1, "14"
Print #1, "N"
Print #1, "N"
Print #1, "3"
Print #1, "5"
Print #1, "2"
Print #1, "30"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Float Cycle"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Rpt"
Print #1, "7"
Print #1, "0"
Print #1, "0"
Print #1, "1"
Print #1, "C"
Print #1, "0"
Print #1, "7"
Print #1, "1"
Print #1, "N"
Print #1, "N"
Print #1, "7"
Print #1, "0"
Print #1, "0"
Print #1, "0"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Rpt"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Date"
Print #1, "8"
Print #1, "0"
Print #1, "0"
Print #1, "1"
Print #1, "D"
Print #1, "0"
Print #1, "12"
Print #1, "2"
Print #1, "N"
Print #1, "N"
Print #1, "14"
Print #1, "0"
Print #1, "0"
Print #1, "107"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Date"
Print #1, "3"
Print #1, "N"
Print #1, "1"
Print #1, "1"
Print #1, "~Level"
Print #1, "0"
Print #1, ""
Print #1, "1"
Print #1, "CD-1291 1108/ AVAILABLE FUNDS ACCOUNT DATA FIRST PREMIER BANK -FD- 01/09/04 PAGE 1 "
Print #1, "2"
Print #1, "0"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~LevelExtended"
Print #1, "0"
Print #1, "2"
Print #1, "Page Header"
Print #1, "N"
Print #1, "N"
Print #1, "~Level"
Print #1, "5"
Print #1, "???????????"
Print #1, "3"
Print #1, "5149860001000015 2004/01/09 5.00 5.00 0002 0009 0001 0000 0000 100 "
Print #1, " QUEUE PRIO FLOAT CYCL "
Print #1, " 00 011 "
Print #1, "12"
Print #1, "0"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~LevelExtended"
Print #1, "5"
Print #1, "2"
Print #1, "Detail"
Print #1, "N"
Print #1, "N"
Print #1, "~PageSetup"
Print #1, "1"
Print #1, "256"
Print #1, "10"
Print #1, "50"
Print #1, "50"
Print #1, "2"
Print #1, "Y"
Print #1, "Y"
Print #1, "Y"
Print #1, ""
Print #1, "~PageSetupExtended"
Print #1, "1"
Print #1, "Y"
Print #1, "~End"
Close #1
'''PRJ
Open p & "\CD1291.prj" For Output As #1
Print #1, "MFWPRJ01"
Print #1, "[RefreshDDR]"
Print #1, "[InputFile]"
Print #1, p & "\CD1291.RPT"
Print #1, "[ModelFile]"
Print #1, p & "\CD1291.mod"
Print #1, "[ViewTable]"
Print #1, "[SummaryNoChart]"
Print #1, "[Author]"
Print #1, "[Description]"
Print #1, "[ASCII]"
Print #1, "[End]"
Close #1
''' BAT
Open p & "\CD1291.bat" For Output As #1
Print #1, "@.echo off"
Print #1, "copy " & p & "\CD1291.TMP " & p & "\CD1291.RPT"
Print #1, "del " & p & "\CD1291.TMP"
Close #1
'''Execute
Do Until Dir(p & "\CD1291.TMP") <> "" Or Dir(p & "\CD1291.RPT") <> ""
Shell ("C:\Program Files\Mobius\DDR\rdswin.exe " & p & "\CD1291.msl /E")
Pause (30)
Loop
Do Until Dir(p & "\CD1291.TMP") = ""
DoEvents
Loop
Pause (5)
If Dir("C:\CD1291.ASC") <> "" Then Kill ("C:\CD1291.ASC")
Shell ("C:\Program Files\Mobius\DocuAnalyzer\program\analyzer.exe " & p & "\CD1291.prj " & p & "\CD1291.ASC")
Pause (5)
L1 = 1
Do Until L1 = L2
Open p & "\CD1291.ASC" For Random As #1
L1 = LOF(1)
Close #1
Pause (5)
Open p & "\CD1291.ASC" For Random As #1
L2 = LOF(1)
Close #1
Loop
Pause (5)
If Dir(p & "\CD1291.msl") <> "" Then Kill (p & "\CD1291.msl")
If Dir(p & "\CD1291.bat") <> "" Then Kill (p & "\CD1291.bat")
If Dir(p & "\CD1291.mod") <> "" Then Kill (p & "\CD1291.mod")
If Dir(p & "\CD1291.prj") <> "" Then Kill (p & "\CD1291.prj")
If Dir(p & "\CD1291.RPT") <> "" Then Kill (p & "\CD1291.RPT")
If Dir(p & "\CD1291.TMP") <> "" Then Kill (p & "\CD1291.TMP")
End Function
You are going to have some very hard work cut out for you here. There is no
application class in VBScripting. There is no DIR() function. There is no
Kill function. You may want to transfer code to VB.net and then have DTS run
an application.
Andrew C. Madsen
Information Architect
Harley-Davidson Motor Company
"clutch" <clutch@.discussions.microsoft.com> wrote in message
news:974122A0-6D23-4C82-BA82-2FCBAF8D2716@.microsoft.com...
> I have a script that is run in Excel or Access that automatically runs the
code I have cut/pasted below. I attempted to cut/paste into an activeX task,
but doesn't work. Would anyone be able to convert this to vbscript?
> Thank you in advance for your help,
> clutch
> Attribute VB_Name = "CD-1291"
> Option Compare Database
> Option Explicit
> Public Function CD1291()
> On Error GoTo CD1291_Err
> Dim Y As String, M1 As String, M2 As String, D1 As String, D2 As String, d
As String, L1, L2, sd As Date
>
> d = Application.CurrentProject.Path
> If Dir(d & "\CD1291.msl") <> "" Then Kill (d & "\CD1291.msl")
> If Dir(d & "\CD1291.bat") <> "" Then Kill (d & "\CD1291.bat")
> If Dir(d & "\CD1291.mod") <> "" Then Kill (d & "\CD1291.mod")
> If Dir(d & "\CD1291.prj") <> "" Then Kill (d & "\CD1291.prj")
> If Dir(d & "\CD1291.RPT") <> "" Then Kill (d & "\CD1291.RPT")
> If Dir(d & "\CD1291.TMP") <> "" Then Kill (d & "\CD1291.TMP")
> Y = Year(Now() - 1)
> M1 = Month(Now() - 1)
> If M1 < 10 Then
> M1 = "0" & M1
> End If
> M2 = Month(Now() - 1)
> If M2 < 10 Then
> M2 = "0" & M2
> End If
> D1 = Day(Now() - 1)
> If D1 < 10 Then
> D1 = "0" & D1
> End If
> D2 = Day(Now() - 1)
> If D2 < 10 Then
> D2 = "0" & D2
> End If
> 'MsgBox Y & "-" & M1 & "-" & D1
> p = Application.CurrentProject.Path
> ''' MSL
> Open p & "\CD1291.msl" For Output As #1
> Print #1, "OPENTOPIC SERVERID 'OARS' TOPICNAME '5625' TOPICVERSIONID
'" & Y & M1 & D1 & "001001' TOPICITEM 'CD-1291 1853 SYS E=" & M2 & D2 &
"0" & Right(Y, 1) + 1 & "' REPORTID 'CD-1291' EXACTTOPICITEM"
> Print #1, "EXPORT ASCII FILE '" & p & "\CD1291.TMP' ALL GROUP ''"
> Print #1, "CLOSE"
> Print #1, "RUN '" & p & "\CD1291.bat'"
> Print #1, "EXIT"
> Close #1
> ''' MOD
> Open p & "\CD1291.mod" For Output As #1
> Print #1, "MFWMOD12"
> Print #1, "~Description"
> Print #1, "Premier Bankcard, Inc."
> Print #1, ""
> Print #1, "~Settings"
> Print #1, "M/D/Y"
> Print #1, "50"
> Print #1, "."
> Print #1, "0"
> Print #1, "1"
> Print #1, "1"
> Print #1, ","
> Print #1, "0"
> Print #1, "N"
> Print #1, "N"
> Print #1, "N"
> Print #1, "Y"
> Print #1, "~ExtendedSettings"
> Print #1, "42"
> Print #1, "N"
> Print #1, "(Null)"
> Print #1, "1"
> Print #1, "1"
> Print #1, "128128255"
> Print #1, "128,32,96"
> Print #1, "255,0,255"
> Print #1, "160,0,224"
> Print #1, "64128128"
> Print #1, "255,0,128"
> Print #1, "128128128"
> Print #1, "85,85,255"
> Print #1, "128,0,128"
> Print #1, "193,0,193"
> Print #1, "255115115"
> Print #1, "128,64,255"
> Print #1, "0,128,0"
> Print #1, "128,64,64"
> Print #1, "255,0,0"
> Print #1, "255191255"
> Print #1, "255255255"
> Print #1, "225225225"
> Print #1, "151151151"
> Print #1, "N"
> Print #1, "N"
> Print #1, "N"
> Print #1, "12"
> Print #1, "Verdana"
> Print #1, "0,0,0"
> Print #1, "N"
> Print #1, "N"
> Print #1, "N"
> Print #1, "10"
> Print #1, "Verdana"
> Print #1, "0,0,0"
> Print #1, "N"
> Print #1, "N"
> Print #1, "N"
> Print #1, "8"
> Print #1, "Verdana"
> Print #1, "0,0,0"
> Print #1, "N"
> Print #1, "~TableField"
> Print #1, "Acct #"
> Print #1, "16"
> Print #1, "0"
> Print #1, "0"
> Print #1, "1"
> Print #1, "C"
> Print #1, "0"
> Print #1, "16"
> Print #1, "3"
> Print #1, "N"
> Print #1, "N"
> Print #1, "16"
> Print #1, "5"
> Print #1, "0"
> Print #1, "0"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Acct #"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Pymt Date"
> Print #1, "10"
> Print #1, "0"
> Print #1, "0"
> Print #1, "1"
> Print #1, "C"
> Print #1, "0"
> Print #1, "10"
> Print #1, "4"
> Print #1, "N"
> Print #1, "N"
> Print #1, "10"
> Print #1, "5"
> Print #1, "0"
> Print #1, "18"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Pymt Date"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Payment"
> Print #1, "18"
> Print #1, "2"
> Print #1, "0"
> Print #1, "1"
> Print #1, "N"
> Print #1, "0"
> Print #1, "19"
> Print #1, "5"
> Print #1, "N"
> Print #1, "N"
> Print #1, "19"
> Print #1, "5"
> Print #1, "0"
> Print #1, "30"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Payment"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Float Amount"
> Print #1, "18"
> Print #1, "2"
> Print #1, "0"
> Print #1, "1"
> Print #1, "N"
> Print #1, "0"
> Print #1, "16"
> Print #1, "6"
> Print #1, "N"
> Print #1, "N"
> Print #1, "16"
> Print #1, "5"
> Print #1, "0"
> Print #1, "53"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Float Amount"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Strat ID"
> Print #1, "4"
> Print #1, "0"
> Print #1, "0"
> Print #1, "1"
> Print #1, "C"
> Print #1, "0"
> Print #1, "4"
> Print #1, "7"
> Print #1, "N"
> Print #1, "N"
> Print #1, "4"
> Print #1, "5"
> Print #1, "0"
> Print #1, "70"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Strat ID"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Line"
> Print #1, "4"
> Print #1, "0"
> Print #1, "0"
> Print #1, "1"
> Print #1, "C"
> Print #1, "0"
> Print #1, "4"
> Print #1, "8"
> Print #1, "N"
> Print #1, "N"
> Print #1, "4"
> Print #1, "5"
> Print #1, "0"
> Print #1, "80"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Line"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Actn ID"
> Print #1, "4"
> Print #1, "0"
> Print #1, "0"
> Print #1, "1"
> Print #1, "C"
> Print #1, "0"
> Print #1, "4"
> Print #1, "9"
> Print #1, "N"
> Print #1, "N"
> Print #1, "4"
> Print #1, "5"
> Print #1, "0"
> Print #1, "86"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Actn ID"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Ltr #"
> Print #1, "4"
> Print #1, "0"
> Print #1, "0"
> Print #1, "1"
> Print #1, "C"
> Print #1, "0"
> Print #1, "4"
> Print #1, "10"
> Print #1, "N"
> Print #1, "N"
> Print #1, "4"
> Print #1, "5"
> Print #1, "0"
> Print #1, "96"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Ltr #"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Ltr Data"
> Print #1, "4"
> Print #1, "0"
> Print #1, "0"
> Print #1, "1"
> Print #1, "C"
> Print #1, "0"
> Print #1, "4"
> Print #1, "11"
> Print #1, "N"
> Print #1, "N"
> Print #1, "4"
> Print #1, "5"
> Print #1, "0"
> Print #1, "108"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Ltr Data"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Float %"
> Print #1, "18"
> Print #1, "0"
> Print #1, "0"
> Print #1, "1"
> Print #1, "N"
> Print #1, "0"
> Print #1, "5"
> Print #1, "12"
> Print #1, "N"
> Print #1, "N"
> Print #1, "5"
> Print #1, "5"
> Print #1, "0"
> Print #1, "119"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Float %"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Q Prio"
> Print #1, "2"
> Print #1, "0"
> Print #1, "0"
> Print #1, "1"
> Print #1, "C"
> Print #1, "0"
> Print #1, "2"
> Print #1, "13"
> Print #1, "N"
> Print #1, "N"
> Print #1, "2"
> Print #1, "5"
> Print #1, "2"
> Print #1, "18"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Q Prio"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Float Cycle"
> Print #1, "3"
> Print #1, "0"
> Print #1, "0"
> Print #1, "1"
> Print #1, "C"
> Print #1, "0"
> Print #1, "3"
> Print #1, "14"
> Print #1, "N"
> Print #1, "N"
> Print #1, "3"
> Print #1, "5"
> Print #1, "2"
> Print #1, "30"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Float Cycle"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Rpt"
> Print #1, "7"
> Print #1, "0"
> Print #1, "0"
> Print #1, "1"
> Print #1, "C"
> Print #1, "0"
> Print #1, "7"
> Print #1, "1"
> Print #1, "N"
> Print #1, "N"
> Print #1, "7"
> Print #1, "0"
> Print #1, "0"
> Print #1, "0"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Rpt"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Date"
> Print #1, "8"
> Print #1, "0"
> Print #1, "0"
> Print #1, "1"
> Print #1, "D"
> Print #1, "0"
> Print #1, "12"
> Print #1, "2"
> Print #1, "N"
> Print #1, "N"
> Print #1, "14"
> Print #1, "0"
> Print #1, "0"
> Print #1, "107"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Date"
> Print #1, "3"
> Print #1, "N"
> Print #1, "1"
> Print #1, "1"
> Print #1, "~Level"
> Print #1, "0"
> Print #1, ""
> Print #1, "1"
> Print #1, "CD-1291 1108/ AVAILABLE FUNDS ACCOUNT DATA
FIRST PREMIER BANK -FD- 01/09/04 PAGE 1
"
> Print #1, "2"
> Print #1, "0"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~LevelExtended"
> Print #1, "0"
> Print #1, "2"
> Print #1, "Page Header"
> Print #1, "N"
> Print #1, "N"
> Print #1, "~Level"
> Print #1, "5"
> Print #1, ""
> Print #1, "3"
> Print #1, "5149860001000015 2004/01/09 5.00
5.00 0002 0009 0001 0000 0000 100
"
> Print #1, " QUEUE PRIO FLOAT CYCL
"
> Print #1, " 00 011
"
> Print #1, "12"
> Print #1, "0"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~LevelExtended"
> Print #1, "5"
> Print #1, "2"
> Print #1, "Detail"
> Print #1, "N"
> Print #1, "N"
> Print #1, "~PageSetup"
> Print #1, "1"
> Print #1, "256"
> Print #1, "10"
> Print #1, "50"
> Print #1, "50"
> Print #1, "2"
> Print #1, "Y"
> Print #1, "Y"
> Print #1, "Y"
> Print #1, ""
> Print #1, "~PageSetupExtended"
> Print #1, "1"
> Print #1, "Y"
> Print #1, "~End"
> Close #1
>
> '''PRJ
> Open p & "\CD1291.prj" For Output As #1
> Print #1, "MFWPRJ01"
> Print #1, "[RefreshDDR]"
> Print #1, "[InputFile]"
> Print #1, p & "\CD1291.RPT"
> Print #1, "[ModelFile]"
> Print #1, p & "\CD1291.mod"
> Print #1, "[ViewTable]"
> Print #1, "[SummaryNoChart]"
> Print #1, "[Author]"
> Print #1, "[Description]"
> Print #1, "[ASCII]"
> Print #1, "[End]"
> Close #1
>
> ''' BAT
> Open p & "\CD1291.bat" For Output As #1
> Print #1, "@.echo off"
> Print #1, "copy " & p & "\CD1291.TMP " & p & "\CD1291.RPT"
> Print #1, "del " & p & "\CD1291.TMP"
> Close #1
> '''Execute
> Do Until Dir(p & "\CD1291.TMP") <> "" Or Dir(p & "\CD1291.RPT") <> ""
> Shell ("C:\Program Files\Mobius\DDR\rdswin.exe " & p & "\CD1291.msl
/E")
> Pause (30)
> Loop
> Do Until Dir(p & "\CD1291.TMP") = ""
> DoEvents
> Loop
> Pause (5)
> If Dir("C:\CD1291.ASC") <> "" Then Kill ("C:\CD1291.ASC")
> Shell ("C:\Program Files\Mobius\DocuAnalyzer\program\analyzer.exe " & p &
"\CD1291.prj " & p & "\CD1291.ASC")
> Pause (5)
> L1 = 1
> Do Until L1 = L2
> Open p & "\CD1291.ASC" For Random As #1
> L1 = LOF(1)
> Close #1
> Pause (5)
> Open p & "\CD1291.ASC" For Random As #1
> L2 = LOF(1)
> Close #1
> Loop
> Pause (5)
>
> If Dir(p & "\CD1291.msl") <> "" Then Kill (p & "\CD1291.msl")
> If Dir(p & "\CD1291.bat") <> "" Then Kill (p & "\CD1291.bat")
> If Dir(p & "\CD1291.mod") <> "" Then Kill (p & "\CD1291.mod")
> If Dir(p & "\CD1291.prj") <> "" Then Kill (p & "\CD1291.prj")
> If Dir(p & "\CD1291.RPT") <> "" Then Kill (p & "\CD1291.RPT")
> If Dir(p & "\CD1291.TMP") <> "" Then Kill (p & "\CD1291.TMP")
>
> End Function
>
>

ActiveX Script Task - Help!

I have a script that is run in Excel or Access that automatically runs the c
ode I have cut/pasted below. I attempted to cut/paste into an activeX task,
but doesn't work. Would anyone be able to convert this to vbscript?
Thank you in advance for your help,
clutch
Attribute VB_Name = "CD-1291"
Option Compare Database
Option Explicit
Public Function CD1291()
On Error GoTo CD1291_Err
Dim Y As String, M1 As String, M2 As String, D1 As String, D2 As String, d A
s String, L1, L2, sd As Date
d = Application.CurrentProject.Path
If Dir(d & "\CD1291.msl") <> "" Then Kill (d & "\CD1291.msl")
If Dir(d & "\CD1291.bat") <> "" Then Kill (d & "\CD1291.bat")
If Dir(d & "\CD1291.mod") <> "" Then Kill (d & "\CD1291.mod")
If Dir(d & "\CD1291.prj") <> "" Then Kill (d & "\CD1291.prj")
If Dir(d & "\CD1291.RPT") <> "" Then Kill (d & "\CD1291.RPT")
If Dir(d & "\CD1291.TMP") <> "" Then Kill (d & "\CD1291.TMP")
Y = Year(Now() - 1)
M1 = Month(Now() - 1)
If M1 < 10 Then
M1 = "0" & M1
End If
M2 = Month(Now() - 1)
If M2 < 10 Then
M2 = "0" & M2
End If
D1 = Day(Now() - 1)
If D1 < 10 Then
D1 = "0" & D1
End If
D2 = Day(Now() - 1)
If D2 < 10 Then
D2 = "0" & D2
End If
'MsgBox Y & "-" & M1 & "-" & D1
p = Application.CurrentProject.Path
''' MSL
Open p & "\CD1291.msl" For Output As #1
Print #1, "OPENTOPIC SERVERID 'OARS' TOPICNAME '5625' TOPICVERSIONID '" & Y
& M1 & D1 & "001001' TOPICITEM 'CD-1291 1853 SYS E=" & M2 & D2 & "0" &
Right(Y, 1) + 1 & "' REPORTID 'CD-1291' EXACTTOPICITEM"
Print #1, "EXPORT ASCII FILE '" & p & "\CD1291.TMP' ALL GROUP ''"
Print #1, "CLOSE"
Print #1, "RUN '" & p & "\CD1291.bat'"
Print #1, "EXIT"
Close #1
''' MOD
Open p & "\CD1291.mod" For Output As #1
Print #1, "MFWMOD12"
Print #1, "~Description"
Print #1, "Premier Bankcard, Inc."
Print #1, ""
Print #1, "~Settings"
Print #1, "M/D/Y"
Print #1, "50"
Print #1, "."
Print #1, "0"
Print #1, "1"
Print #1, "1"
Print #1, ","
Print #1, "0"
Print #1, "N"
Print #1, "N"
Print #1, "N"
Print #1, "Y"
Print #1, "~ExtendedSettings"
Print #1, "42"
Print #1, "N"
Print #1, "(Null)"
Print #1, "1"
Print #1, "1"
Print #1, "128128255"
Print #1, "128,32,96"
Print #1, "255,0,255"
Print #1, "160,0,224"
Print #1, "64128128"
Print #1, "255,0,128"
Print #1, "128128128"
Print #1, "85,85,255"
Print #1, "128,0,128"
Print #1, "193,0,193"
Print #1, "255115115"
Print #1, "128,64,255"
Print #1, "0,128,0"
Print #1, "128,64,64"
Print #1, "255,0,0"
Print #1, "255191255"
Print #1, "255255255"
Print #1, "225225225"
Print #1, "151151151"
Print #1, "N"
Print #1, "N"
Print #1, "N"
Print #1, "12"
Print #1, "Verdana"
Print #1, "0,0,0"
Print #1, "N"
Print #1, "N"
Print #1, "N"
Print #1, "10"
Print #1, "Verdana"
Print #1, "0,0,0"
Print #1, "N"
Print #1, "N"
Print #1, "N"
Print #1, "8"
Print #1, "Verdana"
Print #1, "0,0,0"
Print #1, "N"
Print #1, "~TableField"
Print #1, "Acct #"
Print #1, "16"
Print #1, "0"
Print #1, "0"
Print #1, "1"
Print #1, "C"
Print #1, "0"
Print #1, "16"
Print #1, "3"
Print #1, "N"
Print #1, "N"
Print #1, "16"
Print #1, "5"
Print #1, "0"
Print #1, "0"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Acct #"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Pymt Date"
Print #1, "10"
Print #1, "0"
Print #1, "0"
Print #1, "1"
Print #1, "C"
Print #1, "0"
Print #1, "10"
Print #1, "4"
Print #1, "N"
Print #1, "N"
Print #1, "10"
Print #1, "5"
Print #1, "0"
Print #1, "18"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Pymt Date"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Payment"
Print #1, "18"
Print #1, "2"
Print #1, "0"
Print #1, "1"
Print #1, "N"
Print #1, "0"
Print #1, "19"
Print #1, "5"
Print #1, "N"
Print #1, "N"
Print #1, "19"
Print #1, "5"
Print #1, "0"
Print #1, "30"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Payment"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Float Amount"
Print #1, "18"
Print #1, "2"
Print #1, "0"
Print #1, "1"
Print #1, "N"
Print #1, "0"
Print #1, "16"
Print #1, "6"
Print #1, "N"
Print #1, "N"
Print #1, "16"
Print #1, "5"
Print #1, "0"
Print #1, "53"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Float Amount"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Strat ID"
Print #1, "4"
Print #1, "0"
Print #1, "0"
Print #1, "1"
Print #1, "C"
Print #1, "0"
Print #1, "4"
Print #1, "7"
Print #1, "N"
Print #1, "N"
Print #1, "4"
Print #1, "5"
Print #1, "0"
Print #1, "70"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Strat ID"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Line"
Print #1, "4"
Print #1, "0"
Print #1, "0"
Print #1, "1"
Print #1, "C"
Print #1, "0"
Print #1, "4"
Print #1, "8"
Print #1, "N"
Print #1, "N"
Print #1, "4"
Print #1, "5"
Print #1, "0"
Print #1, "80"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Line"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Actn ID"
Print #1, "4"
Print #1, "0"
Print #1, "0"
Print #1, "1"
Print #1, "C"
Print #1, "0"
Print #1, "4"
Print #1, "9"
Print #1, "N"
Print #1, "N"
Print #1, "4"
Print #1, "5"
Print #1, "0"
Print #1, "86"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Actn ID"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Ltr #"
Print #1, "4"
Print #1, "0"
Print #1, "0"
Print #1, "1"
Print #1, "C"
Print #1, "0"
Print #1, "4"
Print #1, "10"
Print #1, "N"
Print #1, "N"
Print #1, "4"
Print #1, "5"
Print #1, "0"
Print #1, "96"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Ltr #"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Ltr Data"
Print #1, "4"
Print #1, "0"
Print #1, "0"
Print #1, "1"
Print #1, "C"
Print #1, "0"
Print #1, "4"
Print #1, "11"
Print #1, "N"
Print #1, "N"
Print #1, "4"
Print #1, "5"
Print #1, "0"
Print #1, "108"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Ltr Data"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Float %"
Print #1, "18"
Print #1, "0"
Print #1, "0"
Print #1, "1"
Print #1, "N"
Print #1, "0"
Print #1, "5"
Print #1, "12"
Print #1, "N"
Print #1, "N"
Print #1, "5"
Print #1, "5"
Print #1, "0"
Print #1, "119"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Float %"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Q Prio"
Print #1, "2"
Print #1, "0"
Print #1, "0"
Print #1, "1"
Print #1, "C"
Print #1, "0"
Print #1, "2"
Print #1, "13"
Print #1, "N"
Print #1, "N"
Print #1, "2"
Print #1, "5"
Print #1, "2"
Print #1, "18"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Q Prio"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Float Cycle"
Print #1, "3"
Print #1, "0"
Print #1, "0"
Print #1, "1"
Print #1, "C"
Print #1, "0"
Print #1, "3"
Print #1, "14"
Print #1, "N"
Print #1, "N"
Print #1, "3"
Print #1, "5"
Print #1, "2"
Print #1, "30"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Float Cycle"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Rpt"
Print #1, "7"
Print #1, "0"
Print #1, "0"
Print #1, "1"
Print #1, "C"
Print #1, "0"
Print #1, "7"
Print #1, "1"
Print #1, "N"
Print #1, "N"
Print #1, "7"
Print #1, "0"
Print #1, "0"
Print #1, "0"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Rpt"
Print #1, "3"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~TableField"
Print #1, "Date"
Print #1, "8"
Print #1, "0"
Print #1, "0"
Print #1, "1"
Print #1, "D"
Print #1, "0"
Print #1, "12"
Print #1, "2"
Print #1, "N"
Print #1, "N"
Print #1, "14"
Print #1, "0"
Print #1, "0"
Print #1, "107"
Print #1, "N"
Print #1, "~TableFieldExtended"
Print #1, "Date"
Print #1, "3"
Print #1, "N"
Print #1, "1"
Print #1, "1"
Print #1, "~Level"
Print #1, "0"
Print #1, ""
Print #1, "1"
Print #1, "CD-1291 1108/ AVAILABLE FUNDS ACCOUNT DATA
FIRST PREMIER BANK -FD- 01/09/04 PAGE 1
"
Print #1, "2"
Print #1, "0"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~LevelExtended"
Print #1, "0"
Print #1, "2"
Print #1, "Page Header"
Print #1, "N"
Print #1, "N"
Print #1, "~Level"
Print #1, "5"
Print #1, "???????????"
Print #1, "3"
Print #1, "5149860001000015 2004/01/09 5.00 5
.00 0002 0009 0001 0000 0000 100
"
Print #1, " QUEUE PRIO FLOAT CYCL
"
Print #1, " 00 011
"
Print #1, "12"
Print #1, "0"
Print #1, "N"
Print #1, "0"
Print #1, "0"
Print #1, "~LevelExtended"
Print #1, "5"
Print #1, "2"
Print #1, "Detail"
Print #1, "N"
Print #1, "N"
Print #1, "~PageSetup"
Print #1, "1"
Print #1, "256"
Print #1, "10"
Print #1, "50"
Print #1, "50"
Print #1, "2"
Print #1, "Y"
Print #1, "Y"
Print #1, "Y"
Print #1, ""
Print #1, "~PageSetupExtended"
Print #1, "1"
Print #1, "Y"
Print #1, "~End"
Close #1
'''PRJ
Open p & "\CD1291.prj" For Output As #1
Print #1, "MFWPRJ01"
Print #1, "[RefreshDDR]"
Print #1, "[InputFile]"
Print #1, p & "\CD1291.RPT"
Print #1, "[ModelFile]"
Print #1, p & "\CD1291.mod"
Print #1, "[ViewTable]"
Print #1, "[SummaryNoChart]"
Print #1, "[Author]"
Print #1, "[Description]"
Print #1, "[ASCII]"
Print #1, "[End]"
Close #1
''' BAT
Open p & "\CD1291.bat" For Output As #1
Print #1, "@.echo off"
Print #1, "copy " & p & "\CD1291.TMP " & p & "\CD1291.RPT"
Print #1, "del " & p & "\CD1291.TMP"
Close #1
'''Execute
Do Until Dir(p & "\CD1291.TMP") <> "" Or Dir(p & "\CD1291.RPT") <> ""
Shell ("C:\Program Files\Mobius\DDR\rdswin.exe " & p & "\CD1291.msl /E")
Pause (30)
Loop
Do Until Dir(p & "\CD1291.TMP") = ""
DoEvents
Loop
Pause (5)
If Dir("C:\CD1291.ASC") <> "" Then Kill ("C:\CD1291.ASC")
Shell ("C:\Program Files\Mobius\DocuAnalyzer\program\analyz
er.exe " & p & "\
CD1291.prj " & p & "\CD1291.ASC")
Pause (5)
L1 = 1
Do Until L1 = L2
Open p & "\CD1291.ASC" For Random As #1
L1 = LOF(1)
Close #1
Pause (5)
Open p & "\CD1291.ASC" For Random As #1
L2 = LOF(1)
Close #1
Loop
Pause (5)
If Dir(p & "\CD1291.msl") <> "" Then Kill (p & "\CD1291.msl")
If Dir(p & "\CD1291.bat") <> "" Then Kill (p & "\CD1291.bat")
If Dir(p & "\CD1291.mod") <> "" Then Kill (p & "\CD1291.mod")
If Dir(p & "\CD1291.prj") <> "" Then Kill (p & "\CD1291.prj")
If Dir(p & "\CD1291.RPT") <> "" Then Kill (p & "\CD1291.RPT")
If Dir(p & "\CD1291.TMP") <> "" Then Kill (p & "\CD1291.TMP")
End FunctionYou are going to have some very hard work cut out for you here. There is no
application class in VBScripting. There is no DIR() function. There is no
Kill function. You may want to transfer code to VB.net and then have DTS run
an application.
Andrew C. Madsen
Information Architect
Harley-Davidson Motor Company
"clutch" <clutch@.discussions.microsoft.com> wrote in message
news:974122A0-6D23-4C82-BA82-2FCBAF8D2716@.microsoft.com...
> I have a script that is run in Excel or Access that automatically runs the
code I have cut/pasted below. I attempted to cut/paste into an activeX task,
but doesn't work. Would anyone be able to convert this to vbscript?
> Thank you in advance for your help,
> clutch
> Attribute VB_Name = "CD-1291"
> Option Compare Database
> Option Explicit
> Public Function CD1291()
> On Error GoTo CD1291_Err
> Dim Y As String, M1 As String, M2 As String, D1 As String, D2 As String, d
As String, L1, L2, sd As Date
>
> d = Application.CurrentProject.Path
> If Dir(d & "\CD1291.msl") <> "" Then Kill (d & "\CD1291.msl")
> If Dir(d & "\CD1291.bat") <> "" Then Kill (d & "\CD1291.bat")
> If Dir(d & "\CD1291.mod") <> "" Then Kill (d & "\CD1291.mod")
> If Dir(d & "\CD1291.prj") <> "" Then Kill (d & "\CD1291.prj")
> If Dir(d & "\CD1291.RPT") <> "" Then Kill (d & "\CD1291.RPT")
> If Dir(d & "\CD1291.TMP") <> "" Then Kill (d & "\CD1291.TMP")
> Y = Year(Now() - 1)
> M1 = Month(Now() - 1)
> If M1 < 10 Then
> M1 = "0" & M1
> End If
> M2 = Month(Now() - 1)
> If M2 < 10 Then
> M2 = "0" & M2
> End If
> D1 = Day(Now() - 1)
> If D1 < 10 Then
> D1 = "0" & D1
> End If
> D2 = Day(Now() - 1)
> If D2 < 10 Then
> D2 = "0" & D2
> End If
> 'MsgBox Y & "-" & M1 & "-" & D1
> p = Application.CurrentProject.Path
> ''' MSL
> Open p & "\CD1291.msl" For Output As #1
> Print #1, "OPENTOPIC SERVERID 'OARS' TOPICNAME '5625' TOPICVERSIONID
'" & Y & M1 & D1 & "001001' TOPICITEM 'CD-1291 1853 SYS E=" & M2 & D2 &
"0" & Right(Y, 1) + 1 & "' REPORTID 'CD-1291' EXACTTOPICITEM"
> Print #1, "EXPORT ASCII FILE '" & p & "\CD1291.TMP' ALL GROUP ''"
> Print #1, "CLOSE"
> Print #1, "RUN '" & p & "\CD1291.bat'"
> Print #1, "EXIT"
> Close #1
> ''' MOD
> Open p & "\CD1291.mod" For Output As #1
> Print #1, "MFWMOD12"
> Print #1, "~Description"
> Print #1, "Premier Bankcard, Inc."
> Print #1, ""
> Print #1, "~Settings"
> Print #1, "M/D/Y"
> Print #1, "50"
> Print #1, "."
> Print #1, "0"
> Print #1, "1"
> Print #1, "1"
> Print #1, ","
> Print #1, "0"
> Print #1, "N"
> Print #1, "N"
> Print #1, "N"
> Print #1, "Y"
> Print #1, "~ExtendedSettings"
> Print #1, "42"
> Print #1, "N"
> Print #1, "(Null)"
> Print #1, "1"
> Print #1, "1"
> Print #1, "128128255"
> Print #1, "128,32,96"
> Print #1, "255,0,255"
> Print #1, "160,0,224"
> Print #1, "64128128"
> Print #1, "255,0,128"
> Print #1, "128128128"
> Print #1, "85,85,255"
> Print #1, "128,0,128"
> Print #1, "193,0,193"
> Print #1, "255115115"
> Print #1, "128,64,255"
> Print #1, "0,128,0"
> Print #1, "128,64,64"
> Print #1, "255,0,0"
> Print #1, "255191255"
> Print #1, "255255255"
> Print #1, "225225225"
> Print #1, "151151151"
> Print #1, "N"
> Print #1, "N"
> Print #1, "N"
> Print #1, "12"
> Print #1, "Verdana"
> Print #1, "0,0,0"
> Print #1, "N"
> Print #1, "N"
> Print #1, "N"
> Print #1, "10"
> Print #1, "Verdana"
> Print #1, "0,0,0"
> Print #1, "N"
> Print #1, "N"
> Print #1, "N"
> Print #1, "8"
> Print #1, "Verdana"
> Print #1, "0,0,0"
> Print #1, "N"
> Print #1, "~TableField"
> Print #1, "Acct #"
> Print #1, "16"
> Print #1, "0"
> Print #1, "0"
> Print #1, "1"
> Print #1, "C"
> Print #1, "0"
> Print #1, "16"
> Print #1, "3"
> Print #1, "N"
> Print #1, "N"
> Print #1, "16"
> Print #1, "5"
> Print #1, "0"
> Print #1, "0"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Acct #"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Pymt Date"
> Print #1, "10"
> Print #1, "0"
> Print #1, "0"
> Print #1, "1"
> Print #1, "C"
> Print #1, "0"
> Print #1, "10"
> Print #1, "4"
> Print #1, "N"
> Print #1, "N"
> Print #1, "10"
> Print #1, "5"
> Print #1, "0"
> Print #1, "18"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Pymt Date"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Payment"
> Print #1, "18"
> Print #1, "2"
> Print #1, "0"
> Print #1, "1"
> Print #1, "N"
> Print #1, "0"
> Print #1, "19"
> Print #1, "5"
> Print #1, "N"
> Print #1, "N"
> Print #1, "19"
> Print #1, "5"
> Print #1, "0"
> Print #1, "30"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Payment"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Float Amount"
> Print #1, "18"
> Print #1, "2"
> Print #1, "0"
> Print #1, "1"
> Print #1, "N"
> Print #1, "0"
> Print #1, "16"
> Print #1, "6"
> Print #1, "N"
> Print #1, "N"
> Print #1, "16"
> Print #1, "5"
> Print #1, "0"
> Print #1, "53"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Float Amount"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Strat ID"
> Print #1, "4"
> Print #1, "0"
> Print #1, "0"
> Print #1, "1"
> Print #1, "C"
> Print #1, "0"
> Print #1, "4"
> Print #1, "7"
> Print #1, "N"
> Print #1, "N"
> Print #1, "4"
> Print #1, "5"
> Print #1, "0"
> Print #1, "70"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Strat ID"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Line"
> Print #1, "4"
> Print #1, "0"
> Print #1, "0"
> Print #1, "1"
> Print #1, "C"
> Print #1, "0"
> Print #1, "4"
> Print #1, "8"
> Print #1, "N"
> Print #1, "N"
> Print #1, "4"
> Print #1, "5"
> Print #1, "0"
> Print #1, "80"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Line"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Actn ID"
> Print #1, "4"
> Print #1, "0"
> Print #1, "0"
> Print #1, "1"
> Print #1, "C"
> Print #1, "0"
> Print #1, "4"
> Print #1, "9"
> Print #1, "N"
> Print #1, "N"
> Print #1, "4"
> Print #1, "5"
> Print #1, "0"
> Print #1, "86"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Actn ID"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Ltr #"
> Print #1, "4"
> Print #1, "0"
> Print #1, "0"
> Print #1, "1"
> Print #1, "C"
> Print #1, "0"
> Print #1, "4"
> Print #1, "10"
> Print #1, "N"
> Print #1, "N"
> Print #1, "4"
> Print #1, "5"
> Print #1, "0"
> Print #1, "96"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Ltr #"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Ltr Data"
> Print #1, "4"
> Print #1, "0"
> Print #1, "0"
> Print #1, "1"
> Print #1, "C"
> Print #1, "0"
> Print #1, "4"
> Print #1, "11"
> Print #1, "N"
> Print #1, "N"
> Print #1, "4"
> Print #1, "5"
> Print #1, "0"
> Print #1, "108"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Ltr Data"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Float %"
> Print #1, "18"
> Print #1, "0"
> Print #1, "0"
> Print #1, "1"
> Print #1, "N"
> Print #1, "0"
> Print #1, "5"
> Print #1, "12"
> Print #1, "N"
> Print #1, "N"
> Print #1, "5"
> Print #1, "5"
> Print #1, "0"
> Print #1, "119"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Float %"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Q Prio"
> Print #1, "2"
> Print #1, "0"
> Print #1, "0"
> Print #1, "1"
> Print #1, "C"
> Print #1, "0"
> Print #1, "2"
> Print #1, "13"
> Print #1, "N"
> Print #1, "N"
> Print #1, "2"
> Print #1, "5"
> Print #1, "2"
> Print #1, "18"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Q Prio"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Float Cycle"
> Print #1, "3"
> Print #1, "0"
> Print #1, "0"
> Print #1, "1"
> Print #1, "C"
> Print #1, "0"
> Print #1, "3"
> Print #1, "14"
> Print #1, "N"
> Print #1, "N"
> Print #1, "3"
> Print #1, "5"
> Print #1, "2"
> Print #1, "30"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Float Cycle"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Rpt"
> Print #1, "7"
> Print #1, "0"
> Print #1, "0"
> Print #1, "1"
> Print #1, "C"
> Print #1, "0"
> Print #1, "7"
> Print #1, "1"
> Print #1, "N"
> Print #1, "N"
> Print #1, "7"
> Print #1, "0"
> Print #1, "0"
> Print #1, "0"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Rpt"
> Print #1, "3"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~TableField"
> Print #1, "Date"
> Print #1, "8"
> Print #1, "0"
> Print #1, "0"
> Print #1, "1"
> Print #1, "D"
> Print #1, "0"
> Print #1, "12"
> Print #1, "2"
> Print #1, "N"
> Print #1, "N"
> Print #1, "14"
> Print #1, "0"
> Print #1, "0"
> Print #1, "107"
> Print #1, "N"
> Print #1, "~TableFieldExtended"
> Print #1, "Date"
> Print #1, "3"
> Print #1, "N"
> Print #1, "1"
> Print #1, "1"
> Print #1, "~Level"
> Print #1, "0"
> Print #1, ""
> Print #1, "1"
> Print #1, "CD-1291 1108/ AVAILABLE FUNDS ACCOUNT DATA
FIRST PREMIER BANK -FD- 01/09/04 PAGE 1
"
> Print #1, "2"
> Print #1, "0"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~LevelExtended"
> Print #1, "0"
> Print #1, "2"
> Print #1, "Page Header"
> Print #1, "N"
> Print #1, "N"
> Print #1, "~Level"
> Print #1, "5"
> Print #1, ""
> Print #1, "3"
> Print #1, "5149860001000015 2004/01/09 5.00
5.00 0002 0009 0001 0000 0000 100
"
> Print #1, " QUEUE PRIO FLOAT CYCL
"
> Print #1, " 00 011
"
> Print #1, "12"
> Print #1, "0"
> Print #1, "N"
> Print #1, "0"
> Print #1, "0"
> Print #1, "~LevelExtended"
> Print #1, "5"
> Print #1, "2"
> Print #1, "Detail"
> Print #1, "N"
> Print #1, "N"
> Print #1, "~PageSetup"
> Print #1, "1"
> Print #1, "256"
> Print #1, "10"
> Print #1, "50"
> Print #1, "50"
> Print #1, "2"
> Print #1, "Y"
> Print #1, "Y"
> Print #1, "Y"
> Print #1, ""
> Print #1, "~PageSetupExtended"
> Print #1, "1"
> Print #1, "Y"
> Print #1, "~End"
> Close #1
>
> '''PRJ
> Open p & "\CD1291.prj" For Output As #1
> Print #1, "MFWPRJ01"
> Print #1, "[RefreshDDR]"
> Print #1, "[InputFile]"
> Print #1, p & "\CD1291.RPT"
> Print #1, "[ModelFile]"
> Print #1, p & "\CD1291.mod"
> Print #1, "[ViewTable]"
> Print #1, "[SummaryNoChart]"
> Print #1, "[Author]"
> Print #1, "[Description]"
> Print #1, "[ASCII]"
> Print #1, "[End]"
> Close #1
>
> ''' BAT
> Open p & "\CD1291.bat" For Output As #1
> Print #1, "@.echo off"
> Print #1, "copy " & p & "\CD1291.TMP " & p & "\CD1291.RPT"
> Print #1, "del " & p & "\CD1291.TMP"
> Close #1
> '''Execute
> Do Until Dir(p & "\CD1291.TMP") <> "" Or Dir(p & "\CD1291.RPT") <> ""
> Shell ("C:\Program Files\Mobius\DDR\rdswin.exe " & p & "\CD1291.msl
/E")
> Pause (30)
> Loop
> Do Until Dir(p & "\CD1291.TMP") = ""
> DoEvents
> Loop
> Pause (5)
> If Dir("C:\CD1291.ASC") <> "" Then Kill ("C:\CD1291.ASC")
> Shell ("C:\Program Files\Mobius\DocuAnalyzer\program\analyz
er.exe " & p &
"\CD1291.prj " & p & "\CD1291.ASC")
> Pause (5)
> L1 = 1
> Do Until L1 = L2
> Open p & "\CD1291.ASC" For Random As #1
> L1 = LOF(1)
> Close #1
> Pause (5)
> Open p & "\CD1291.ASC" For Random As #1
> L2 = LOF(1)
> Close #1
> Loop
> Pause (5)
>
> If Dir(p & "\CD1291.msl") <> "" Then Kill (p & "\CD1291.msl")
> If Dir(p & "\CD1291.bat") <> "" Then Kill (p & "\CD1291.bat")
> If Dir(p & "\CD1291.mod") <> "" Then Kill (p & "\CD1291.mod")
> If Dir(p & "\CD1291.prj") <> "" Then Kill (p & "\CD1291.prj")
> If Dir(p & "\CD1291.RPT") <> "" Then Kill (p & "\CD1291.RPT")
> If Dir(p & "\CD1291.TMP") <> "" Then Kill (p & "\CD1291.TMP")
>
> End Function
>
>

ActiveX Script Running DTS Causes Error

Hello All,

I have an ActiveX script that runs DTS pachkages. In the event that a package fails I want to display the error message. I found the following code (in bold) for doing this but I keep getting an error message as follows.

Type mismatch 'oSoStep.GetExecutionErrorInfo'

All help appreciated.

Thanks, Gary

Could you post your code?
Jason
|||For Each oStep In oPkg.Steps
If oStep.ExecutionStatus = DTSStepExecStat_Completed Then
If oStep.ExecutionResult = DTSStepExecResult_Failure Then
oStep.GetExecutionErrorInfo lErrNum, sSource, sDescr
msgbox(sDescr)
End If
End If
Next

activex script programming - DTS

Hi guys,
Do you have any good documents or tutorial websites on advance DTS
programming? Especially, I want to learn to write activex script inside
DTS package.
Thanks
JayFolks at DTS newsgroup would also be able to address this request.
http://www.microsoft.com/technet/co...c.sqlserver.dts
Thanks
http://zulfiqar.typepad.com
BSEE, MCP
"Britney" wrote:

> Hi guys,
> Do you have any good documents or tutorial websites on advance DTS
> programming? Especially, I want to learn to write activex script inside
> DTS package.
>
> Thanks
> Jay
>
>

activex script jobs

Can anyone tell me why I get this error when trying to run a job on sql 2005
that is an activex script?
Error creating security descriptor for shared objects (reason: No mapping
between account names and security IDs was done). The
step failed.
I even tried credentials, proxy accounts etc. I might need to have a good
instruction sheet to explain how to properly set this up.
Please give more information about the owner of the job, agent service
account details and also the configuration (like OS/SP/Language/cluster?)
In SQL2005, Activex Script subsystem is executed in separate process context
and not anymore in SQLAgent process context.
This issue you are refering was known one in non-English locale and cluster
config in our Beta releases, but has been addressed in our RTM.
I am assuming you are using RTM version of SQL2005, please confirm. If you
are using pre-RTM version, upgrade to RTM and you should see this addressed
Thanks,
Gops Dwarak
"ECS" <ecs@.netset.com> wrote in message
news:OogfHMT$FHA.1256@.TK2MSFTNGP15.phx.gbl...
> Can anyone tell me why I get this error when trying to run a job on sql
2005
> that is an activex script?
> Error creating security descriptor for shared objects (reason: No mapping
> between account names and security IDs was done). The
> step failed.
>
> I even tried credentials, proxy accounts etc. I might need to have a good
> instruction sheet to explain how to properly set this up.
>
sql

activex script jobs

Can anyone tell me why I get this error when trying to run a job on sql 2005
that is an activex script?
Error creating security descriptor for shared objects (reason: No mapping
between account names and security IDs was done). The
step failed.
I even tried credentials, proxy accounts etc. I might need to have a good
instruction sheet to explain how to properly set this up.Please give more information about the owner of the job, agent service
account details and also the configuration (like OS/SP/Language/cluster?)
In SQL2005, Activex Script subsystem is executed in separate process context
and not anymore in SQLAgent process context.
This issue you are refering was known one in non-English locale and cluster
config in our Beta releases, but has been addressed in our RTM.
I am assuming you are using RTM version of SQL2005, please confirm. If you
are using pre-RTM version, upgrade to RTM and you should see this addressed
Thanks,
Gops Dwarak
"ECS" <ecs@.netset.com> wrote in message
news:OogfHMT$FHA.1256@.TK2MSFTNGP15.phx.gbl...
> Can anyone tell me why I get this error when trying to run a job on sql
2005
> that is an activex script?
> Error creating security descriptor for shared objects (reason: No mapping
> between account names and security IDs was done). The
> step failed.
>
> I even tried credentials, proxy accounts etc. I might need to have a good
> instruction sheet to explain how to properly set this up.
>

activex script jobs

Can anyone tell me why I get this error when trying to run a job on sql 2005
that is an activex script?
Error creating security descriptor for shared objects (reason: No mapping
between account names and security IDs was done). The
step failed.
I even tried credentials, proxy accounts etc. I might need to have a good
instruction sheet to explain how to properly set this up.Please give more information about the owner of the job, agent service
account details and also the configuration (like OS/SP/Language/cluster?)
In SQL2005, Activex Script subsystem is executed in separate process context
and not anymore in SQLAgent process context.
This issue you are refering was known one in non-English locale and cluster
config in our Beta releases, but has been addressed in our RTM.
I am assuming you are using RTM version of SQL2005, please confirm. If you
are using pre-RTM version, upgrade to RTM and you should see this addressed
Thanks,
Gops Dwarak
"ECS" <ecs@.netset.com> wrote in message
news:OogfHMT$FHA.1256@.TK2MSFTNGP15.phx.gbl...
> Can anyone tell me why I get this error when trying to run a job on sql
2005
> that is an activex script?
> Error creating security descriptor for shared objects (reason: No mapping
> between account names and security IDs was done). The
> step failed.
>
> I even tried credentials, proxy accounts etc. I might need to have a good
> instruction sheet to explain how to properly set this up.
>

ActiveX Script in DTS

I have a large csv import into a SQL Server data base and I am trying to
transform a field to DATETIME before it gets to the database. The data in
the field is '20030100' or something similar the first four characters are
year the next two are month an the last are place holders as the mainframe
application does not transfer its DATETIME fields nicely. there for I want
to do something like this
Function Main()
DTSDestination("TRANCD") = Left( DTSSource("TRANCD") , 6 ) + '28'
Main = DTSTransformStat_OK
End Function
but it fails. I have also tried setting the value to Left(
DTSSource("TRANCD") , 6 ) & '28' and to concat( Left( DTSSource("TRANCD") ,
6 ) , '28').
Each one files but if I just set it to the Left( DTSSource("TRANCD") , 6 )
it is ok. It appears that I am trying to get 28 into the field wrong. Any
help out there?
--
Andrew C. Madsen
Information Architect
Harley-Davidson Motor CompanyNever mind. I found it. I used single quotes instead of double quotes around
the 28.
--
Andrew C. Madsen
Information Architect
Harley-Davidson Motor Company
"Andrew Madsen" <andrew.madsen@.harley-davidson.com> wrote in message
news:OjQ7iARPEHA.1276@.TK2MSFTNGP11.phx.gbl...
> I have a large csv import into a SQL Server data base and I am trying to
> transform a field to DATETIME before it gets to the database. The data in
> the field is '20030100' or something similar the first four characters are
> year the next two are month an the last are place holders as the mainframe
> application does not transfer its DATETIME fields nicely. there for I want
> to do something like this
> Function Main()
> DTSDestination("TRANCD") = Left( DTSSource("TRANCD") , 6 ) + '28'
> Main = DTSTransformStat_OK
> End Function
> but it fails. I have also tried setting the value to Left(
> DTSSource("TRANCD") , 6 ) & '28' and to concat( Left( DTSSource("TRANCD")
,
> 6 ) , '28').
> Each one files but if I just set it to the Left( DTSSource("TRANCD") , 6 )
> it is ok. It appears that I am trying to get 28 into the field wrong. Any
> help out there?
> --
> Andrew C. Madsen
> Information Architect
> Harley-Davidson Motor Company
>|||Ok mind again. This function fails because for some reason it does not like
converting the string value "20030128" into a DATETIME. Up to now I have
been loading the csv file into the database then running a stored procedure
that runs an update on the column that has the bogus datetime then I have
been loading that across to another table that has the date time field and
that works I believe because the TRANSDT field in the first is varchar. I
realize that I could convert the column in the first table but I would like
to do it in the initial load. Any suggestions?
--
Andrew C. Madsen
Information Architect
Harley-Davidson Motor Company
"Andrew Madsen" <andrew.madsen@.harley-davidson.com> wrote in message
news:ekFkHFRPEHA.680@.TK2MSFTNGP11.phx.gbl...
> Never mind. I found it. I used single quotes instead of double quotes
around
> the 28.
> --
> Andrew C. Madsen
> Information Architect
> Harley-Davidson Motor Company
> "Andrew Madsen" <andrew.madsen@.harley-davidson.com> wrote in message
> news:OjQ7iARPEHA.1276@.TK2MSFTNGP11.phx.gbl...
> > I have a large csv import into a SQL Server data base and I am trying to
> > transform a field to DATETIME before it gets to the database. The data
in
> > the field is '20030100' or something similar the first four characters
are
> > year the next two are month an the last are place holders as the
mainframe
> > application does not transfer its DATETIME fields nicely. there for I
want
> > to do something like this
> >
> > Function Main()
> > DTSDestination("TRANCD") = Left( DTSSource("TRANCD") , 6 ) + '28'
> > Main = DTSTransformStat_OK
> > End Function
> >
> > but it fails. I have also tried setting the value to Left(
> > DTSSource("TRANCD") , 6 ) & '28' and to concat( Left(
DTSSource("TRANCD")
> ,
> > 6 ) , '28').
> >
> > Each one files but if I just set it to the Left( DTSSource("TRANCD") ,
6 )
> > it is ok. It appears that I am trying to get 28 into the field wrong.
Any
> > help out there?
> >
> > --
> > Andrew C. Madsen
> > Information Architect
> > Harley-Davidson Motor Company
> >
> >
>|||If anyone is interested. The solution I came up with is this:
Function Main()
Dim DateStrY
Dim DateStrM
Dim DateStrD
Dim DateStr
Dim HOLD
DateStrY = LEFT(DTSSource("TRANDT"),4)
DateStrM = Mid( DTSSource("TRANDT") , 5 ,2 )
DateStrD = "28"
DateStr = DateStrM + "/" + DateStrD + "/" + DateStrY
DTSDestination("TRANDT") =DateStr
Main = DTSTransformStat_OK
End Function
I needed to reformat the string as a date because the transform will not
recognize 20030128 as a date but does recognize 01/28/2003.
--
Andrew C. Madsen
Information Architect
Harley-Davidson Motor Company
"Andrew Madsen" <andrew.madsen@.harley-davidson.com> wrote in message
news:OjQ7iARPEHA.1276@.TK2MSFTNGP11.phx.gbl...
> I have a large csv import into a SQL Server data base and I am trying to
> transform a field to DATETIME before it gets to the database. The data in
> the field is '20030100' or something similar the first four characters are
> year the next two are month an the last are place holders as the mainframe
> application does not transfer its DATETIME fields nicely. there for I want
> to do something like this
> Function Main()
> DTSDestination("TRANCD") = Left( DTSSource("TRANCD") , 6 ) + '28'
> Main = DTSTransformStat_OK
> End Function
> but it fails. I have also tried setting the value to Left(
> DTSSource("TRANCD") , 6 ) & '28' and to concat( Left( DTSSource("TRANCD")
,
> 6 ) , '28').
> Each one files but if I just set it to the Left( DTSSource("TRANCD") , 6 )
> it is ok. It appears that I am trying to get 28 into the field wrong. Any
> help out there?
> --
> Andrew C. Madsen
> Information Architect
> Harley-Davidson Motor Company
>

ActiveX Script in DTS

I have a large csv import into a SQL Server data base and I am trying to
transform a field to DATETIME before it gets to the database. The data in
the field is '20030100' or something similar the first four characters are
year the next two are month an the last are place holders as the mainframe
application does not transfer its DATETIME fields nicely. there for I want
to do something like this
Function Main()
DTSDestination("TRANCD") = Left( DTSSource("TRANCD") , 6 ) + '28'
Main = DTSTransformStat_OK
End Function
but it fails. I have also tried setting the value to Left(
DTSSource("TRANCD") , 6 ) & '28' and to concat( Left( DTSSource("TRANCD") ,
6 ) , '28').
Each one files but if I just set it to the Left( DTSSource("TRANCD") , 6 )
it is ok. It appears that I am trying to get 28 into the field wrong. Any
help out there?
Andrew C. Madsen
Information Architect
Harley-Davidson Motor Company
Never mind. I found it. I used single quotes instead of double quotes around
the 28.
Andrew C. Madsen
Information Architect
Harley-Davidson Motor Company
"Andrew Madsen" <andrew.madsen@.harley-davidson.com> wrote in message
news:OjQ7iARPEHA.1276@.TK2MSFTNGP11.phx.gbl...
> I have a large csv import into a SQL Server data base and I am trying to
> transform a field to DATETIME before it gets to the database. The data in
> the field is '20030100' or something similar the first four characters are
> year the next two are month an the last are place holders as the mainframe
> application does not transfer its DATETIME fields nicely. there for I want
> to do something like this
> Function Main()
> DTSDestination("TRANCD") = Left( DTSSource("TRANCD") , 6 ) + '28'
> Main = DTSTransformStat_OK
> End Function
> but it fails. I have also tried setting the value to Left(
> DTSSource("TRANCD") , 6 ) & '28' and to concat( Left( DTSSource("TRANCD")
,
> 6 ) , '28').
> Each one files but if I just set it to the Left( DTSSource("TRANCD") , 6 )
> it is ok. It appears that I am trying to get 28 into the field wrong. Any
> help out there?
> --
> Andrew C. Madsen
> Information Architect
> Harley-Davidson Motor Company
>
|||Ok mind again. This function fails because for some reason it does not like
converting the string value "20030128" into a DATETIME. Up to now I have
been loading the csv file into the database then running a stored procedure
that runs an update on the column that has the bogus datetime then I have
been loading that across to another table that has the date time field and
that works I believe because the TRANSDT field in the first is varchar. I
realize that I could convert the column in the first table but I would like
to do it in the initial load. Any suggestions?
Andrew C. Madsen
Information Architect
Harley-Davidson Motor Company
"Andrew Madsen" <andrew.madsen@.harley-davidson.com> wrote in message
news:ekFkHFRPEHA.680@.TK2MSFTNGP11.phx.gbl...
> Never mind. I found it. I used single quotes instead of double quotes
around[vbcol=seagreen]
> the 28.
> --
> Andrew C. Madsen
> Information Architect
> Harley-Davidson Motor Company
> "Andrew Madsen" <andrew.madsen@.harley-davidson.com> wrote in message
> news:OjQ7iARPEHA.1276@.TK2MSFTNGP11.phx.gbl...
in[vbcol=seagreen]
are[vbcol=seagreen]
mainframe[vbcol=seagreen]
want[vbcol=seagreen]
DTSSource("TRANCD")[vbcol=seagreen]
> ,
6 )[vbcol=seagreen]
Any
>
|||If anyone is interested. The solution I came up with is this:
Function Main()
Dim DateStrY
Dim DateStrM
Dim DateStrD
Dim DateStr
Dim HOLD
DateStrY = LEFT(DTSSource("TRANDT"),4)
DateStrM = Mid( DTSSource("TRANDT") , 5 ,2 )
DateStrD = "28"
DateStr = DateStrM + "/" + DateStrD + "/" + DateStrY
DTSDestination("TRANDT") =DateStr
Main = DTSTransformStat_OK
End Function
I needed to reformat the string as a date because the transform will not
recognize 20030128 as a date but does recognize 01/28/2003.
Andrew C. Madsen
Information Architect
Harley-Davidson Motor Company
"Andrew Madsen" <andrew.madsen@.harley-davidson.com> wrote in message
news:OjQ7iARPEHA.1276@.TK2MSFTNGP11.phx.gbl...
> I have a large csv import into a SQL Server data base and I am trying to
> transform a field to DATETIME before it gets to the database. The data in
> the field is '20030100' or something similar the first four characters are
> year the next two are month an the last are place holders as the mainframe
> application does not transfer its DATETIME fields nicely. there for I want
> to do something like this
> Function Main()
> DTSDestination("TRANCD") = Left( DTSSource("TRANCD") , 6 ) + '28'
> Main = DTSTransformStat_OK
> End Function
> but it fails. I have also tried setting the value to Left(
> DTSSource("TRANCD") , 6 ) & '28' and to concat( Left( DTSSource("TRANCD")
,
> 6 ) , '28').
> Each one files but if I just set it to the Left( DTSSource("TRANCD") , 6 )
> it is ok. It appears that I am trying to get 28 into the field wrong. Any
> help out there?
> --
> Andrew C. Madsen
> Information Architect
> Harley-Davidson Motor Company
>

ActiveX Script in DTS

I have a large csv import into a SQL Server data base and I am trying to
transform a field to DATETIME before it gets to the database. The data in
the field is '20030100' or something similar the first four characters are
year the next two are month an the last are place holders as the mainframe
application does not transfer its DATETIME fields nicely. there for I want
to do something like this
Function Main()
DTSDestination("TRANCD") = Left( DTSSource("TRANCD") , 6 ) + '28'
Main = DTSTransformStat_OK
End Function
but it fails. I have also tried setting the value to Left(
DTSSource("TRANCD") , 6 ) & '28' and to concat( Left( DTSSource("TRANCD") ,
6 ) , '28').
Each one files but if I just set it to the Left( DTSSource("TRANCD") , 6 )
it is ok. It appears that I am trying to get 28 into the field wrong. Any
help out there?
Andrew C. Madsen
Information Architect
Harley-Davidson Motor CompanyNever mind. I found it. I used single quotes instead of double quotes around
the 28.
Andrew C. Madsen
Information Architect
Harley-Davidson Motor Company
"Andrew Madsen" <andrew.madsen@.harley-davidson.com> wrote in message
news:OjQ7iARPEHA.1276@.TK2MSFTNGP11.phx.gbl...
> I have a large csv import into a SQL Server data base and I am trying to
> transform a field to DATETIME before it gets to the database. The data in
> the field is '20030100' or something similar the first four characters are
> year the next two are month an the last are place holders as the mainframe
> application does not transfer its DATETIME fields nicely. there for I want
> to do something like this
> Function Main()
> DTSDestination("TRANCD") = Left( DTSSource("TRANCD") , 6 ) + '28'
> Main = DTSTransformStat_OK
> End Function
> but it fails. I have also tried setting the value to Left(
> DTSSource("TRANCD") , 6 ) & '28' and to concat( Left( DTSSource("TRANCD")
,
> 6 ) , '28').
> Each one files but if I just set it to the Left( DTSSource("TRANCD") , 6 )
> it is ok. It appears that I am trying to get 28 into the field wrong. Any
> help out there?
> --
> Andrew C. Madsen
> Information Architect
> Harley-Davidson Motor Company
>|||Ok mind again. This function fails because for some reason it does not like
converting the string value "20030128" into a DATETIME. Up to now I have
been loading the csv file into the database then running a stored procedure
that runs an update on the column that has the bogus datetime then I have
been loading that across to another table that has the date time field and
that works I believe because the TRANSDT field in the first is varchar. I
realize that I could convert the column in the first table but I would like
to do it in the initial load. Any suggestions?
Andrew C. Madsen
Information Architect
Harley-Davidson Motor Company
"Andrew Madsen" <andrew.madsen@.harley-davidson.com> wrote in message
news:ekFkHFRPEHA.680@.TK2MSFTNGP11.phx.gbl...
> Never mind. I found it. I used single quotes instead of double quotes
around
> the 28.
> --
> Andrew C. Madsen
> Information Architect
> Harley-Davidson Motor Company
> "Andrew Madsen" <andrew.madsen@.harley-davidson.com> wrote in message
> news:OjQ7iARPEHA.1276@.TK2MSFTNGP11.phx.gbl...
in[vbcol=seagreen]
are[vbcol=seagreen]
mainframe[vbcol=seagreen]
want[vbcol=seagreen]
DTSSource("TRANCD")[vbcol=seagreen]
> ,
6 )[vbcol=seagreen]
Any[vbcol=seagreen]
>|||If anyone is interested. The solution I came up with is this:
Function Main()
Dim DateStrY
Dim DateStrM
Dim DateStrD
Dim DateStr
Dim HOLD
DateStrY = LEFT(DTSSource("TRANDT"),4)
DateStrM = Mid( DTSSource("TRANDT") , 5 ,2 )
DateStrD = "28"
DateStr = DateStrM + "/" + DateStrD + "/" + DateStrY
DTSDestination("TRANDT") =DateStr
Main = DTSTransformStat_OK
End Function
I needed to reformat the string as a date because the transform will not
recognize 20030128 as a date but does recognize 01/28/2003.
--
Andrew C. Madsen
Information Architect
Harley-Davidson Motor Company
"Andrew Madsen" <andrew.madsen@.harley-davidson.com> wrote in message
news:OjQ7iARPEHA.1276@.TK2MSFTNGP11.phx.gbl...
> I have a large csv import into a SQL Server data base and I am trying to
> transform a field to DATETIME before it gets to the database. The data in
> the field is '20030100' or something similar the first four characters are
> year the next two are month an the last are place holders as the mainframe
> application does not transfer its DATETIME fields nicely. there for I want
> to do something like this
> Function Main()
> DTSDestination("TRANCD") = Left( DTSSource("TRANCD") , 6 ) + '28'
> Main = DTSTransformStat_OK
> End Function
> but it fails. I have also tried setting the value to Left(
> DTSSource("TRANCD") , 6 ) & '28' and to concat( Left( DTSSource("TRANCD")
,
> 6 ) , '28').
> Each one files but if I just set it to the Left( DTSSource("TRANCD") , 6 )
> it is ok. It appears that I am trying to get 28 into the field wrong. Any
> help out there?
> --
> Andrew C. Madsen
> Information Architect
> Harley-Davidson Motor Company
>sql