Page 1 of 1

Writing into a text file

Posted: Tue Jun 03, 2008 9:34 am
by dstage443
I need to write some predefined/static text and also some variables such as DSgetlinkinfo and someother parameter values into the File.

what are the functions to write into a sequential file. .... how can this be done

Posted: Tue Jun 03, 2008 9:46 am
by chulett
Why not just create a job to do this for you?

Posted: Tue Jun 03, 2008 9:47 am
by Krazykoolrohit
Craig,

I think he wants information on how to create that job. I was about to write "read the manuals" but i held myself up.

Posted: Tue Jun 03, 2008 9:52 am
by chulett
Well, there are functions (OPENSEQ,WRITESEQ,etc) but wondering if that's really what is wanted here or if a simple job would do the trick.

Posted: Tue Jun 03, 2008 10:04 am
by dstage443
well thanks for the replies .... i am reading the books but i am not even half way through ....

Posted: Tue Jun 03, 2008 10:10 am
by chulett
Ok. What exactly do you need help with, where are you stuck? Building the job? Hand coding something in BASIC using functions?

Posted: Tue Jun 03, 2008 7:17 pm
by dstage443
but wher do you actually write the code so that i can execute this code in datastage so that it will write into my file

OpenSeq "c:\TEST\TEMP.TXT" To TestVar Then
WeofSeq TestVar ;
WriteSeq "test line -- writing a line into file" To TestVar;

Posted: Tue Jun 03, 2008 7:21 pm
by ray.wurlod
In a Routine. Probably in a before/after or job control routine.

DataStage BASIC Notes
1. Lines do not require a ";" terminator.
2. "Then" or "Else" on the end of a line open a block of statements that must be terminated by an "End" statement.

Tip
Track down the OpenSequentialFile() function (search DSXchange) which covers some of the issues that your code doesn't, such as opening a file for writing when the file does not yet exist.