Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: FTP get dataset from Mainframe

WinSCP cannot download file when it's absent from directory listing.
atorres29@gmail.com

Re: FTP get dataset from Mainframe

I do not know why is empty, is not my server I just know that is a mainframe and the file is a dataset. This is the vbs scrip that I need to replace this vbs get the file.



' GENERATE FTP SCRIPT
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objMyFile = objFSO.CreateTextFile("E:\Scripts\atorres_test\ftp.txt")
objMyFile.WriteLine ("open scc.its")
objMyFile.WriteLine ("UserName")
objMyFile.WriteLine ("password")
objMyFile.WriteLine ("lcd E:\Scripts\atorres_test")
objMyFile.WriteLine ("get 'ATD.LAM.PODBS.P.LOT.F2R0050.V99' file.txt")
objMyFile.WriteLine ("close")
objMyFile.WriteLine ("bye")
objMyFile.Close
Set objMyFile = Nothing




' EXECUTE FTP
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run ("ftp -s:E:\Scripts\atorres_test\ftp.txt")
martin

Re: FTP get dataset from Mainframe

Why is the directory listing empty? Is this how your server works?
atorres29@gmail.com

FTP get dataset from Mainframe

I cannot get a dataset from mainframe using .net assembly if I use windows command prompt I I get the file.
Here is part of the code I use

using (Session session = new Session())
{
session.ExecutablePath = winscpPath + "WinSCP.exe";
session.SessionLogPath = LogFilePath;
SessionOptions Options = new SessionOptions
{
Protocol = Protocol.Ftp,
HostName = hostName,
UserName = userName,
Password = password,
PortNumber = port
};

session.Open(Options);
TransferOptions transferOptions = new TransferOptions();
TransferOperationResult transferResult;
transferResult = session.GetFiles(remotePath, tempLocation, false, transferOptions);
// Throw on any error
transferResult.Check();

// Print results
foreach (TransferEventArgs transfer in transferResult.Transfers)
{
// Console.WriteLine("Download of {0} succeeded", transfer.FileName);
message = "succeeded";
}


}


Here is the WinSCP log

> 2014-09-26 16:28:12.753 Script: get -nopermissions -preservetime -transfer="binary" -- "'ATD.LAM.PODBS.P.LOT.F2R0050.V99' text.txt" "C:\text.txt"
. 2014-09-26 16:28:12.755 Retrieving directory listing...
> 2014-09-26 16:28:12.755 TYPE A
< 2014-09-26 16:28:12.766 200 Representation type is Ascii NonPrint
> 2014-09-26 16:28:12.769 PASV
< 2014-09-26 16:28:12.779 227 Entering Passive Mode (207,192,50,50,87,245)
> 2014-09-26 16:28:12.780 LIST -a
. 2014-09-26 16:28:12.796 <Empty directory listing>
< 2014-09-26 16:28:12.797 550 No data sets found.
. 2014-09-26 16:28:12.798 Directory listing successful
. 2014-09-26 16:28:12.798 Retrieving directory listing...
> 2014-09-26 16:28:12.799 TYPE A
< 2014-09-26 16:28:12.810 200 Representation type is Ascii NonPrint
> 2014-09-26 16:28:12.810 PASV
< 2014-09-26 16:28:12.819 227 Entering Passive Mode (207,192,50,50,87,246)
> 2014-09-26 16:28:12.820 LIST
. 2014-09-26 16:28:12.832 <Empty directory listing>
< 2014-09-26 16:28:12.832 550 No data sets found.
. 2014-09-26 16:28:12.833 Directory listing successful
< 2014-09-26 16:28:12.833 Script: Can't get attributes of file ''ATD.LAM.PODBS.P.LOT.F2R0050.V99' test.txt'.
< 2014-09-26 16:28:12.834 Script: <Empty directory listing>

< 2014-09-26 16:28:12.835 No data sets found.
. 2014-09-26 16:28:12.836 Script: Failed
> 2014-09-26 16:28:13.694 Script: exit
. 2014-09-26 16:28:13.694 Script: Exit code: 1
. 2014-09-26 16:28:13.699 Disconnected from server
< 2014-09-26 16:28:12.797 550 No data sets found.


Any help Thanks!

Albert Torres