Can DSJobName be used for InvocationID

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
ronchi
Premium Member
Premium Member
Posts: 10
Joined: Sun Dec 07, 2008 6:07 pm
Location: Australia (Melbourne)

Can DSJobName be used for InvocationID

Post by ronchi »

We have some sequences that all call another sequence, potentially at the same time.
So the common sequence was made multi-instance.

For ease of identification, we'd like the invocation-id to include the name of the calling sequence.

Is there a way to include DSJobName in the Invocation-Id?

I've tried the following:
1. #BATCHID##DSJobName# = 1234DSJobName
2. #BATCHID#DsJobName = 1234DSJobName
3. #BATCHID#LOAD_EMP = 1234LOAD_EMP (but I don't really want to hardcode it).

Note: If we include a parameter in the multi-instance sequence, the calling job name can be passed by setting the Value Expression to DSJobName (no quotes or #'s).
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

DSJobName in the job sequence would be the name of the calling sequence. You ought to be able to select this macro in the expression editor when building the parameter-defining expression in the job activity that invokes the other job sequence or job.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ronchi
Premium Member
Premium Member
Posts: 10
Joined: Sun Dec 07, 2008 6:07 pm
Location: Australia (Melbourne)

Post by ronchi »

Sorry, that's not quite what I meant.

What we want is to see items in the log like:
CHKAVAIL.1234LOAD_EMP
CHKAVAIL.1234LOAD_ITEM
CHKAVAIL.1234LOAD_ORDER
and so on.

In the calling sequence (eg. LOAD_EMP) we have a job activity that runs CHKAVAIL.
The job activity has a text box labelled "Invocation Id". The only items that are available for selection are the sequence parameters specified for LOAD_EMP. DSJobName is not one of them.

Note that in the Job Activity calling CHKAVAIL, the list of "Value Expressions" for each of the parameters of CHKAVAIL does allow DSJobName to be selected... but this does not run the instance as CHKAVAIL.1234LOAD_EMP

[Edited for clarification: in the examples in the first post, the results literally appeared as 1234DSJobName - DSJobName wasn't substituted]
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

C'est impossible.

DSJobName does not get the job name until the job is actually running.

You would need to hard code it, or use a parameter value from the job sequence itself.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ronchi
Premium Member
Premium Member
Posts: 10
Joined: Sun Dec 07, 2008 6:07 pm
Location: Australia (Melbourne)

Post by ronchi »

I'd have thought that DSJobName is set during the initialisation of the master sequence (eg. EMP_DATA), before it runs any Job Activities (eg. calls CHKAVAIL).

If I understand Ray's explanation correctly, it means that the "Invocation Id's" are established during initialisation, before DSJobName is set. Is that right?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Let's call the job sequence JS and the job invoked by a job activity JA (which might itself be a job sequence - that doesn't matter).

When JS is running, DSJobName is "JS". When JS is executing the job activity, DSJobName is "JS". Even when it executes DSRunJob(), the value returned by DSJobName within the job sequence is "JS".

The job runs in a separate process (DSRunJob() is an asynchronous call) and it is only within that process that DSJobName would return "JA".

The DSJobName macro expands to

Code: Select all

DSGetJobInfo(DSJ.ME,DSJ.JOBNAME)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ronchi
Premium Member
Premium Member
Posts: 10
Joined: Sun Dec 07, 2008 6:07 pm
Location: Australia (Melbourne)

Post by ronchi »

Thanks for your patient explanation Ray, but I still think we're not quite on the same page.

Building from Ray's example:
- What we want is for JS to run the multi-instance job JA, and give it the instance-name JA.1234JS (where 1234 is the Batchid (a parameter of JS), and JS is the name of the calling sequence).
- We'd prefer is not to hardcode "JS" in the invocation-id.

So, breaking down what I think are the steps within the process:
1. Start sequence JS.
2. Assign DSJobName the value "JS" [via DSGetJobInfo(DSJ.ME,DSJ.JOBNAME)]
3. Assign Batchid the value 1234 (and all of the other parameters of JS).
4. Run the job activity that calls the multi-instance job JA.
5. Build the invocation-id as specified (currently specified as #Batchid#JS, which expands to '1234JS').
6. Build the JA job parameters as specified.
7. Execute DSRunJob(), using the name JA.1234JS, with all of the required job parameters.
...

The question is whether, for step 5, we can use DSJobName (with the value 'JS') in the specification for "invocation id"?

Is this the type of thing that should be done by modifying the Job Control code?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I haven't done anything like this, but I would certainly think that yes - for Step 5 you can use the DSJobName macro for part of the InvocationID as long as the 'job name' that you want is that of the Sequence job that is invoking the multi-instance job.

Should be easy enough to build a small test scenario.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ronchi
Premium Member
Premium Member
Posts: 10
Joined: Sun Dec 07, 2008 6:07 pm
Location: Australia (Melbourne)

Post by ronchi »

Yes, it is the name of the invoking Sequence job that I want. Thanks for that - I couldn't think of the term to use.
I've tried a few things, but cannot seem to get the syntax right.
I've tried the following:
1. #BATCHID##DSJobName# = 1234DSJobName (literally, with no substitution).
2. #BATCHID#DsJobName = 1234DSJobName (again, literally)
3. #BATCHID#LOAD_EMP = 1234LOAD_EMP (but I don't really want to hardcode it).
Can anyone think of another syntax to put into the "invocation id" text box, so that we can get at the value of DSJobName?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Interesting... then perhaps it doesn't actually support macros there. And if that's the case, you may need to hard-code the value in the Job Activity stage... something I don't really see a problem with. It's not like the value will ever change so why not hard-code it?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Post by Kryt0n »

ronchi wrote:Yes, it is the name of the invoking Sequence job that I want. Thanks for that - I couldn't think of the term to use.
I've tried a few things, but cannot seem to get the syntax right.
I've tried the following:
1. #BATCHID##DSJobName# = 1234DSJobName (literally, with no substitution).
2. #BATCHID#DsJobName = 1234DSJobName (again, literally)
3. #BATCHID#LOAD_EMP = 1234LOAD_EMP (but I don't really want to hardcode it).
Can anyone think of another syntax to put into the "invocation id" text box, so that we can get at the value of DSJobName?
Maybe a quicker way to do this but try add a UserVariable Activity, create a variable and set it to DSJobName (add in your other bits too e.g. BatchId) and then use this variable as your invocation id?
ronchi
Premium Member
Premium Member
Posts: 10
Joined: Sun Dec 07, 2008 6:07 pm
Location: Australia (Melbourne)

Post by ronchi »

That'll do nicely. Better than hard-coding, and much better than modifying the Job Control code.

Thanks Kryt0n, and everyone for their help.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Nice solution, Kryt0n. :wink:

Still don't really see the point and in my world would just hard-code it, but I guess that's just me. :lol:
-craig

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