Sequential File stage

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
dsdeveloper123
Participant
Posts: 33
Joined: Sun Jun 24, 2007 9:46 pm

Sequential File stage

Post by dsdeveloper123 »

Hi..

I have a scenario where in I have to reading 4 files and transform them and then load it into a single file.

My problem is the job loads only data from one file. It doesn't throw any error but rather than loading 30 records each from 4 files it loads only data from one file. I have checked append to file option also.

Can anyone help me locate where I am going wrong.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

How, exactly, are you "reading 4 files" in your Server job?
-craig

"You can never have too many knives" -- Logan Nine Fingers
dsdeveloper123
Participant
Posts: 33
Joined: Sun Jun 24, 2007 9:46 pm

Post by dsdeveloper123 »

I am using sequential file stage to read as well as to write the file
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Not nearly enough information. :?

How did you setup the stage to 'read 4 files'?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post by Maveric »

Is there any similarity between the file names? If so then you can probably use a wild character to read all the files. Example f1.txt, f2.txt, f3.txt. then you can use f*.txt. But for this the meta data for the files should be the same. Just make sure there are no other files in the folder with the same name pattern.
"I have checked append to file option also" This is in the target. but your problem is in the source stage. Try this and see if it will work.
dsdeveloper123
Participant
Posts: 33
Joined: Sun Jun 24, 2007 9:46 pm

Post by dsdeveloper123 »

sorry ..
:oops:

I have four sequential file to read data from 4 files. Each file I apply different transformation and output from the transformer is sent to a single file stage.

4 sequential file stage(Input) --> 4 transformer stage (for each file)--->1 sequential file stage(output)

My problem is my final output sequential file has data only from the one file.

Hope I am clear now :shock:
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That's what I was afraid of. You need to understand that sequential files need to be accessed sequentially, it's the nature of the beast. This means while a sequential file can support multiple reader processes, it can only support a single writer process.

This is not a 'DataStage restriction', it is a sequential file restriction regardless of platform or application. You may end up with one file's worth or a mixture in your output file when all is done, and the setting of the 'Append' option doesn't help here at all.

So, you'll either need to process the four files one at a time and append each to the previous one or write to four different files and then concatenate the results together 'after job' to build your final file.

ps. The latter is a very typical solution to this 'problem' and is the easiest to arrange.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post by Maveric »

Put in a link collector before the sequential file stage. collect the data and then write it into the sequential file.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That can work as well. I tend to forget out the 'Link' stages, the Collector will allow the creation of your single writer process. I find the extra overhead of needing to use the 'Sort/Merge' option if you care about the output order to not be worth it, however.

But that's a personal preference. Use whatever works for you.
-craig

"You can never have too many knives" -- Logan Nine Fingers
dsdeveloper123
Participant
Posts: 33
Joined: Sun Jun 24, 2007 9:46 pm

Post by dsdeveloper123 »

Thank u chulett ..
I had not thought in this direction. :oops:


I tried using Link collector but I get a compilation error

"Link Collector stage does not support in-process active-to-active inputs or outputs"
Minhajuddin
Participant
Posts: 467
Joined: Tue Mar 20, 2007 6:36 am
Location: Chennai
Contact:

Post by Minhajuddin »

Click on the job properties and..

In the Job properties ........

Uncheck the Project defaults checkbox

And click on the second radio button.. (I think it's Inter process)

Then the compilation warning should go away.
Minhajuddin

<a href="http://feeds.feedburner.com/~r/MyExperi ... ~6/2"><img src="http://feeds.feedburner.com/MyExperienc ... lrow.3.gif" alt="My experiences with this DLROW" border="0"></a>
dsdeveloper123
Participant
Posts: 33
Joined: Sun Jun 24, 2007 9:46 pm

Post by dsdeveloper123 »

Thank You all..

It finally worked.. :D
I did as u suggested
Post Reply