Naming a hash file based on the Invocation id

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
vinoth venkitapathy
Participant
Posts: 3
Joined: Wed Sep 17, 2008 12:25 am
Location: Chennai

Naming a hash file based on the Invocation id

Post by vinoth venkitapathy »

Hi,
is it possoible to name files based on invocation id? If so how to implement that .
we are running a multi instance job and passing the invocation id from script ,we want to name the files created by the multiple instacne job like filename .invocation id.

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

Post by ray.wurlod »

As far as I'm aware it's not possible. The Hashed File stage does not even support parameters for the File Name property.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vinoth venkitapathy
Participant
Posts: 3
Joined: Wed Sep 17, 2008 12:25 am
Location: Chennai

Post by vinoth venkitapathy »

In that case can we replace the hash file with a seqential file.If i am using sequential file, is it possible to add the invocation id to the file name?
By the way we are using file just as a staging file to hold minimal number of records (say 20 records per job instance)
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

You can create the hashed file with a parameter value as its name.
Plagvreugd
Participant
Posts: 9
Joined: Tue Sep 20, 2005 2:10 am

Post by Plagvreugd »

Sainath.Srinivasan wrote:You can create the hashed file with a parameter value as its name. ...
So just add a parameter with the invocation-id in the job and use that in the filename.

You can also extract the invocation-id in a job from DSJobname, but I see no way in using that in the Filename property.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Plagvreugd wrote:but I see no way in using that in the Filename property.
Why can't you use in file name ? apart from the business reasons.
Plagvreugd
Participant
Posts: 9
Joined: Tue Sep 20, 2005 2:10 am

Post by Plagvreugd »

Sainath.Srinivasan wrote:
Plagvreugd wrote:but I see no way in using that in the Filename property.
Why can't you use in file name ? apart from the business reasons. ...
According to the Help (under Defining Hashed File Input Data ) you can use macros in the file name property, which in thought you couldn't.

Quote:
The name of the file the data is written to. You can use a job parameter or macro to specify the file created during run time, or choose the file from the File name drop-down list.

I didn't know you could use a macro like DSJobName at such a place, simply by enclosing it by #'s, just like with parameters. If I put #DSJobName# in the file name property, a hash file with the name of the job (including Invocation ID) is created.

Anybody got any idea whether (and if so, how) you can use other functions/routines in the file name property? My guess is that it's not possible, because the Help explicitly mentions parameters and macros, not functions or routines.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

In this case, the requirement is a parameter or macro.

If you have a routine or function return value, you have to set it in a parameter and passed to the job.

Alternatively you can work around by re-arranging the data outside.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

ray.wurlod wrote:As far as I'm aware it's not possible. The Hashed File stage does not even support parameters for the File Name property.
As noted, certainly possible, fully supported and quite handy. :?
-craig

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