Page 1 of 1

Read in One Record and Write out Multiple Records

Posted: Thu Apr 22, 2004 12:19 pm
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.

Posted: Thu Apr 22, 2004 12:53 pm
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.

Posted: Thu Apr 22, 2004 10:38 pm
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.