Create file first time and then append to it

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
pdntsap
Premium Member
Premium Member
Posts: 107
Joined: Mon Jul 04, 2011 5:38 pm

Create file first time and then append to it

Post by pdntsap »

Hello,

I have a job that has a start and end loop acitivity and a bunch of steps being repeated n times. I need to create/overwrite an output file when the loop is executed the first time and then append to the same file for subsequent iterations of the loop. What are some of the possible ways of doing this?

Thanks.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Append will create the file if it doesn't exist. But that will also mean it will append to the previous run's file rather than replace it so you'll need an extra step. Before you get into your loop, ensure the file generated by the previous processing run has been deleted.
-craig

"You can never have too many knives" -- Logan Nine Fingers
pdntsap
Premium Member
Premium Member
Posts: 107
Joined: Mon Jul 04, 2011 5:38 pm

Post by pdntsap »

Thanks Craig.

I will implement your suggestion and update my post accordingly.
arunkumarmm
Participant
Posts: 246
Joined: Mon Jun 30, 2008 3:22 am
Location: New York
Contact:

Post by arunkumarmm »

You can also have two identical output stages in your job, pass your counter value as a parameter to determine the start of the loop and have one stage create (Overwrite) the file and the other stage append to the file for subsequent runs by having proper constrains.
Arun
Post Reply