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.
RadAl3
Posts: 2
Joined: Wed Nov 14, 2012 2:35 pm
Skillset: DB2 data extraction
Referer: Internet

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

Code: Select all

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

Code: Select all

 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 ?

Robert Sample
Global moderator
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Skillset: Systems programming, SAS, COBOL, CICS, JCL, SMS, VSAM, etc.
Referer: other forum
Location: Dubuque, Iowa, USA

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.

RadAl3
Posts: 2
Joined: Wed Nov 14, 2012 2:35 pm
Skillset: DB2 data extraction
Referer: Internet

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 ..

Robert Sample
Global moderator
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Skillset: Systems programming, SAS, COBOL, CICS, JCL, SMS, VSAM, etc.
Referer: other forum
Location: Dubuque, Iowa, USA

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.

wangy
Posts: 5
Joined: Fri Nov 23, 2012 6:27 pm
Skillset: JCL/TSO/COBOL
Referer: Google

Re: FTP a file from mainframe using JAVA

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

You can just use the FTP command.

User avatar
dick scherrer
Global moderator
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am

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.


  • Similar Topics
    Replies
    Views
    Last post