concatenate all the output rows in a variable

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
parvathi
Participant
Posts: 103
Joined: Wed Jul 05, 2006 4:48 am
Contact:

concatenate all the output rows in a variable

Post by parvathi »

hi all,
i have requirement to concatenate all the input records and then only pass it as a single record in to the sequential file.How can i do this?
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Define a stage varialbe say "stgVar" with derivation "stgVar:in.Col". Your output link will have one column defined with the above stage variable as its derivation. The last row will be what you want. You can get that by, either passing it through the aggregator, or doing a tail -1 on the file.
While reading the records, read it as a single value by specifying 000 as delimiter and specifying only one column.

What do you intent to do? The record is going to be one HUGE record.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

What is the source of these records?
The answer can vary with file and database.
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post by I_Server_Whale »

Why not the "Row Merger" Stage?
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Do you really mean all the records, or all the columns? Or one column from all the records? Do you want them delimited, or simply concatenated?

There are many possible solutions, depending upon exact requirements. Most, if not all, will involve one or more stage variables.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
parvathi
Participant
Posts: 103
Joined: Wed Jul 05, 2006 4:48 am
Contact:

Post by parvathi »

I have three columns in one row which are concatenated and there are 5 records which are concatenated with or. Iwas able to concatenate.
the soure is an an OCI stage

The problem is when i don't have any input any records A NULL STRING IS BEING PROCESSED instead OF THE NULL STRING i want to pass a value of 1=2
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

What approach are you using to concatenating the columns?
You can check if the input is not null then pass the value, else pass something else.(1, 2 or whatever you want)
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Is it like you are processing some kind of where class to another database or a script file or something?
After concatenation, check for IsNull(), and assign the required default value.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
parvathi
Participant
Posts: 103
Joined: Wed Jul 05, 2006 4:48 am
Contact:

Post by parvathi »

kumar_s wrote:Is it like you are processing some kind of where class to another database or a script file or something?
After concatenation, check for IsNull(), and assign the required default value.
yes what you said was exactly right.
I have used IsNull() condition but i observed is that once there are records in the input oracle source the transformer stage is not processed at all .Is it reaaly happens like that

When there are no records in the OCI stage the stage varible in the transformer should have a different value .I have tried all the means . BUt the value which i want is never written
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

hi Parvathi,

Sorry, I couldn't get what you exactly mean here.
Do you mean to say, the records are getting reject at transformer or not passing after this stage?
If so check the constraints and metadata options for nullable. If you see the statistics in the input link of the tranformer, and if there is not constraints and and with compatable input/output metadata, rows should be passed to output.
You can explain, more on what are you doing in tranformer, with the condition mentioned.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

If your table is empty then Yes, no records will pass through. You need to incorporate the IsNull() check within the database stage. And send a single row.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply