Login  
Search All Forums
Dart Home | PowerTCP FTP for .NET | Custom Development Reply | PowerTCP FTP for .NET Topics | Forums   
AuthorForum: PowerTCP FTP for .NET
Topic: FTP from mainframe stays in EBCDIC
tssats

From: Madison, WI USA
Posts: 7
Member Since: 09/30/11
posted September 30, 2011 9:25 AM

We just upgraded to 4.4.1.0. Prior versions, although you had to manually put it in passive mode when dwonloading from the mainframe, would automatically be converted from EBCDIC to ASCII.
This no longer happens with version 4.4.1.0. Using Microsoft's ftp from a DOS command prompt works just fine (the exact same mainframe file gets downloaded as ASCII). We have tried .Site("SBD=(IBM-1047,ISO8859-1)") which is accepted, but makes no difference. The response to the Connect command is "TCPIPFTP IBM FTP CS V1R11"
Nick B (Admin)

From: Utica, NY USA
Posts: 619
Member Since: 05/25/10

Extra Support Options
Custom Application Development

posted September 30, 2011 10:08 AM

Hello,

The old version defaulted to ASCII for transfers, while the new version uses binary by default, unless the file's extension is listed in Ftp.Session.AsciiExtensions. You can either add the remote file's extension to this collection, or set AsciiExtensions.Enabled to false, and call Ftp.SetType(FileType.Ascii) prior to sending.
tssats

From: Madison, WI USA
Posts: 7
Member Since: 09/30/11
posted September 30, 2011 10:26 AM

Neither of those have any affect.
Here is the code:
Dim Host As String = "thehost"
Dim User As String = "theuser"
Dim Passwd As String = "thepassword"
Dim RemoteFile As String = "'M5618.D092211'"
Dim LocalFile As String = "C:\ftpfiles\mfdown.txt"
Dim myDart As New Dart.Ftp.Ftp
Dim myDartSession As New Dart.Ftp.FtpSession
myDartSession.RemoteEndPoint = New Dart.Ftp.IPEndPoint(Host, 21)
myDartSession.Username = User
myDartSession.Password = Passwd
myDartSession.AsciiExtensions.Enabled = False
myDart.Session = myDartSession
Dim PutGetResponse As Dart.Ftp.CopyResult
Dim Response As Dart.Ftp.Response
If Not myDart.Connected Then Response = myDart.Connect()
myDart.Authenticate()
'Response = myDart.SetType(Dart.Ftp.FileType.Ascii)
'Response = myDart.Site("SBDATACONN=(IBM-1047,ISO8859-1)")
PutGetResponse = myDart.Get(RemoteFile, LocalFile, Dart.Ftp.Synchronize.Off)
myDart.Close()
Nick B (Admin)

From: Utica, NY USA
Posts: 619
Member Since: 05/25/10

Extra Support Options
Custom Application Development

posted September 30, 2011 11:11 AM

Hello,

(I'm assuming "'Response = myDart.SetType(Dart.Ftp.FileType.Ascii)" was uncommented for the test?) Please reply with a log of the transfer; hook up the Ftp.Connection.Log event, and in it write

(e.Data.Direction == DataDirection.In ? "< " : "> ") + e.Data.ToString()

to a file, or textbox.
tssats

From: Madison, WI USA
Posts: 7
Member Since: 09/30/11
posted September 30, 2011 12:47 PM

How do I hook up the Ftp.Connection.Log event?
Nick B (Admin)

From: Utica, NY USA
Posts: 619
Member Since: 05/25/10

Extra Support Options
Custom Application Development

posted September 30, 2011 1:12 PM

Hello,

One way is to use the AddHandler method. Another is the 'Handles' keyword. You may want to look up a tutorial for more information.
tssats

From: Madison, WI USA
Posts: 7
Member Since: 09/30/11
posted September 30, 2011 1:17 PM

What am I supposed to "Handle"? If I dim it withevents, this is what is available:
  Private Sub myDart_Copy(ByVal sender As Object, ByVal e As Dart.Ftp.CopyEventArgs) Handles myDart.Copy

  End Sub

  Private Sub myDart_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles myDart.Disposed

  End Sub

  Private Sub myDart_Error(ByVal sender As Object, ByVal e As Dart.Ftp.ErrorEventArgs) Handles myDart.Error

  End Sub

  Private Sub myDart_Listing(ByVal sender As Object, ByVal e As Dart.Ftp.ListingEventArgs) Handles myDart.Listing

  End Sub

  Private Sub myDart_Progress(ByVal sender As Object, ByVal e As Dart.Ftp.ProgressEventArgs) Handles myDart.Progress

  End Sub

  Private Sub myDart_UserState(ByVal sender As Object, ByVal e As Dart.Ftp.UserStateEventArgs) Handles myDart.UserState

  End Sub
Nick B (Admin)

From: Utica, NY USA
Posts: 619
Member Since: 05/25/10

Extra Support Options
Custom Application Development

posted September 30, 2011 1:27 PM

Hello,

Exactly like that, yes, but for the Ftp.Connection.Log event. Something like: Private Sub myComponent_Log(ByVal sender As Object, ByVal e As DataEventArgs) Handles Ftp.Connection.Log. It may help to examine some tutorials on the subject.
tssats

From: Madison, WI USA
Posts: 7
Member Since: 09/30/11
posted September 30, 2011 2:24 PM

Actually, it would help if you fixed your assembly. It doesn't expose the Connect event, so MyDart.Connection.Log isn't avalable (as I demonstrated in an earlier post). Without your code, I wouldn't have known it was an available event.

Here is my code and the output fromit (I have no idea where the SIZE command is coming from)

  Dim sOutput As String = String.Empty
  Dim WithEvents myDart As Dart.Ftp.Ftp

  Private Sub MyDart_Connection_Log(ByVal sender As System.Object, ByVal e As Dart.Ftp.DataEventArgs) Handles myDart.connection.log
    sOutput += IIf(e.Data.Direction = Dart.Ftp.DataDirection.In, "< ", "> ") & e.Data.ToString()
  End Sub

  Private Sub DoGet()
    myDart = New Dart.Ftp.Ftp
    Dim myDartSession As New Dart.Ftp.FtpSession

    myDartSession.RemoteEndPoint = New Dart.Ftp.IPEndPoint(Host, 21)
    myDartSession.Username = User
    myDartSession.Password = Passwd
    myDart.Session = myDartSession


    Dim PutGetResponse As Dart.Ftp.CopyResult
    Dim Response As Dart.Ftp.Response
    If Not myDart.Connected Then Response = myDart.Connect()
    myDart.Authenticate()
    Response = myDart.SetType(Dart.Ftp.FileType.Ascii)
    PutGetResponse = myDart.Get(RemoteFile, LocalFile, Dart.Ftp.Synchronize.Off)
    Debug.Print(sOutput.ToString)
    myDart.Close()
  End Sub



< 220-TCPIPFTP IBM FTP CS V1R11 at AHOST, 13:16:53 on 2011-09-30.
< 220 Connection will close if idle for more than 60 minutes.
> USER usr
< 331 Send password please.
> PASS pswd
< 230 USR is logged on. Working directory is "USR.".
> TYPE A
< 200 Representation type is Ascii NonPrint
> SIZE 'M5618.D092211'
< 501 command aborted -- FTP server not configured for SIZE
> TYPE I
< 200 Representation type is Image
> PASV
< 227 Entering Passive Mode (198,150,235,249,197,213)
> RETR 'M5618.D092211'
< 125 Sending data set M5618.D092211 FIXrecfm 120
< 250 Transfer completed successfully.
Nick B (Admin)

From: Utica, NY USA
Posts: 619
Member Since: 05/25/10

Extra Support Options
Custom Application Development

posted September 30, 2011 2:51 PM

Hello,

Connect/Connection isn't an event; Log is an event on the TcpBase object exposed by the Connection property. We do it like this for consistency between products, and because it exposes the content sent over the TCP connection, but I have added your comment as a feature request.

You need to set myDartSession.AsciiExtensions.Enabled = False as well. Otherwise AsciiExtensions will be used to determine which transfer type to use when you call Get(). Please send in a log after you have added that code if it does not resolve your issue.
tssats

From: Madison, WI USA
Posts: 7
Member Since: 09/30/11
posted September 30, 2011 3:16 PM

Setting the ASCIIExtensions to false did not help. As a matter of fact, if I look at the value after setting it to false, it still says it is true.

Step into: Stepping over method without symbols 'Dart.Ftp.AsciiExtensions.Enabled.set'
 myDartSession.AsciiExtensions.Enabled = False
? myDartSession.AsciiExtensions.Enabled
True


    myDart = New Dart.Ftp.Ftp
    Dim myDartSession As New Dart.Ftp.FtpSession

    myDartSession.RemoteEndPoint = New Dart.Ftp.IPEndPoint(Host, 21)
    myDartSession.Username = User
    myDartSession.Password = Passwd
    myDartSession.AsciiExtensions.Enabled = False
    myDart.Session = myDartSession


    Dim PutGetResponse As Dart.Ftp.CopyResult
    Dim Response As Dart.Ftp.Response
    If Not myDart.Connected Then Response = myDart.Connect()
    myDart.Authenticate()
    Response = myDart.SetType(Dart.Ftp.FileType.Ascii)
    myDart.Session.AsciiExtensions.Enabled = False
    PutGetResponse = myDart.Get(RemoteFile, LocalFile, Dart.Ftp.Synchronize.Off)
    Debug.Print(sOutput.ToString)
    myDart.Close()




< 220-TCPIPFTP IBM FTP CS V1R11 at AHOST, 13:59:07 on 2011-09-30.
< 220 Connection will close if idle for more than 60 minutes.
> USER usr
< 331 Send password please.
> PASS pswd
< 230 USR is logged on. Working directory is "USR.".
> TYPE A
< 200 Representation type is Ascii NonPrint
> SIZE 'M5618.D092211'
< 501 command aborted -- FTP server not configured for SIZE
> TYPE I
< 200 Representation type is Image
> PASV
< 227 Entering Passive Mode (198,150,235,249,230,99)
> RETR 'M5618.D092211'
< 125 Sending data set M5618.D092211 FIXrecfm 120
< 250 Transfer completed successfully.
tssats

From: Madison, WI USA
Posts: 7
Member Since: 09/30/11
posted September 30, 2011 3:25 PM

I tried it without a separate session, that won't allow setting it to False either, it stays True.

    myDart = New Dart.Ftp.Ftp

    myDart.Session.RemoteEndPoint = New Dart.Ftp.IPEndPoint(Host, 21)
    myDart.Session.Username = User
    myDart.Session.Password = Passwd
    myDart.Session.AsciiExtensions.Enabled = False

    Dim PutGetResponse As Dart.Ftp.CopyResult
    Dim Response As Dart.Ftp.Response
    If Not myDart.Connected Then Response = myDart.Connect()
    myDart.Authenticate()
    Response = myDart.SetType(Dart.Ftp.FileType.Ascii)
    PutGetResponse = myDart.Get(RemoteFile, LocalFile, Dart.Ftp.Synchronize.Off)
    Debug.Print(sOutput2.ToString)
    myDart.Close()





< 220-TCPIPFTP IBM FTP CS V1R11 at AHOST, 14:21:36 on 2011-09-30.
< 220 Connection will close if idle for more than 60 minutes.
> USER usr
< 331 Send password please.
> PASS pswd
< 230 USR is logged on. Working directory is "USR.".
> TYPE A
< 200 Representation type is Ascii NonPrint
> SIZE 'M5618.D092211'
< 501 command aborted -- FTP server not configured for SIZE
> TYPE I
< 200 Representation type is Image
> PASV
< 227 Entering Passive Mode (198,150,235,249,230,99)
> RETR 'M5618.D092211'
< 125 Sending data set M5618.D092211 FIXrecfm 120
< 250 Transfer completed successfully.
Nick B (Admin)

From: Utica, NY USA
Posts: 619
Member Since: 05/25/10

Extra Support Options
Custom Application Development

posted September 30, 2011 5:02 PM

Hello,

I've sent a download link to your email address for a beta dll that fixes this. I'm sorry for the inconvenience.
SGCornerStone

From: Troy, NY USA
Posts: 6
Member Since: 10/31/12
posted October 31, 2012 10:45 AM

Nick -

I recently had to re-purchase the FTP control after our server crashed. The purchased version is 4.5.2.1. Previously we were using 4.4.2.3.

With 4.4.2.3 the files were downloading correctly in ASCII format with the appropriate carriage returns and line feeds. With 4.5.2.1 they are coming down in EBCDIC format.

Thoughts?
Nick B (Admin)

From: Utica, NY USA
Posts: 619
Member Since: 05/25/10

Extra Support Options
Custom Application Development

posted October 31, 2012 11:14 AM

Hello,

I'll be replying in your new thread:
http://support.dart.com/postings?topicid=8490
Reply | PowerTCP FTP for .NET Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX