datastage script(basic)

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
ravindrag
Participant
Posts: 40
Joined: Wed Dec 14, 2005 3:22 am

datastage script(basic)

Post by ravindrag »

I want to extract records from a flat file using datastage script(basic).Can anyone PLease Post The Script?
Kirtikumar
Participant
Posts: 437
Joined: Fri Oct 15, 2004 6:13 am
Location: Pune, India

Post by Kirtikumar »

You can use the normal basic functions like OpenSeq, ReadSeq which can be used to read the data from the seq file.

I doubt if you will get the whole code for doing this from someone. You may have to try certain things on your own and if you get stuck, you can post here.
HTH.
Regards,
S. Kirtikumar.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Ravindrag,

Are you sure you want to do this? The DataStage Sequential file stage does this in a quick, simple and understandable manner. If you really wish to write a script you will find many examples in this forum using search.
The main components will be:
- OPENSEQ to open the sequential file
- READSEQ to read a record on an opened file
- CLOSESEQ to close the file handle when finished
- A "FOR / NEXT" or "LOOP / UNTIL" construct or {I don't like this way} using "IF / GOTO".
rameshrr3
Premium Member
Premium Member
Posts: 609
Joined: Mon May 10, 2004 3:32 am
Location: BRENTWOOD, TN

Post by rameshrr3 »

Code: Select all

OpenSeq PathName To F.Var Then
Loop
ReadSeq Dummy From F.Var Else Exit ;* at end-of-file
Repeat
WriteSeq ReportText To F.Var Else
Call DSLogFatal("Cannot write to ":PathName, "MyRoutine")
End
End Else
Call DSLogFatal("Cannot open file ":PathName, "MyRoutine")
End
Above code fragment is to write to seq file a string
in append mode.
Why dont you use a sequential file stage to read from file?
rameshrr3
Premium Member
Premium Member
Posts: 609
Joined: Mon May 10, 2004 3:32 am
Location: BRENTWOOD, TN

Post by rameshrr3 »

Reminds me of a seemingly crazy requirement to write a custom 'log file', apparantly for 'easy readability', as if the data stage director log is in hex. :lol:
ravindrag
Participant
Posts: 40
Joined: Wed Dec 14, 2005 3:22 am

Post by ravindrag »

Thank you very much guys...
Post Reply