FTP a file from mainframe using JAVA



Support for Java SE, EE & ME, JVM, JNI, JDBC, EJB, JFC, JPDA, JAAS,JCE, JAXP, XML and Java API.

FTP a file from mainframe using JAVA

Postby RadAl3 » Wed Nov 14, 2012 2:41 pm

Hello All ,
Say I have a file file.txt on my mainframe host xxx.xxx.xxx.xx created by user QWERTY in the path TEST. I would like to ftp this file from mainframe to my unix machine. When I run the code
fsDataInputStream=ftpFileSystem.open(new Path ("ftp://QWERTY@xxx.xxx.xxx.xx'TEST/file.txt'") );


the error I get is "Path ftp://QWERTY@xxx.xxx.xxx.xx'TEST/file.txt' is a directory."

On giving
 fsDataInputStream = ftpFileSystem.open(new Path('TEST/file.txt'), 1000);


I get the error : File 'QWERTY.'/'TEST/file.txt does not exist. It appends the 'QWERTY.'/' on its own.

Any pointers on how to give this file path name ?
RadAl3
 
Posts: 2
Joined: Wed Nov 14, 2012 2:35 pm
Has thanked: 1 time
Been thanked: 0 time

Re: FTP a file from mainframe using JAVA

Postby Robert Sample » Wed Nov 14, 2012 5:21 pm

Have you tried specifying the complete path name in ftpFileSystem.open? Since you're connecting from another system, there's no environment information available such as the home directory for user QWERTY.

These users thanked the author Robert Sample for the post:
RadAl3 (Thu Nov 15, 2012 2:50 pm)
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: FTP a file from mainframe using JAVA

Postby RadAl3 » Thu Nov 15, 2012 2:27 pm

Thanks Robert . I did try that also but in vain . I finally found the way out. By not using FtpFileSystem , rather using other FTP api's ..
RadAl3
 
Posts: 2
Joined: Wed Nov 14, 2012 2:35 pm
Has thanked: 1 time
Been thanked: 0 time

Re: FTP a file from mainframe using JAVA

Postby Robert Sample » Thu Nov 15, 2012 3:16 pm

Glad to hear you got it resolved.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: FTP a file from mainframe using JAVA

Postby wangy » Fri Nov 23, 2012 6:40 pm

You can just use the FTP command.
wangy
 
Posts: 5
Joined: Fri Nov 23, 2012 6:27 pm
Has thanked: 6 times
Been thanked: 0 time

Re: FTP a file from mainframe using JAVA

Postby dick scherrer » Sun Nov 25, 2012 6:33 am

Hello,

There is not much value added when you re-post the solution the poster has already posted . . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to Mainframe Java

 


  • Related topics
    Replies
    Views
    Last post