Generate many output records from 1 record

Archive of postings to DataStageUsers@Oliver.com. This forum intended only as a reference and cannot be posted to.

Moderators: chulett, rschirm

Locked
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Generate many output records from 1 record

Post by admin »

Hi,
How to generate many output records to the same text file from 1 input record. Such as I have 1 record "A" and I want to generate 2 records "A","1" and "A","2". I try to do this but I have problem because if I have 2 links from 1 transformer stage to sequential stage. It will generate only 1 record depends on order or link which is the last process link.

Regards,
Direk
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Post by admin »

I have a job that does that except Im writing the multiple records to a table using an OCI. I changed the OCI to a sequential file and got the same results you did, even when I set it to append to file. Maybe you can write to multiple sequential files and then merge them.

Kenny


-----Original Message-----
From: Direk Phaisitwanitkul [mailto:DirekP@dtac.co.th]
Sent: Friday, August 10, 2001 10:26 AM
To: datastage-users@oliver.com
Subject: Generate many output records from 1 record


Hi,
How to generate many output records to the same text file from 1 input record. Such as I have 1 record "A" and I want to generate 2 records "A","1" and "A","2". I try to do this but I have problem because if I have 2 links from 1 transformer stage to sequential stage. It will generate only 1 record depends on order or link which is the last process link.

Regards,
Direk
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Post by admin »

I have routines where I need to write a rejected record from potentially 4 different points in a job. I write to the same hashed file stage from each of the 4 (Transformer) points. Then, in a parent "driver" job (which calls this one via Job Control and therefore runs the dependent job before its own active stages), I read the hashed file of accumulated rejected records and write it sequential output.

I think you could use the idea of a hashed file as an intermediate landing place for your data as long as the column structure of the many output records is all the same. I would think you could have one Transformer stage with multiple outputs (each with different constraints). Each of those outputs goes to the same exact named hashed file. Then, in a driver
(parent) job, write the hashed file to a sequential one.

If you go this route, I suggest creating/clearing the hashed file you use in the "child" or dependent job in that jobs Job Control. I think it would yield unpredictable behavior if you tried to use Create File or other options within the Universe hashed file stages themselves, since I would guess there is no predicting in which order those stages are first initialized or "opened for business."

Tracy Slack
Harland Financial Solutions
tslack@harlandfs.com

-----Original Message-----
From: Direk Phaisitwanitkul [mailto:DirekP@dtac.co.th]
Sent: Friday, August 10, 2001 10:26 AM
To: datastage-users@oliver.com
Subject: Generate many output records from 1 record


Hi,
How to generate many output records to the same text file from 1 input record. Such as I have 1 record "A" and I want to generate 2 records "A","1" and "A","2". I try to do this but I have problem because if I have 2 links from 1 transformer stage to sequential stage. It will generate only 1 record depends on order or link which is the last process link.

Regards,
Direk


---------------------------------
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Post by admin »

The Pivot stage supports functionality whereby you can wirte multiple output from a single input. The only caveat is that your input data must conform to some pivot rules. You might be able to fool around with this a little to get it to do what you want (in your example, send your data to a transformer where you create two new fields with values 1 and 2. Send this data to the pivot stage where you pivot on these two new fields).
Hope that help
---Tony
"Salstrom, Kenneth" wrote: I have a job that does that except Im writing the multiple records to a table using an OCI. I changed the OCI to a sequential file and got the same results you did, even when I set it to append to file. Maybe you can write to multiple sequential files and then merge them.

Kenny


-----Original Message-----
From: Direk Phaisitwanitkul [mailto:DirekP@dtac.co.th]
Sent: Friday, August 10, 2001 10:26 AM
To: datastage-users@oliver.com
Subject: Generate many output records from 1 record


Hi,
How to generate many output records to the same text file from 1 input record. Such as I have 1 record "A" and I want to generate 2 records "A","1" and "A","2". I try to do this but I have problem because if I have 2 links from 1 transformer stage to sequential stage. It will generate only 1 record depends on order or link which is the last process link.

Regards,
Direk


---------------------------------
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Post by admin »

There are at least four ways to accomplish this. Exactly which is most appropriate depends on exactly what you are trying to do. In particular, what is the rule that generates the "1", "2", etc.?

If its just the two that you specify, try writing to a single sequential file a single column containing "A,1":EOL:"A,2", where EOL is the appropriate end-of-line for your operating system (Char(13) for UNIX,
Char(13):Char(10) for Windows NT). Make sure that the sequential file stage specifies 000 as the delimiter.

-----Original Message-----
From: Direk Phaisitwanitkul [mailto:DirekP@dtac.co.th]
Sent: Saturday, 11 August 2001 00:26
To: datastage-users@oliver.com
Subject: Generate many output records from 1 record


Hi,
How to generate many output records to the same text file from 1 input record. Such as I have 1 record "A" and I want to generate 2 records "A","1" and "A","2". I try to do this but I have problem because if I have 2 links from 1 transformer stage to sequential stage. It will generate only 1 record depends on order or link which is the last process link.

Regards,
Direk
Locked