How do I append a file today and overwrite it tomorrow?

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
joycerecacho
Participant
Posts: 298
Joined: Tue Aug 26, 2008 12:17 pm

How do I append a file today and overwrite it tomorrow?

Post by joycerecacho »

Hi everybody.

I would like to have some tips about a case I have in my project.

I need to read a database daily, several times per day, and during the day I need to 'append' a file with these data and, when the day changes, the file must be overwritten and then start to 'append' it again.

PS. I can't create different files - one per day. The file must be the same: with the same name. We just overwrite it according to the date changing.

How can I make this control?

Thanks my friends.

Best regards,
Joyce A. Recacho
São Paulo/SP
Brazil
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Sounds like you need a "pre-process" to delete the file when the day changes, then the job can simply overwrite each time.
-craig

"You can never have too many knives" -- Logan Nine Fingers
FranklinE
Premium Member
Premium Member
Posts: 739
Joined: Tue Nov 25, 2008 2:19 pm
Location: Malvern, PA

Post by FranklinE »

Hi Joyce.

What is behind the requirement that the file have the same name every day? My assumption for the rest of this post is that it is used by a subsequent job or process.

I have a similar situation in the other direction. I overwrite the same initial file every day, then have a process that makes a final edit to it, but the edited file has a unique name every day (current date in the file name).

I don't know if this will help, but one way to approach this:

Append to a uniquely named file each day. The current date is a handy way to do that. At the end of the day, copy it to the "must be the same name" file for further processing, and delete the current-date file when that is done.

Edit: Or what Craig suggested. :oops:
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson

Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
Post Reply