XML Output Stage File Name Split

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
MrBlack
Participant
Posts: 125
Joined: Wed Aug 08, 2012 8:57 am

XML Output Stage File Name Split

Post by MrBlack »

Does anyone know if it's possible when outputting xml to a file to control what the file name is going to be when you split it? All my tests show that it just starts appending 1...99 to whatever root name I give it.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That's how it works.

My 'workaround' in the past was a post-process that renamed all of the split instances with the names that I needed them to be.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Been pondering this and I believe that new environment variables may have been added to control this, at least to some degree. Let me see what I can find, or perhaps Ernie will stop by.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

OK, found what I was thinking. Check the XML Pack Guide pdf and the Writing output to your file system section of Chapter 4. You'll see mention of these 'column index flags' there:

%% Column position, starting with zero (0)
%@ Column names

The latter may help you.
-craig

"You can never have too many knives" -- Logan Nine Fingers
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

I've also played games with using a Server Job and sending the split xml content downstream as individual rows to a folder stage. Been awhile, so I don't remember how flexible it is, but the folder stage has a few ways to create multiple files also.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

...and if you are reading this and using 9.1, the Sequential Stage introduced an ability to write to multiple files based on a break of some kind, similar to the trigger in the xmlOutput Stage, so you could send you content on each row and then use a Sequential Target (in 9.1 and above).

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
MrBlack
Participant
Posts: 125
Joined: Wed Aug 08, 2012 8:57 am

Post by MrBlack »

I think going from the XML Output to a Folder stage is probably the right track. I read too the documentation mentioning the use of %% and %@. When I connected a folder stage I started getting mapping errors on my job. I'm probably not using the Folder Stage correctly. Because the input on the XML is all my tags but what should the output columns on the XML stage be? wouldn't it just be one column that would be the data stream that becomes a file?

If I try and use the %% or %@ on the XML stage without an output throws an error and that is why I think I need to output the XML to the folder stage.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

On the output link of your xmlOutput Stage have just one single column....make it a longvarchar with a length of (say) 99999 and put a single "/" in the Description property. That will send your entire manufactured xml content downstream in a single column on a single row (assuming you choose the aggregate option for the Stage).

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Post Reply