Same sequential file as the source and the target

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
prajish_ap
Participant
Posts: 11
Joined: Tue Nov 21, 2006 3:08 am
Location: Pune

Same sequential file as the source and the target

Post 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...

:)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
prajish_ap
Participant
Posts: 11
Joined: Tue Nov 21, 2006 3:08 am
Location: Pune

Post 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...
reddy.vinod
Participant
Posts: 36
Joined: Mon Jul 16, 2007 3:37 am
Location: USA

Re: Same sequential file as the source and the target

Post 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.
VINOD
prajish_ap
Participant
Posts: 11
Joined: Tue Nov 21, 2006 3:08 am
Location: Pune

Re: Same sequential file as the source and the target

Post 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.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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.
prajish_ap
Participant
Posts: 11
Joined: Tue Nov 21, 2006 3:08 am
Location: Pune

Post 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 ... :)
DSDexter
Participant
Posts: 94
Joined: Wed Jul 11, 2007 9:36 pm
Location: Pune,India

Post by DSDexter »

Is this a Interview question :?: :shock:
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
mcs_suman
Participant
Posts: 20
Joined: Thu Sep 27, 2007 8:42 am
Location: chennai
Contact:

Re: Same sequential file as the source and the target

Post by mcs_suman »

you can do this by after job subroutine.

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


cat temp file>sequentialfileA .


if your satisfied reply .
suman
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I don't know about anyone else, but man am I ever satisfied! [ahhhh]
-craig

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