Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Sitecommand in org.apache.commons.ftp against a mainframe - has file already been uploaded

Posted on 2003-10-31
6
Medium Priority
?
364 Views
Last Modified: 2012-06-27
I have this

            try {
                  siteCommand = "LRECL=" + lrecl;
                  ftpReply = ftp.site(siteCommand);
                  showMsg(ftp.getReplyString() + ": " + siteCommand, verbose);
                  siteCommand = "BLOCKSIZE=" + blksize;
                  ftpReply = ftp.site(siteCommand);
                  showMsg(ftp.getReplyString() + ": " + siteCommand, verbose);
                  siteCommand = "RECFM=" + recfm;
                  ftpReply = ftp.site(siteCommand);
                  showMsg(ftp.getReplyString() + ": " + siteCommand, verbose);
                  siteCommand = "VOLUME=" + theVolume;
                  ftpReply = ftp.site(siteCommand);
                  showMsg(ftp.getReplyString() + ": " + siteCommand, verbose);
                  siteCommand = spaceType;
                  ftpReply = ftp.site(siteCommand);
                  showMsg(ftp.getReplyString() + ": " + siteCommand, verbose);
                  siteCommand = "PRIMARY=" + primarySpace;
                  ftpReply = ftp.site(siteCommand);
                  showMsg(ftp.getReplyString() + ": " + siteCommand, verbose);
                  siteCommand = "SECONDARY=" + secondarySpace;
                  ftpReply = ftp.site(siteCommand);
                  showMsg(ftp.getReplyString() + ": " + siteCommand, verbose);
                  // No port command necessary
                  FileInputStream local = new FileInputStream(fileName);
                  if (ftp.storeFile(mvsFileName, local)) {
                        showMsg("Stored Ok:" + ftp.getReplyString(), true);
                  }
                  else
                        showMsg("Problems storing:" + ftp.getReplyString(), verbose);
                  local.close();
                  return true;
            }
Any way I can figure out before I do the stor if the file already exists or do I have to do an LS or such
And if so, how do I do that and get the data into an form where I can test the existence of the file???
Thanks

Michel

0
Comment
Question by:Michel Plungjan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 9657877
It certainly will need some kind of listing. Look at FTPFileList
0
 
LVL 75

Author Comment

by:Michel Plungjan
ID: 9658485
Any chance of finding me an example?
The apache javadoc is as terse as anything I have read...

Thanks
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 1000 total points
ID: 9658610
None that I can find. I can give you a couple of tips from looking at the docs:

1. use FTPClient not FTP, if you're not already doing that
2. call createFileList on the FTPClient, using your own FTPFileEntryParser with an implementation that closes the stream if the entry is found and returns a FTPFileList of one element, null otherwise
0
Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

 
LVL 75

Author Comment

by:Michel Plungjan
ID: 9659150
Why would I not use ftp???
0
 
LVL 75

Author Comment

by:Michel Plungjan
ID: 9659152
thanks by the way
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9665981
>>Why would I not use ftp???

Because it's a superclass of FTPClient with reduced functionality (at a fairly quick glance)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question