file should be cleared after taking values from the file

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

Post Reply
rajiivnb
Participant
Posts: 77
Joined: Fri Sep 10, 2004 8:38 am
Location: India

file should be cleared after taking values from the file

Post by rajiivnb »

Hi,
I have certain values from a flatfile to be moved to a table and once it is moved i should be able to clear the file for next process.How could this be made possible.

Thanks in advance.
Regards,
Rajiivnb
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Rajivnb,

do you mean you want to clear the flatfile after you have finished loading the data to the table?

In that case, use an after-job routine that executes a shell command to delete the file - you can specify the shell command in the job properties.
rajiivnb
Participant
Posts: 77
Joined: Fri Sep 10, 2004 8:38 am
Location: India

Post by rajiivnb »

Hi Arnd,
That was really Helpful.Is it possible for you to pass me a shell command that the way to invoke the command in the after routine.

Regards,
Rajiivnb
vigneshra
Participant
Posts: 86
Joined: Wed Jun 09, 2004 6:07 am
Location: Chennai

Post by vigneshra »

Rajiv
It's quite simple! You can use a shell command as an after job subroutine like echo '' > File1. Care should be taken to set the option that this command should execute only if the job completes successfully or otherwise you will lose your file.
Alternatively you can also achieve this by calling the same command after the job successfully executes from the shell script itself which you are using to run your job. Hope it is clear for you!
Thanks!
Vignesh.

"A conclusion is simply the place where you got tired of thinking."
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

In Unix, 'rm #pFILENAME#' where pFILENAME is your parameter to hold the file name.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:idea: I prefer to archive files of this type rather than simply removing them. This could be accomplished using the 'mv' command rather than 'rm', but you'd typically want to take an extra step to 'timestamp' the file as well in a script.

We also use tar and compress to periodically create 'tar balls' of files like this to help manage the storage of them.

Food for thought.
-craig

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