Read in One Record and Write out Multiple Records

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
jo8712
Participant
Posts: 12
Joined: Tue Nov 04, 2003 7:41 am

Read in One Record and Write out Multiple Records

Post by jo8712 »

I need to know of an alternate way to read in one record and write out multiple records. Currently, I read in the record and write out to 10 dirfferent sequential files, merge the files, and then load my table. I have to do this for over 1000 records. Any ideas.
crouse
Charter Member
Charter Member
Posts: 204
Joined: Sun Oct 05, 2003 12:59 pm
Contact:

Post by crouse »

There's probably a thread or two on this topic... but in a nutshell:
1. Create a routine to accept the one row.
2. Do work to it that creates the multiple rows.
3. Concatenate the multiple rows together, ending each row with the appropriate CHAR value to represent end-of-line (EOL) for the target system. (UNIX EOL is LF, DOS is CR LF).
4. Assign the concatenated string to Ans in your routine and write it out the link to the sequential flate file stage.
5. Make sure the flat file stage is set up with no line termination, no column seperator (000), no quote charater (000).

I know this is kinda cryptic, but other threads explain it also.
Craig Rouse
Griffin Resouces, Inc
www.griffinresources.com
GavMagill
Participant
Posts: 14
Joined: Sun Mar 28, 2004 2:43 pm
Location: Auckland, New Zealand

Post by GavMagill »

Something else worth trying is to write your single records out to a work table in a database, then do a SQL select on the working table with a cross join to another working table with 10 rows in it. This effectively multiplies the input rows by 10. Have used this method in the past with success.
Gavin Magill
ETL Developer
+6427 291 0525
Post Reply