Page 1 of 1

Same sequential file as the source and the target

Posted: Fri Dec 07, 2007 12:37 am
by prajish_ap
Hi ,

I have a situation wherein I need to use the same Sequential file as the source , do some transformations and then load this data into the same sequential file which will have the updated data for the next run.

Please help...

:)

Posted: Fri Dec 07, 2007 12:45 am
by ray.wurlod
You're in a very bad situation, then. How would you do it with any other software? Seriously - all you can do is write to a temporary file then, once the job has completed, delete the source file and rename the temporary file. Or use different directories.

Posted: Fri Dec 07, 2007 3:51 am
by prajish_ap
ray.wurlod wrote:You're in a very bad situation, then. How would you do it with any other software? Seriously - all you can do is write to a temporary file then, once the job has completed, delete the source file a ...
I thought of this, but I was thinking if this is possible with DataStage...

Re: Same sequential file as the source and the target

Posted: Fri Dec 07, 2007 3:58 am
by reddy.vinod
prajish_ap wrote:Hi ,

I have a situation wherein I need to use the same Sequential file as the source , do some transformations and then load this data into the same sequential file which will have the updated data for the next run.

Please help...

:)
Create 2 jobs ,in first job take one temporary file as target and use same file as source in next job and load into u r original sequential file.

Re: Same sequential file as the source and the target

Posted: Fri Dec 07, 2007 4:02 am
by prajish_ap
reddy.vinod wrote:
prajish_ap wrote:Hi ,

I have a situation wherein I need to use the same Sequential file as the source , do some transformations and then load this data into the same sequential file which will have the updated data for the next run.

Please help...

:)
Create 2 jobs ,in first job take one temporary file as target and use same file as source in next job and load into u r original sequential file.

:)... thanks.... 8) ...but i need to do this in a single job.

Posted: Fri Dec 07, 2007 4:21 am
by ArndW
What the responders have alluded to, but not stated explicitly, is that a sequential cannot be read from and written to at the same time. This has nothing at all to do with DataStage but is an inherent limitation of the sequential file type on all operating systems.

So the suggestions all try to work around that limitation in some manner. I like renaming the original file from X to Y and then writing output from the DataStage job to X, then deleting the file Y when the job finishes successfully. There are many variations on this theme possible. You can use the Before and After job subroutine calls to perform these renaming and deleting options.

Posted: Fri Dec 07, 2007 4:48 am
by prajish_ap
ArndW wrote:What the responders have alluded to, but not stated explicitly, is that a sequential cannot be read from and written to at the same time. This has nothing at all to do with DataStage but is an inherent limitation of the sequential file type on all operating systems.

So the suggestions all try to work around that limitation in some manner. I like renaming the original file from X to Y and then writing output from the DataStage job to X, then deleting the file Y when the job finishes successfully. There are many variations on this theme possible. You can use the Before and After job subroutine calls to perform these renaming and deleting options.
Thanks ...I thought of using the Before and After job subroutine calls to perform the renaming and deleting the file ...but I was told that this can be achieved in some other way too ... So I thought may be if anybody has a different way of working towards this could suggest the same... anyways thank you all for the help ... :)

Posted: Tue Dec 11, 2007 4:31 am
by DSDexter
Is this a Interview question :?: :shock:

Posted: Wed Dec 12, 2007 1:18 am
by ray.wurlod
Well, of course it COULD be done. But you'd only be doing with DataStage what we've already advised.

Code: Select all

SeqFileA -----> SeqFileB -----> SeqFileA
would work

Re: Same sequential file as the source and the target

Posted: Sat Dec 29, 2007 10:02 am
by mcs_suman
you can do this by after job subroutine.

sequentiale fileA---------->transformer--------->temp file


cat temp file>sequentialfileA .


if your satisfied reply .

Posted: Sat Dec 29, 2007 10:46 am
by chulett
I don't know about anyone else, but man am I ever satisfied! [ahhhh]