Deleting a file from DS on windows server

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

stivazzi
Participant
Posts: 52
Joined: Tue May 02, 2006 3:53 am

Deleting a file from DS on windows server

Post by stivazzi »

I pick up a file from a windows server via ftp and copying it on my unix DS server.
At the end of my job i need to delete both files: the one on my DS unix server and the one on windows server.
1 - To delete the file on DS unix server i think i can call DS stage from sequence job "ExecuteCommand"... writing "rm path/filename" on "Command" line... right?
2 - to delete the file on windows server i think i need ftp.. should i use the same stage ExecuteCommand on sequence job? or is ther any other possibility?
i think i should write an .sh file and invoke it from Command line.... could this syntax be right?

ftp remote_server
user remote_user remote_pwd
cd remote_path_where_is_my_file
prompt
delete remote_file
eof

should i use delete? or dele?

thank you
A.
jhmckeever
Premium Member
Premium Member
Posts: 301
Joined: Thu Jul 14, 2005 10:27 am
Location: Melbourne, Australia
Contact:

Post by jhmckeever »

1. That approach for deleting the file on your DS server is fine.

2. To delete the file on the remote machine you can use the Telnet properties in the FTP stage:

Code: Select all

Telnet Prompt 1      Login
Telnet Reply 1       {youraccount}
Telnet Prompt 2      Password
Telnet Reply 2       {yourpassword}
Telnet Prompt 3      $
Telnet Reply 3       rm {path}/{file}
You'll need to set Prompt 3 to whatever prompt you get when you Telnet to that server using the supplied account. Remember you can use job parameters for any of these properties.

J.
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
stivazzi
Participant
Posts: 52
Joined: Tue May 02, 2006 3:53 am

Post by stivazzi »

i tried that, but my doubts are :
1- remote machine is a windows machine... should i use rm or delete?
2- in any case, with both of those commands, Director backs this message: Job jobName has no active stages... what it means? i have a server job with just ftp plugin inside, with no inputs and no outputs...

cannot understand...
thanks
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

1. For the remote machine, use "del" as that is guaranteed to work in Windows.

2. The warning about no active stages is correct - the FTP stage is a passive stage.
Last edited by ArndW on Fri Oct 20, 2006 4:42 am, edited 1 time in total.
jhmckeever
Premium Member
Premium Member
Posts: 301
Joined: Thu Jul 14, 2005 10:27 am
Location: Melbourne, Australia
Contact:

Post by jhmckeever »

Sorry - I've been writing alot of Korn shell script recently and old habits die hard ...

Yes, for Windows you'd submit DEL.
(Ah, yes ... I remember Windows ... popular in the 90's, wasn't it!?)

Arnd - I think that's the second time in as many weeks that you've spotted the deliberate mistake in my post! See you next week :-)

J.
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
stivazzi
Participant
Posts: 52
Joined: Tue May 02, 2006 3:53 am

Post by stivazzi »

i got some problems...
it does not delete anything...
i have rights, path is right, but Director just returns me that warning message about active stage and nothing more... and no action is taken
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

jhmckeever wrote:...Arnd...J.
I don't know if I noticed anything wrong, since so many Windows machines now have MKS toolkit or similar extensions and thus the "rm" command is pretty much standard.
Are we going to meet next week??
jhmckeever
Premium Member
Premium Member
Posts: 301
Joined: Thu Jul 14, 2005 10:27 am
Location: Melbourne, Australia
Contact:

Post by jhmckeever »

Probably - I'm anticipating that we'll meet in this forum when you correct next week's deliberate mistake. :)
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

stivazzi wrote:i have rights, path is right, but Director just returns me that warning message about active stage and nothing more... and no action is taken
And what message would 'that warning message' be exactly? Please post it.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Craig - he is getting a warning that his job has no active stages. His job has no active stages.
Last edited by ArndW on Fri Oct 20, 2006 7:17 am, edited 1 time in total.
stivazzi
Participant
Posts: 52
Joined: Tue May 02, 2006 3:53 am

Post by stivazzi »

just saying "Job jobName has no active stages"... but you told me that's not a problem...
but i would expect for example a message like "connecting to ftp"... or am i wrong?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ok... there's no reason for the job to throw those.... necessarily. I assume there are no stages on the canvas, so the issue would be the fact that all there is 'code wise' is a before/after subroutine call. That's the only time I recall seeing that warning.

:idea: What I do is code directly in the Job Control tab instead when I need to do stuff like that - run O/S commands or scripts, for example - and it avoids having this warning every time the job runs.
-craig

"You can never have too many knives" -- Logan Nine Fingers
stivazzi
Participant
Posts: 52
Joined: Tue May 02, 2006 3:53 am

Post by stivazzi »

i don't mind of "no active stages" messages, if it's not a problem...
i cannot understand what does not allow me to delete my file..
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Me personally, I think a job that logs any warnings or errors is a problem. :wink:

How exactly are you doing this? Add 'logging' information to it so you can get some idea where the problem lies...
-craig

"You can never have too many knives" -- Logan Nine Fingers
stivazzi
Participant
Posts: 52
Joined: Tue May 02, 2006 3:53 am

Post by stivazzi »

i have 1 server job with an ftp stage inside... and just that!
in ftp stage properties i have parameters as you told me before...
server name: <myFTPServer>
remote FTP Port: <myFtpPort>
User Name : <FtpUser>
User Password : <FtpPwd>
telnet prompt 1 : login
telnet reply 1 : <FtpUser>
telnet prompt 1 : pwd
telnet reply 1 : <FtpPwd>
telnet prompt 1 : file to delete
telnet reply 1 : /folder/subfolder/filename (no C:/.... could this be a problem? hope no)

when starting job, only logging message on Director is "Job DeleteFileOnWindowsServer has no active stages"


should i have some stages more?
should i define pathName with C:/allPath/fileName ?
Post Reply