Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
rgombina
Constraint Violating Yak Guru
319 Posts |
Posted - 2007-09-21 : 08:49:49
|
Hello,Has anyone had any success sending or receiving file(s) from either Script or FTP task? I've Google and found examples and no luck for me. The main idea is to send a file from local PC/server to mainframe.Username: imtheuserPassword: pwdSource file: c:\myfile.txtDestination: 'PROD.ABC.DAILY.BATCH'I've used this workaround, SSIS Script Task but no good.SQL ServerFeedback Workarounds 281893. SSIS FTP Task - Mainframe When you try to connect to a mainframe (os / 390) to ftp receive a file you get an error message stating that the path does not begin with a "/". Active feedback entered 6/7/2007 by EWisdahl Entered by EWisdahl on 6/7/2007 Add a script task (as follows) to download the desired files...' Microsoft SQL Server Integration Services Script Task' Write scripts using Microsoft Visual Basic' The ScriptMain class is the entry point of the Script Task.Imports SystemImports System.DataImports System.MathImports Microsoft.SqlServer.Dts.RuntimePublic Class ScriptMain' The execution engine calls this method when the task executes.' To access the object model, use the Dts object. Connections, variables, events,' and logging features are available as static members of the Dts class.' Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.' ' To open Code and Text Editor Help, press F1.' To open Object Browser, press Ctrl+Alt+J.Public Sub Main()Try'Create the connection to the ftp serverDim cm As ConnectionManager = Dts.Connections.Add("FTP")'Set the properties like username & passwordcm.Properties("ServerName").SetValue(cm, "myServer")cm.Properties("ServerUserName").SetValue(cm, "myUserName")cm.Properties("ServerPassword").SetValue(cm, "myPassword")cm.Properties("ServerPort").SetValue(cm, "21")cm.Properties("Timeout").SetValue(cm, "0") 'The 0 setting will make it not timeoutcm.Properties("ChunkSize").SetValue(cm, "1000") '1000 kbcm.Properties("Retries").SetValue(cm, "1")'create the FTP object that sends the files and pass it the connection created above.Dim ftp As FtpClientConnection = New FtpClientConnection(cm.AcquireConnection(Nothing))'Connects to the ftp serverftp.Connect()ftp.SetWorkingDirectory("MyFolder.MySubFolder.MySubSubFolder")Dim files(0) As Stringfiles(0) = "MyfileName"ftp.ReceiveFiles(files, "C:\temp", True, True)' Close the ftp connectionftp.Close()'Set the filename you retreive for use in data flowDts.Variables.Item("FILENAME").Value = maxnameCatch ex As ExceptionDts.TaskResult = Dts.Results.FailureEnd TryDts.TaskResult = Dts.Results.SuccessEnd SubEnd Class Thanks again. |
|
igorblackbelt
Constraint Violating Yak Guru
407 Posts |
Posted - 2007-09-21 : 12:08:49
|
This should be doable using the FTP task, another option you have is using xp_cmdshell combined with T-SQl, which is what most people will recommend. |
 |
|
rgombina
Constraint Violating Yak Guru
319 Posts |
Posted - 2007-09-21 : 12:22:10
|
I have success with xp_cmdshell. However (learning other way), SSIS/Script/FTP Task is what I want to know how since it is not friendly with mainframe destination transmission. Because of the "/" requirement you can not use FTP Task(something MS forgot to spend time on, I guess). |
 |
|
mr4100
Starting Member
6 Posts |
Posted - 2007-09-25 : 09:56:16
|
no luck putting or getting files off of mainframe using ftp task so i used the ftp.exe windows command using the execute process task but first create a text file with logon info using put or get commands to perform your task on the server. call that text file in the task by using -s in the argument field. Example below:Execute Process Task:executable: C:\windows\system32\ftp.exearguments: -s:"C:\ftpscript.txt"text file script i used:open serveraddressusernamepasswordAsciiput C:\File.txtbyeexit |
 |
|
X002548
Not Just a Number
15586 Posts |
Posted - 2007-09-25 : 10:01:21
|
1. Create a *.bat fileftp -s:W:\data\CompDB\ftpcmdDataUp.txt > W:\data\CompDB\ftpcmdDataUp.log 2. Create an ftp scriptopen ISOF1 loginIDPWDdelete 'BXRL94.COMPDB.D070924.T0000001'quote site cyl pri=1 sec=1 lrecl=144 blksize=0 recfm=fb retpd=30put W:\DATA\COMPDB\DATA\T0000001.dat 'BXRL94.COMPDB.D070924.T0000001' quit Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam |
 |
|
Chinni
Yak Posting Veteran
95 Posts |
Posted - 2008-09-03 : 15:37:36
|
can any one explain in detaili created Batch fileOpen servernameusernamepasswdliteral site refm=fc lrecl=50 blksize=6000 wraprecordput C:\Documents and Settings\Desktop\sampleData.txt" ‘RFGT.FTP.HDP.KS.CODML(+1)' (replacequitSCR:ftp -s:"HDPextract.scr" >"resultsHDP.txt"OR how to create .exe |
 |
|
|
|
|
|
|