single source record need load two records in the target

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
arvind
Participant
Posts: 17
Joined: Sun Aug 07, 2005 7:57 am

single source record need load two records in the target

Post by arvind »

Hi,
I want to know how to load 2 records in to the target from single source record.
Eg.
Source columns
A B C D E
Source records
123 AAA 2354 4656 bbb
234 BBC 8762 9876 ddd
Target columns
A B C D E
Target Records
123 2354 4656 bbb
123 AAA 2354 4656 bbb
234 8762 9876 ddd
234 BBC 8762 9876 ddd

In the target I need to load two records for ever source record.
First record of the every target record for the Value A, column B value should be NULL.
Second record of the every target record for the value A is a direct pass through, ie it looks exactly same as source record.
Please help me in writing the above logic.
Thanks in advance
Arvind
ucf007
Charter Member
Charter Member
Posts: 18
Joined: Fri Feb 27, 2004 2:25 pm

Post by ucf007 »

a transformer with 2 outputs will do the job, selecting the right metadata...
arvind
Participant
Posts: 17
Joined: Sun Aug 07, 2005 7:57 am

Post by arvind »

Hi All,
Thanks ucf007,
Eg.
Source columns
A B C D E
Source records
123 AAA 2354 4656 bbb
234 BBC 8762 9876 ddd
Target columns
A B C D E
Target Records
123 2354 4656 bbb
123 AAA 2354 4656 bbb
234 8762 9876 ddd
234 BBC 8762 9876 ddd

I want the out put in single target file with two records with the above logic.
for one source record i need to load two records with the above logic in the same target file.

Thanks in Advance
Arvind
alokkum
Participant
Posts: 8
Joined: Tue Aug 03, 2004 7:16 pm

Post by alokkum »

You got a right answer, a transformer with 2 outputs will do the job, selecting the right metadata...
Use 2 links writing to the same dataset
arvind wrote:Hi All,
Thanks ucf007,
Eg.
Source columns
A B C D E
Source records
123 AAA 2354 4656 bbb
234 BBC 8762 9876 ddd
Target columns
A B C D E
Target Records
123 2354 4656 bbb
123 AAA 2354 4656 bbb
234 8762 9876 ddd
234 BBC 8762 9876 ddd

I want the out put in single target file with two records with the above logic.
for one source record i need to load two records with the above logic in the same target file.

Thanks in Advance
Arvind
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There are other solutions, but the Transformer stage with two outputs will be the easiest to implement, and is correct. Simply map the columns required on each output using drag and drop. You could do the same with a Copy stage with two outputs.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

If you are writing to a sequential output file you can funnel both your output links back together again. They should have the same column metadata.
htrisakti3
Charter Member
Charter Member
Posts: 36
Joined: Thu Jun 10, 2004 11:22 pm

Post by htrisakti3 »

looking at your example, you want to:
1. read source fields: A B C D E
2. write to
A C D E
A B C D E

I'd simply read the file twice (2 output links) --> hash (to enable multiple write at the same time)

Code: Select all

         Hash1          
text --> A C D E    --> sort --> text-out
     --> A B C D E   
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

vmcburney wrote:If you are writing to a sequential output file you can funnel both your output links back together again. They should have the same column metadata.
Hi,
what happens if two individual seq stages with append mode... :roll:

regards
kumar
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Nothing, except maybe an abort.

Operating system rules prohibit more than one writer to a sequential file.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

Assuming you have columns A B C D E on both transformer output links where column B is null on the first link you can use the funnel stage to turn it back into a single stream and write it to a sequential file.
arvind
Participant
Posts: 17
Joined: Sun Aug 07, 2005 7:57 am

Post by arvind »

Hello All,
Thanks to eveybody who replied my question.

I created two output's where in one link i gave column B as null,
Using funnel stage I created the sequential file with desired output.


Thanks and Regards
Arvind
Post Reply