View previous topic :: View next topic |
Author |
Message |
manu Beginner
Joined: 26 Dec 2002 Posts: 47 Topics: 19
|
Posted: Sun Mar 18, 2018 9:59 am Post subject: FTP question - Mainframe from Linux server |
|
|
Hi,
A file is getting FTPied from mainframe to a Linux server to a particular directory. A Java process kicks off as soon as the file gets written into that particular directory and it starts processing the file before the full file gets FTPied. The Java process and FTP in mainframe is running concurrently. I wanted the JAVA process to run only after the file FTP was completed. So I created a new folder and FTPied the file and then wanted to rename/move the file into that particular directory which kicks off the Java process based on a particular name
/p01/app/test1/dba93/ecp is the directory - creation of file in the name dcert.txt kick off the Java process.
so i created a new folder in ecp and put the file name
Below are the Ftp commands in my JCL --
Code: |
--pwd
/p01/app/test1/dba93/ecp
--cd test
--pwd
/p01/app/test1/dba93/ecp/test
--sput mainframe file dcert.txt
--cd
--rename /p01/app/test1/dba93/ecp/test/dcert.txt dcert.txt
|
the rename fails with the below error.Error:
Code: |
java.nio.file.NoSuchFileException: /p01/app/test1/dba93/ecp/test/dcert.txt |
Please let me know what I am missing and if you have any other suggestions to accomplish this. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12369 Topics: 75 Location: San Jose
|
Posted: Mon Mar 19, 2018 11:20 am Post subject: |
|
|
manu wrote: | rename /p01/app/test1/dba93/ecp/test/dcert.txt dcert.txt |
manu,
aren't you renaming the file to the same file name? _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
manu Beginner
Joined: 26 Dec 2002 Posts: 47 Topics: 19
|
Posted: Mon Mar 19, 2018 3:01 pm Post subject: |
|
|
Hi Kolusu,
It fails with the same error even if I give different file name. Basically I am Ftp'ing into one folder and want to move the file to the parent folder by FTP.I am putting the file in the below folder
/p01/app/test1/dba93/ecp/test
and want to move the file into
/p01/app/test1/dba93/ecp by using FTP from mainframe.
Any suggestions? Thanks. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12369 Topics: 75 Location: San Jose
|
Posted: Mon Mar 19, 2018 5:18 pm Post subject: |
|
|
manu wrote: | Hi Kolusu,
It fails with the same error even if I give different file name. Basically I am Ftp'ing into one folder and want to move the file to the parent folder by FTP.I am putting the file in the below folder
/p01/app/test1/dba93/ecp/test
and want to move the file into
/p01/app/test1/dba93/ecp by using FTP from mainframe.
Any suggestions? Thanks. |
manu,
I am confused. Your initial post shows a java error on rename and now you asking to move the file using FTP control cards?
If you are using Java 7 and higher then you can use Files.Move
something like this
Code: |
Path source = "/p01/app/test1/dba93/ecp/test/dcert.txt"
Path newdir = "/p01/app/test1/dba93/ecp/dcert.txt"
Files.move(source, newdir.resolve(source.getFileName()), REPLACE_EXISTING);
|
or if you want to use renameto then use the example shown here
http://javatutorialhq.com/java/io/file-class-tutorial/renameto-method-example/ _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
manu Beginner
Joined: 26 Dec 2002 Posts: 47 Topics: 19
|
Posted: Thu Mar 22, 2018 12:28 pm Post subject: |
|
|
That was the error message I got in the mainframe job log.I will check on it and let you know if I need anything. Thanks for your inputs on this. |
|
Back to top |
|
|
|
|