Create output file names based on data in a column

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

PAULOM
Participant
Posts: 33
Joined: Thu Jul 11, 2013 2:03 am

Post by PAULOM »

I do not understand very well,

So that the Stage Folder works, I have to put all my lines in a single column and a single row.

Do I have to a Stage Variable to transform it (how can it be done?), add Aggregator? To put all this in a Routine?

Thank you for helping me.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That's the problem - "all my lines". Ray responded as he did because you said you needed your output to be:

1;2;3;4;5;6;8

You showed a subset of your input fields in the output. Everything before this point assumed a simple concatenation of one record to the next without any 'intelligence' in the process, meaning you should send to the Folder stage:

1;2;3;3;4;5;6;7;8

Based on your sample input. Are you certain that is really what you need? Or is that a typo? Nothing in the conversation up to this point indicated a need for any such thing and it's certainly not a requirement for the Folder stage, hence the question.

Now, to further add to your confusion, you actually need a single row that includes all of the records that the Folder needs to write out. Meaning you need to add record delimiters (not just the data) to the work you do in the stage variable. On Windows that would be a <CR><LF> pair while on UNIX you just need a <LF> between the records:

1;2;3<CR><LF>3;4;5<CR><LF>6;7;8

Use a stage variable with the proper initial value and no derivation so it is a constant during the run. Set the initial value to CHAR(13):CHAR(10) for Windows.
-craig

"You can never have too many knives" -- Logan Nine Fingers
PAULOM
Participant
Posts: 33
Joined: Thu Jul 11, 2013 2:03 am

Post by PAULOM »

Chulett it's possible to send you my dsx?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Wouldn't help, I have no DataStage access so couldn't do much with it. Working on my fourth year using another ETL tool... I just do this for the fun. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
PAULOM
Participant
Posts: 33
Joined: Thu Jul 11, 2013 2:03 am

Post by PAULOM »

Ok it's a pity!
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can post images on an image server and refer to them here. But do try to answer the questions we've asked as completely as possible.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
arunkumarmm
Participant
Posts: 246
Joined: Mon Jun 30, 2008 3:22 am
Location: New York
Contact:

Post by arunkumarmm »

I guess his output to be a typo, as he even missed '7'.

If my guess is right, you can have your stage variable as below:

StagVar1: StagVar1 : ';' : ColumnA : ';' : ColumnB : ';' : ColumnC
StagVar2: Trim(StagVar1,';',"L")

set you stage variable's initial value as Empty ( '' )

Assuming that your column values will not be null or empty

And if you have problem working with Aggregators, you can just write your output to a Hashed file with a dummy key column with a static value, say '1' and then pass it on to the folder from hashed file.
Arun
Post Reply