Folder stage for writting seq file

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
prasad111
Premium Member
Premium Member
Posts: 173
Joined: Fri May 19, 2006 10:53 am

Folder stage for writting seq file

Post by prasad111 »

Hi All,

My input file looks like

ABC|123|lkjlkj|
ABC|453|kljkljluio|
ABC|4454|kjhkjhkjh|
ABC|334|adaf|
DEF|989|jklhkh|
DEF|676|khklkh|
DEF|343|nnjhj|
GHI|234|lhlh|

My output files should look like

CORRECT EXPECTED OUTPUT
file1 - filename ABC
ABC|123|lkjlkj|
ABC|453|kljkljluio|
ABC|4454|kjhkjhkjh|
ABC|334|adaf|

file2 -filename DEF

DEF|989|jklhkh|
DEF|676|khklkh|
DEF|343|nnjhj|

file3 -filename GHI
GHI|234|lhlh|

these are the output files, when I used the folder stage I used to get the file name properly and I was getting only the output like

NOT CORRECT OUTPUT:
file1 - filename ABC
ABC|334|adaf|

file2 -filename DEF
DEF|343|nnjhj|

file3 -filename GHI
GHI|234|lhlh|

I also tried to remove the new line character from the input file it didnot work........please suggest
Last edited by prasad111 on Thu Mar 27, 2008 11:47 am, edited 1 time in total.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

You don't understand how the folder stage works. It creates a file per row under the name of the value in the primary key column. If the row repeats, then you only get the last row. The Folder stage does not write all rows under the same primary key value to the same file.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

And also, please post in the correct forum.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
prasad111
Premium Member
Premium Member
Posts: 173
Joined: Fri May 19, 2006 10:53 am

Post by prasad111 »

Thanks for the reply....
I understand the folder stage is working properly......... is there any way before passing to folder stage, I can convert the data to be read to the required output format....

I was searching the forum for solution.......then I clicked on post new topic..........it took me to here (General)............from next time I will try to post it in correct forum
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

You need to concatenate rows together into a single record for writing out by the Folder stage. The easiest way to do this is going to involve using a Hashed file stage as both a reference and target. The design details are as follows:

You need to convert your source data into two columns - primary key and all of the the columns concatenated together using a column delimiter. You need to write a row to the hashed file using the designated primary key after referencing to see if it's there already. If the row is already there then you need to concatenate the new row to the existing row using an CHAR(13) as a delimiting character.

After the hashed file is fully populated, extract rows from it and send to the Folder stage. The primary key will become the filename and the other column will become the file. Since you compacted multiple rows into one column and have newlines as the delimiter between rows, the file is correctly formatted.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Post Reply