Writing into a text file

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
dstage443
Participant
Posts: 10
Joined: Wed May 28, 2008 4:02 pm

Writing into a text file

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Why not just create a job to do this for you?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Krazykoolrohit
Charter Member
Charter Member
Posts: 560
Joined: Wed Jul 13, 2005 5:36 am
Location: Ohio

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
dstage443
Participant
Posts: 10
Joined: Wed May 28, 2008 4:02 pm

Post by dstage443 »

well thanks for the replies .... i am reading the books but i am not even half way through ....
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ok. What exactly do you need help with, where are you stuck? Building the job? Hand coding something in BASIC using functions?
-craig

"You can never have too many knives" -- Logan Nine Fingers
dstage443
Participant
Posts: 10
Joined: Wed May 28, 2008 4:02 pm

Post 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;
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
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