Passing Invocation Id to the script

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
kuttan84
Participant
Posts: 3
Joined: Thu Feb 23, 2017 9:38 am

Passing Invocation Id to the script

Post by kuttan84 »

Hello Everyone,

Can I pass the Invocation ID from Main sequence (multiple instance) as a parameter to the shell script called in the ExecuteCmd stage? I am looking forward to implement the below scenario.

One main sequencer (multiple instance) which has the following stages.

Execute Cmd1 (Get the number of tables which I save in a file. ) -->Start Loop --> Execute command (Get the table name) --> Job Acitivity (Load from DB2 to Oracle with Table Name as the parameter and RCP)--> Execute command2(Calls a shellscript which removes the first line from the file which contains the list of tables) -->End loop

I will maintain 3 files (file1,file2,file3) each containing 10 tables each. Currently i have created 3 sequencers and 3 shell scripts for the same. It works when i execute all of them in parallel. What I am trying to ask is,

Can I have a single multiple instance sequence and one shell script which accepts the invocation id as the parameter?

Say I pass invocation Id as 1 which gets passed into the shell script as the parameter (Execute cmd1 and Execute cmd2 stages). In this way the shell script can read the corresponding file (file1,file2 or file3)

Any help from your end is really appreciated.
-Thanks
Kuttan
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

If I'm following what you are doing here, you should be able to use the DSJobInvocationId macro for that.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kuttan84
Participant
Posts: 3
Joined: Thu Feb 23, 2017 9:38 am

Post by kuttan84 »

Thanks Craig for the response. So does it mean in the Execute command stage, I can pass it as Cat path/Filename#DSJobInvocationId#.txt|wc -l instead of cat path/Filename1.txt|wc -l assuming invocation id passed is 1?
-Thanks
Kuttan
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

From what I recall, yes. I'd suggest you put just the "cat" in the command property and the rest in the parameters property so that when it builds what it needs to run it knows there might be a parameter to evaluate.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kuttan84
Participant
Posts: 3
Joined: Thu Feb 23, 2017 9:38 am

Post by kuttan84 »

I tried giving this way, but it fails during compilation saying "Parameter field contains an unknown parameter "DSJobInvocationId"
-Thanks
Kuttan
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Well, that sucks. Guess we'll need to see who wanders by next with some words of wisdom. I no longer have any way to test or play around with anything DataStage, unfortunately. :(
-craig

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