setting a new line with WRITESEQ

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
jshurak
Participant
Posts: 74
Joined: Mon Jan 09, 2006 12:39 pm

setting a new line with WRITESEQ

Post by jshurak »

I have the following code:
message = message:char(10):JobName:"|":messagebody:"|":StartTime

OPENSEQ "G:\DataStage\Incoming\jeff.txt" TO FILE
ELSE CREATE FILE ELSE ABORT
WEOFSEQ FILE
WRITESEQ message TO FILE ELSE STOP
The message is the job name, last run status and start time.

I'd like this to handle multiple jobs, but when it loops around to handle the next job it concates the new message to the old message (previously written to the "jeff" text file. I have the message variable cleared so it starts fresh with the new job, but the problem is that it writes to a single row in the text file. Is there a way to specify a new line when the job loops?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

When you open a file for writing it positions itself to the beginning of the file. If you wish to append to the file on a subsequent run you need to issue a "SEEK FILE,0,2" to position to offset 0 relative to the end of the file.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Search the forum for a routine called OpenSequentialFile which contains ALL of the permutations.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply