Page 1 of 1

setting a new line with WRITESEQ

Posted: Mon Aug 14, 2006 7:54 am
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?

Posted: Mon Aug 14, 2006 8:00 am
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.

Posted: Mon Aug 14, 2006 10:16 pm
by ray.wurlod
Search the forum for a routine called OpenSequentialFile which contains ALL of the permutations.