Problem with Multi Instance Job

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

Post Reply
maffan76
Participant
Posts: 110
Joined: Tue Aug 23, 2005 5:27 am

Problem with Multi Instance Job

Post by maffan76 »

HI,
I am trying to make unique file names for Multi Instance Jobs, While going thru the old post i saw the trick illustrated by Vincent to concatenate #JOBINVOCATIONID# with the file name and the invocation ID will be cat. But when i go back and see the folder its shows me the file name with the variable name instead of the invocation ID, i am giving while running the job.

E:\OutputFiles\MergeFile#JOBINVOCATIONID#.txt

and i am getting the same name of the file instead of Invocation ID concatenated.

Am i doing something wrong?
Regards,
Affan
"Questioning is Half Knowledge"
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

JOBINVOCATIONID is also a parameter name.
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The invocation ID macro can not be used directly as a parameter reference in a file name. You must create a job parameter, populate it with the value of the invocation ID (or anything else you please). Job parameter references can be used in file names.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Too short an answer again. Thanks Ray man. Just lazy today.
Mamu Kim
maffan76
Participant
Posts: 110
Joined: Tue Aug 23, 2005 5:27 am

Post by maffan76 »

Thanks a lot Ray,
I'll give it a shot again.
Regards,
Affan
"Questioning is Half Knowledge"
maffan76
Participant
Posts: 110
Joined: Tue Aug 23, 2005 5:27 am

Post by maffan76 »

Ray,
can you please post the code/procedure i have to paste in the value of the job parameter as i am putting this value into the parameter value

JOBINVOCATIONID

and i have triend all variations e.g.
DSJ.JOBINVOCATIONID

but no luck :(
Regards,
Affan
"Questioning is Half Knowledge"
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Your code is correct. Just duplicate the InvocationId in the parameter named JOBINVOCATIONID. I would chose a new name.
Mamu Kim
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
Excuse me guys but I beg to differ !!!
I use DSJobInvocationId (the macro equivalent of the DSGetJobInfo()) alot and it works fine as part of file names and even DB stage where part !!!

IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
maffan76
Participant
Posts: 110
Joined: Tue Aug 23, 2005 5:27 am

Post by maffan76 »

my variable name is JobInvID and di am giving it a value DSJobInvocationId
but still no luck it concatenates the staring as it is.

the type of the param is string. do i need to do something else as well.

do i have to write something else as well in the default value text box.
Regards,
Affan
"Questioning is Half Knowledge"
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

This isn't all that complicated, guys. :?

You do not need a Job Parameter and you can use the macro directly in the 'File name' field of the Sequential File stage. The only odd thing is you must wrap it in pound/hash signs as if it were a Job Parameter. So, try...

Code: Select all

E:\OutputFiles\MergeFile#DSJobInvocationId#.txt 
without any similarly named job parameter to get in the way and you'll be fine.
-craig

"You can never have too many knives" -- Logan Nine Fingers
maffan76
Participant
Posts: 110
Joined: Tue Aug 23, 2005 5:27 am

Post by maffan76 »

Craig,
Thanks a lot, it worked :) finally

Seconldy how can i use the macro in Job Paramater to assign value as in some cases it is very helpful.

Thanks in advance.
Regards,
Affan
"Questioning is Half Knowledge"
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

maffan76 wrote:Seconldy how can i use the macro in Job Paramater to assign value as in some cases it is very helpful.
I don't believe that you can as this would seem to me to fall into the same class of problem as the "job parameter in a job parameter" one. The manual states that the various macros "can be used in all active stages and before / after subroutines".

What kind of usage were you thinking of? Perhaps if you explained why you were thinking you needed a macro in a job parameter, I'm sure someone here could come up with a viable alternative approach.
-craig

"You can never have too many knives" -- Logan Nine Fingers
maffan76
Participant
Posts: 110
Joined: Tue Aug 23, 2005 5:27 am

Post by maffan76 »

I am thinking of lets say calculating the dynamic value based on routine and if i would be using the variable then the only plcae i would hve to make change will be the routine. otherwise i'll have to change it every where.

e.g. i want to create the dynamic name of the file based on timestamp and a fix string. this way if i change the strategy of file naming the change will be very minimal.
Regards,
Affan
"Questioning is Half Knowledge"
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

The typical answer there would be to use the routine (via the Routine Activity stage) in a Sequencer job. The output of the routine, the dynamic filename, could then easily be passed as a parameter to a downstream job.

Keep in mind that, if you try and let the sequencer 'automatically handle failures', that a non-zero return code from a routine is considered a failure.
-craig

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