Topic "FTP get dataset from Mainframe"

Author Message
atorres29@gmail.com
[View user's profile]

Joined: 2009-10-20
Posts: 3
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
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24993
Location: Prague, Czechia
Why is the directory listing empty? Is this how your server works?
_________________
Martin Prikryl
atorres29@gmail.com
[View user's profile]

Joined: 2009-10-20
Posts: 3
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
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24993
Location: Prague, Czechia
WinSCP cannot download file when it's absent from directory listing.
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License