passing parameters from a script to a datastage job

We have a requirement as follows.

We have created a datastage job that will be doing the select operation from table (select query from a table).

The datastage job is being invoked by a unix shell script(ksh).

We are passing the "table name (STUD_DETAILS)" and a "where clause condition (ADDRESS IS NOT NULL) " as a parameter to the job.

If these parameters are passed to the datastage job, it will form a query as follows.
"select stud_name, join_year, roll_no from STUD_DETAILS where branch = 'CSE' AND ADDRESS IS NOT NULL;"

We have written the unix shell script as follows.

function abc
{
tblname=$1
cdntion=$2
}
..
..
..
in main function we are calling the function abc

x="STUD_DETAILS"
y="AND ADDRESS IS NOT NULL"

.. calling the function abc.
abc (x,y)

If we pass the parameter like this...
tblname is having STUD_DETAILS
and cdntion is having AND

we are expecting the cdntion to have "AND ADDRESS IS NOT NULL". The text "ADDRESS IS NOT NULL" is not being passed to the datastage job.

The script will be passing only 2 parm.
parm1 = table name
parm2 = where clause condition...... need to send the whole string (AND ADDRESS IS NOT NULL).

Can anyone help me to fix this issue.

Thanks
Krishnakanth Manivannan
Software Engineer

When you invoke a function in Kshell you do not use comas nor do you use parens. Something like this:

#!/usr/bin/env ksh

function abc
{
   echo "parm 1 = $1"
   echo "parm 2 = $2"
}

abc "hello there" "world"

Hope that helps.

I have tried the following...

script - sample1.ksh
---
#!/usr/bin/env ksh
parm1="01"
parm2="02 03"
echo $parm1
echo $parm2
---

The output what I got is as follows
--
01
02
--
I am not getting "02 03" instead i am getting only 02.

Could you please help me to fix this issue.

Thanks
Krishnakanth Manivannan

hi,

here #!/usr/bin/env ksh may be making problem.

its working fine with bash.

try any other interpreter.

or if you want to try in the same try :

x=`echo "STUD_DETAILS"`
y=`echo "AND ADDRESS IS NOT NULL"`

The code you posted works just fine for me under a somewhat older version of Ksh (Version JM 93t+ 2009-02-02)

I've not seen Ksh behave that way, and I've been using it since the early 90s. The only thing I can think to suggest is quoting the parameters on the echo command:

a="hello world"
echo "$a"