Set Job parameters using unix 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
kranthi
Participant
Posts: 24
Joined: Wed Oct 10, 2007 1:37 pm

Set Job parameters using unix script

Post by kranthi »

Hi,

I am trying to set job parameters using unix script in a before-job subroutine. Can anyone please suggest what should I use in my scrip to set job parameters dynamically?

Here I the script I am running right now, but encountering with an error.

DSSetParam(PJ_OCC_EVE_ETL_commcommunicatn, "insert_cnt", "cat "$1" | grep 'insert_cnt">.*<' | cut -d">" -f4 | cut -d"<" -f1")

I am basically trying to grab the insert_cnt value from my xml file into job parameter insert_cnt.

I used this command in the before-job subroutine:

sh #Base_Path#xmlcount.sh #Base_Path#t_comm_communicatn_COUNT_INCR_20070924080734.xml

Base path is the location of all my files.

Any help is appreciated.

Thanks,
KK
ds_developer
Premium Member
Premium Member
Posts: 224
Joined: Tue Sep 24, 2002 7:32 am
Location: Denver, CO USA

Post by ds_developer »

You are going to have to rethink your process. Parameters are set when the job starts running and they cannot be changed once the job is running. I believe this idea has been covered enough times successfully for you to be able to find the answer by searching the forum.

John
kranthi
Participant
Posts: 24
Joined: Wed Oct 10, 2007 1:37 pm

Post by kranthi »

Sorry, I am new to data stage and trying out a way.

Is there a way I can set the job parameters before running the job using before-job routine? I want to dynamically set the parameter values instead of setting a defualt value.

Thanks in advance
kk
jdmiceli
Premium Member
Premium Member
Posts: 309
Joined: Wed Feb 22, 2006 10:03 am
Location: Urbandale, IA

Post by jdmiceli »

Take a look at Ken Bland's job control process and code. You can download it from free from his website (which I can't remember off the top of my head right now). Sign up for his free membership and go download the utilities and documentation he makes available there.

In it you will find exactly what you need to have to successfully perform the functions you are wanting.

Bestest!
Bestest!

John Miceli
System Specialist, MCP, MCDBA
Berkley Technology Services


"Good Morning. This is God. I will be handling all your problems today. I will not need your help. So have a great day!"
kranthi
Participant
Posts: 24
Joined: Wed Oct 10, 2007 1:37 pm

Post by kranthi »

okay, I figured I can achieve this using job control process. But is it possible in a parallel job? All the threads I read in this forum direct me to a sequence job. Can you please provide me an example if any.

Thanks,
kk
jdmiceli
Premium Member
Premium Member
Posts: 309
Joined: Wed Feb 22, 2006 10:03 am
Location: Urbandale, IA

Post by jdmiceli »

Sorry, I've only gotten to work with Server so I can't speak to what Parallel can do. I'm assuming there is functionality there for it, but I would not be a good source for it. I know there are plenty of other gurus on this site who can though.

Give it a few hours and someone will take a shot at it.

Bestest!
Bestest!

John Miceli
System Specialist, MCP, MCDBA
Berkley Technology Services


"Good Morning. This is God. I will be handling all your problems today. I will not need your help. So have a great day!"
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The way that job parameters are set for parallel jobs (ultimately via a call to DSSetParam() function) is identical to the way the job parameters are set for server jobs and job sequences.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kranthi
Participant
Posts: 24
Joined: Wed Oct 10, 2007 1:37 pm

Post by kranthi »

Hi Ray,

Can you please provide an example? Can I use DSSetParam() in my unix script to set parameters?

If yes, that is exactly what I am doing right now. Here is my unix script.

#!/bin/sh


DSSetParam(PJ_OCC_EVE_ETL_commcommunicatn, "insert_cnt", "cat "$1" | grep 'insert_cnt">.*<' | cut -d">" -f4 | cut -d"<" -f1")

DSSetParam(PJ_OCC_EVE_ETL_commcommunicatn, "update_cnt", "cat "$1" | grep 'update_cnt">.*<' | cut -d">" -f6 | cut -d"<" -f1")

DSSetParam(PJ_OCC_EVE_ETL_commcommunicatn, "delete_cnt", "cat "$1" | grep 'delete_cnt">.*<' | cut -d">" -f8 | cut -d"<" -f1")


Am I missing anything here?

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

Post by ray.wurlod »

DSSetParam() is not invoked from UNIX - hence my use of the word "ultimately".

If you're using the dsjob command line interface include as many -param name=value options as you require, or use a parameter file. Search the forum for details of each approach.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kranthi
Participant
Posts: 24
Joined: Wed Oct 10, 2007 1:37 pm

Post by kranthi »

Hi,

Can you tell me how do I make a call to DSSetParams using unix script. My requirement is to set three job parameters using unix script and use these job parameters in the transformer stage. I am not executing anything at command promt. All this has to happen while runtime.

I tried to include my unix script in the before-job subroutine, but it doesn't like DSSetParams() call in the script.

Please advise.

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

Post by ray.wurlod »

I just did.

DSSetParam() is a DataStage BASIC function. It also exists in the DataStage C language API. It can not be called from UNIX. You can write a small C program if you wish.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply