How to read the file in routines

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
monaz
Participant
Posts: 98
Joined: Sat Aug 23, 2008 3:14 am

How to read the file in routines

Post by monaz »

Hi Can anyone please guide me how to open a file and read a file in routines,

The routine can be server or parallel routine.

The requirement is that i need to take a parameters from the file1 and use it in the routine.

the routine need to open the file2 and perform some actions by taking file1 parameters and will give us and agrument ouput of file2.

Can please anyone suggest is it possible in routine?

Please help me in proceeding further..
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Post by Kryt0n »

Look up OpenSeq in help files... or search these forums...
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

OpenSeq would be BASIC and thus a 'Server' routine, a parallel routine would need to be in C++. Depending on exactly what is in your file, a simple cat may work to 'read' the file.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Shell script is best in doing this, IMHO.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
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 OpenSequentialFile, a server routine that covers all the possiblilities for opening. Choose the one marked version 4.x. Then research ReadSeq, ReadBlk and CloseSeq statements in the DataStage BASIC manual.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
shalini11
Participant
Posts: 74
Joined: Thu Jan 22, 2009 3:00 am

Post by shalini11 »

May be this can be of little hepl to you

Code: Select all

OPENSEQ filename TO filevar Then
Loop
            ReadSeq ln From filevar Else Exit      
            filetxt = ln
         Repeat
CloseSeq filevar
Post Reply