Delete file after FTP

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yep, do that 'all the time'. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
nkln@you
Premium Member
Premium Member
Posts: 271
Joined: Wed Nov 17, 2004 5:15 am
Location: US

Post by nkln@you »

Hi All,

I can do that in shell script but i am passing multiple files to a ftp location. And that would mean creating multiple shell script which I want to avoid. Thats the reason I am thinking of using FTP stage to do this work. Is there any approach to do the same like doing everything in the AfterJob SubRoutine ExecSH. I am able to create a backup file using the Before Job SubRoutine ExecSH but how can i handle the exceptions. Say if FTP fails, we need to revert the backup file to the original file.

Please suggest the solution for the same.
Aim high
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Did you read any of my posts? Did you checkout using scp and ssh? Why use the FTP stage to do something so simple?
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
nkln@you
Premium Member
Premium Member
Posts: 271
Joined: Wed Nov 17, 2004 5:15 am
Location: US

Post by nkln@you »

kcbland wrote:Did you checkout using scp and ssh? Why use the FTP stage to do something so simple?
I didnt understand the checkout using SCP And SSH. The only thing is I dont want to create a shell script when the same functionality is achievable in DS. So was wondering if its possible to do using FTP stage or just in the server job by having some Before/After Job Subroutine we can implement this?
Aim high
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

A before/after subroutine is just going to execute ftp, so I'm just saying you should use scp and ssh instead. That's a fairly great recommendation.

As for the FTP stage you take on a whole lot of other issues as it reads the file and requires highly structured and conforming data with the metadata, doesn't do compression, and is slower than command line FTP.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
nkln@you
Premium Member
Premium Member
Posts: 271
Joined: Wed Nov 17, 2004 5:15 am
Location: US

Post by nkln@you »

kcbland wrote:A before/after subroutine is just going to execute ftp, so I'm just saying you should use scp and ssh instead. That's a fairly great recommendation.

As for the FTP stage you take on a whole lot of other issues as it reads the file and requires highly structured and conforming data with the metadata, doesn't do compression, and is slower than command line FTP.
How do I use SCP or SSH to do the same operations?
Aim high
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Please research on your own about scp and ssh. I've already posted enough about them to describe their benefits.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
nkln@you
Premium Member
Premium Member
Posts: 271
Joined: Wed Nov 17, 2004 5:15 am
Location: US

Post by nkln@you »

kcbland wrote:Please research on your own about scp and ssh. I've already posted enough about them to describe their benefits.
Please let me know if its possible to use Scp in a server job or not. and if using Scp is possible in a server job, then without going for shell script, is it possible to do the same operations?
Aim high
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

You can use scp in a server job. But as there is no stage to do this, you will need to shell out.
nkln@you
Premium Member
Premium Member
Posts: 271
Joined: Wed Nov 17, 2004 5:15 am
Location: US

Post by nkln@you »

ArndW wrote:You can use scp in a server job. But as there is no stage to do this, you will need to shell out.
So it comes back to FTP stage where I can do all the operations without writing shell script.
Aim high
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

nkln@you wrote:Hi All,

I can do that in shell script but i am passing multiple files to a ftp location. And that would mean creating multiple shell script which I want to avoid. Thats the reason I am thinking of using FTP stage to do this work. Is there any approach to do the same like doing everything in the AfterJob SubRoutine ExecSH. I am able to create a backup file using the Before Job SubRoutine ExecSH but how can i handle the exceptions. Say if FTP fails, we need to revert the backup file to the original file.

Please suggest the solution for the same.
Do you see your own post above? You're asking about doing things that the FTP stage can't possibly do. Your only solution to getting all of the things you want is to use multiple command lines to do it. SCP can copy multiple files easily, it's just like the cp command but it uses remote hostnames as part of its syntax. SSH can run commands remotely. All of your error trapping and troubleshooting will require you to handle the situations with custom logic. None of this can be done with the FTP stage, the after-command is limited.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
nkln@you
Premium Member
Premium Member
Posts: 271
Joined: Wed Nov 17, 2004 5:15 am
Location: US

Post by nkln@you »

kcbland wrote: You're asking about doing things that the FTP stage can't possibly do. Your only solution to getting all of the
But FTP stage does all the operations I want it to do. It can take the backup of the file before doing the FTP. then it has rollback transaction command where i can restore the backup file as the Original file if the FTP fails. And if FTP succeeds then we have the Transaction Commit command line where I can delete the backup file. The FTP stage has multiple command line options where I can run multiple commands. So FTP stage does fulfill all of my requirements.
Aim high
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Okay, I'm done arguing. :cry: You win. I thought you needed to send multiple files. I'm obviously confused. :(
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
nkln@you
Premium Member
Premium Member
Posts: 271
Joined: Wed Nov 17, 2004 5:15 am
Location: US

Post by nkln@you »

kcbland wrote:Okay, I'm done arguing. :cry: You win. I thought you needed to send multiple files. I'm obviously confused. :(
Well You are not wrong. But my multiple files are in different folders and the picking time of all files are different. So i cant do everything in one shell script. This was the reason I wanted to go for FTP stage. and for each file, I am creating a job. But the problem remains the same. I am not able to figure out whats the telnet prompt. When I try to telnet the system(where DS is installed), it just gives me a blank screen. Any help on this.
Aim high
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Are you not ftp'ing these files somewhere else meaning some other server? If so, why try to telnet to the DataStage server? :?

You need the telnet prompts and credentials from the remote server.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply