Loop in Transformer
Moderators: chulett, rschirm, roy
Loop in Transformer
Hi All
I am trying to convert one seq file let say SRC.txt to TGT.txt.
SRC structure is
Name Age Count
AA 32 4
BB 21 2
TGT structure (No. of rows are depend upon the 'Count' Value)
Name Age
AA 32
AA 32
AA 32
AA 32
BB 21
BB 21
Can any one through some light how can i achieve this.
I dont want to write routine for this.
Thanks
Him
I am trying to convert one seq file let say SRC.txt to TGT.txt.
SRC structure is
Name Age Count
AA 32 4
BB 21 2
TGT structure (No. of rows are depend upon the 'Count' Value)
Name Age
AA 32
AA 32
AA 32
AA 32
BB 21
BB 21
Can any one through some light how can i achieve this.
I dont want to write routine for this.
Thanks
Him
Him
There is no direct stage in datastage to do this. You have to write basic code to read the sequential file and then use the loop to write to a new sequential file
I will be interested to see if there is any other simple way of doing this
There is no direct stage in datastage to do this. You have to write basic code to read the sequential file and then use the loop to write to a new sequential file
I will be interested to see if there is any other simple way of doing this
Regards
Siva
Listening to the Learned
"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar
Siva
Listening to the Learned
"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar
-
- Participant
- Posts: 437
- Joined: Fri Oct 21, 2005 10:00 pm
-
- Participant
- Posts: 437
- Joined: Fri Oct 21, 2005 10:00 pm
His profile says server and the forum is PX, just want to make sure what the real basis of this requirement.
Keith Williams
keith@peacefieldinc.com
keith@peacefieldinc.com
I wasn't thinking about stage variables for this. Was wondering if there is a known upper limit to the count then you could simply have that number of output links from the transformer and constrain the output based on the count such that each record went down the first n links. Then a Link Collector to gather them all up. Not pretty but...
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 28
- Joined: Mon Jan 09, 2006 1:31 pm
Hi,
As long as you are going to write the output to a sequential file it is very simple. Assume that your field delimiter is tab and record delimiter is new line. What you have to do is create a output stage with only one field and the field value will be
In the output stage, you make sure that record delimter is blank. Otherwise there will be empty records also.
As long as you are going to write the output to a sequential file it is very simple. Assume that your field delimiter is tab and record delimiter is new line. What you have to do is create a output stage with only one field and the field value will be
Code: Select all
fld = Str(link.Name:'\t':link.Age:'\n',link.Count)
With regards,
Thiru
Thiru
Hi Thiru,reachthiru wrote:Hi,
As long as you are going to write the output to a sequential file it is very simple. Assume that your field delimiter is tab and record delimiter is new line. What you have to do is create a output stage with only one field and the field value will be
In the output stage, you make sure that record delimter is blank. Otherwise there will be empty records also.Code: Select all
fld = Str(link.Name:'\t':link.Age:'\n',link.Count)
Not sure what you trying to explain, Again this will create one record per input record and not the loop activity
Is that you trying to explain to addup four such stage variable?
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
-
- Participant
- Posts: 28
- Joined: Mon Jan 09, 2006 1:31 pm
-
- Participant
- Posts: 15
- Joined: Tue Apr 20, 2004 3:10 am
Re: Loop in Transformer
Hi
In this case you need to use a buil-op (custom stage) to do this. If the data is small then you can go for a unix script but if the data is huge then build-op is the right option.
Thanks
Malla
In this case you need to use a buil-op (custom stage) to do this. If the data is small then you can go for a unix script but if the data is huge then build-op is the right option.
Thanks
Malla