Updating a Sequential File

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
chandra.shekhar@tcs.com
Premium Member
Premium Member
Posts: 353
Joined: Mon Jan 17, 2011 5:03 am
Location: Mumbai, India

Updating a Sequential File

Post by chandra.shekhar@tcs.com »

Hi,

Is there any way/logic to update records in a Sequential File ?
Thanx and Regards,
ETL User
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

The short answer is no. You read in the file, update whatever needs updating and then write the result out to a new file. Of course, you could rename the new back to the old when you are done.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chandra.shekhar@tcs.com
Premium Member
Premium Member
Posts: 353
Joined: Mon Jan 17, 2011 5:03 am
Location: Mumbai, India

Post by chandra.shekhar@tcs.com »

I am too doing the same, but I thought better to ask than regret later. :wink:
Thanx and Regards,
ETL User
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That's the nature of sequential media.

You may be able to do something magical under the covers with C or something similar but for a "pure" DataStage solution there's no magic that I've ever seen. Of course, our resident Magician may say otherwise. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I do this a lot when updating values files of Parameter Sets.

One approach is to overwrite the file entirely, using a Sequential File stage. That's the way I normally do it, particularly when the number of parameters in the Parameter Set is small.

The other is to use a Hashed File stage in a server job, opening the file's parent directory as if it were a table, and treating the file name as a record key. This having been done, the individual "fields" (lines) can be updated.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ah... the second part is where the magic happens. :wink:
-craig

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