Use @OUTROWNUM as sequential file name suffix

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
richieRich
Premium Member
Premium Member
Posts: 27
Joined: Tue Jan 05, 2010 12:04 am

Use @OUTROWNUM as sequential file name suffix

Post by richieRich »

Hi,

I got stuck this afternoon trying to use @OUTROWNUM as the suffix for my sequential file name.

I have a transformer(TF_HEAD) that links to an xml output file(XML_HEAD) stage that links to a sequential file stage (SF_HEAD).

In TF_HEAD I have a column named FILE SUFFIX which is equal to @OUTROWNUM. I then send this column through the XML_HEAD stage and then try to use it in my SF_HEAD as the file name like this.

File=MESSAGE_#A3_XML_Head.FILE_SUFFIX#.XML

where A3_XML_Head is the name of the link between the xml stage and the sequential file stage. But that does not seem to be working.

I know a similar thing works when you have a job variable. Am I missing something obvious?

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

Post by ray.wurlod »

Job parameters are resolved when the job starts. Until version 9.1 (except for the Folder stage in server jobs) you can't name files based on anything in the data.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
richieRich
Premium Member
Premium Member
Posts: 27
Joined: Tue Jan 05, 2010 12:04 am

Post by richieRich »

Thanks Ray.

That's a shame for me. So if my parallel job writes multiple files I can't seem to think of a way I could get it to write multiple files without overwriting the original.

Because there is no way to add a unique identifier?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

The XML Output stage is perfectly capable of writing to multiple files. Dump the Sequential File stage and let the XML Output stage do the writing. Enable the 'Trigger Column' option, this value is monitored and whenever it changes, the current file is closed and a new one is opened so set it accordingly. It automatically adds a sequential suffix to the base filename you specify.

Note that while this is 'data driven' the data itself is not used in the filename.
Last edited by chulett on Mon Oct 28, 2013 3:31 pm, edited 1 time in total.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

As noted, you could use a server Folder stage, either in a server job or in a server Shared Container in a parallel job.

Or you could upgrade to version 9.1.2 (the latest), in which this functionality exists in the Sequential File stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
richieRich
Premium Member
Premium Member
Posts: 27
Joined: Tue Jan 05, 2010 12:04 am

Post by richieRich »

Thanks. Chulett I very much like your idea. I've spent some time removing the sequential file stage that was an output to my xml output stage from my job and setting up the xml output stage to have an output file name etc.

Now when I run my job with the xml output stage as the last stage in my flow I get aborts ...

While this is just a warning message in Run Director I think the abort happens because of this....

APT_CombinedOperatorController(10),0: Resource bundle corresponding to message key DSTAGE-TODC-00017 not found! Check that DSHOME or APT_RESPATH is set.

I've got the XML output Transformation settings working based off a trigger column as you suggested with Single Tag selected. I've also checked Write output file and specified a file path in the XML output options.

Perhaps this is why we don't have any xml output stages as output in the jobs at my company.

Can you give any advice?

thanks
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Unfortunately, I'm out of town for the week and doing what little I can, posting from my phone. I'm going to have to defer to others to help on this one, I'm afraid.
-craig

"You can never have too many knives" -- Logan Nine Fingers
richieRich
Premium Member
Premium Member
Posts: 27
Joined: Tue Jan 05, 2010 12:04 am

Post by richieRich »

Hi All,

I'm still having some issues trying to get the XML output stage to work without the sequential file stage.

Here are some settings that I have tried...

Document Settings
> Comments > Generate XML Header - unchecked
>Header > Include > unchecked
> Namespace Declaration - Include checked with 2 namespaces defined
>Header > Include - unchecked
>Nested Chunk> Include - unchecked

Transformation Settings
>Single Tag - checked
>Trigger column - specified

Options
> Write output to a file - checked with file name specified

As mentioned these settings work when the sequential file stage comes after the xml output stage.

Any help would be appreciated.

thanks
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Strange for it to abort....I agree about using another stage to do the writing ---an important technique so that your jobs are the same for sequential, rdbms, or MQ targrting of xml, but I use the multi-file option on many occasions too, simply because it is one of the few ways to generate uniquely named files.

Are you using a fixed name? In my experience, you can't influence it --- just give the filename property value a single string and the xml stage will append a counter value.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Involve your official support provider, if you haven't already.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply