Page 1 of 1

Naming a hash file based on the Invocation id

Posted: Thu Aug 06, 2009 12:55 am
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

Posted: Thu Aug 06, 2009 1:04 am
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.

Posted: Thu Aug 06, 2009 1:20 am
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)

Posted: Thu Aug 06, 2009 2:00 am
by Sainath.Srinivasan
You can create the hashed file with a parameter value as its name.

Posted: Thu Aug 06, 2009 3:06 am
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.

Posted: Thu Aug 06, 2009 3:38 am
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.

Posted: Thu Aug 06, 2009 5:17 am
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.

Posted: Thu Aug 06, 2009 5:24 am
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.

Posted: Thu Aug 06, 2009 6:19 am
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. :?