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