passing parameters from a script to a datastage job


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting passing parameters from a script to a datastage job
# 1  
Old 06-12-2011
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
# 2  
Old 06-12-2011
When you invoke a function in Kshell you do not use comas nor do you use parens. Something like this:

Code:
#!/usr/bin/env ksh

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

abc "hello there" "world"

Hope that helps.
# 3  
Old 06-13-2011
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
# 4  
Old 06-13-2011
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 :

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

# 5  
Old 06-14-2011
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:

Code:
a="hello world"
echo "$a"

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to compile a Datastage Job using Execute Command Stage or Routines in Datastage 11?

I am trying to compile the datastage jobs using the Execute Command stage in datastage 11 or any Routines if possible. My datastage is on Unix machine. So, How can I Compile a datastage job in UNIX from command line or any Routines. Please help me in doing so. Thank you. (1 Reply)
Discussion started by: elena jessi
1 Replies

2. Shell Programming and Scripting

Passing command line parameters into script

Not a good post. (1 Reply)
Discussion started by: bash_in_my_head
1 Replies

3. Shell Programming and Scripting

Shell Script passing parameters to sqlplus code

Hello All, I am interested in finding out a way to pass parameters that are entered at the prompt from HP unix and passed to SQLPlus code with a Shell Script. Is this possible? Thanks (4 Replies)
Discussion started by: compprog11
4 Replies

4. Shell Programming and Scripting

passing parameters to the script

how can i make a script to run only when parameters are given, if parameters are not given it should through an error , saying "please enter a parameter" for ex: i want a find command to run only when the parameters are given (4 Replies)
Discussion started by: knip
4 Replies

5. Shell Programming and Scripting

Help parsing job script input parameters

I have a job script that runs with input parms from the command line. job.sh -p parm1_parm2_parm3_parm4_file_1.dat The parms are separated by _ The last parm is a file name and can have an _ in the name. I currently use the following commands to extract the parms parm1=`eval echo... (3 Replies)
Discussion started by: jclanc8
3 Replies

6. Shell Programming and Scripting

Shell Script Passing Parameters For Directory Listing

i have this basic piece of code that i am trying to debug to accept input parameter to be able to display a directory listing of files. cd /u02/app/eatv/dev/out CURDIR=`pwd` echo directory listing of $CURDIR echo if ; then ls -latr else ls -latr $1 fi basically if the script... (9 Replies)
Discussion started by: wtolentino
9 Replies

7. Shell Programming and Scripting

Passing parameters to Shell script for GREP command

I am using grep to capture date from a file . Since i need to use the shell script for different dates ,is it possible to pass the date parameter to the shell script the Script is as below grep -E "08 Aug 2008|2008-08-08"* somefile.txt>test.txt The above script file greps the... (1 Reply)
Discussion started by: sud.tech
1 Replies

8. Shell Programming and Scripting

Random parameters passing in FTP script

Hi I have a question. In the FTP script if we are passing all the required value like Hostname, username, password, Action(put or get), Filename, & mode(ascii or binary) through parameters then we have to pass these in the exact orders in which they are taken like if we defined Username=$2... (2 Replies)
Discussion started by: sourabhshakya
2 Replies

9. Shell Programming and Scripting

passing parameters from a shell script to sqlplus

Hi , I want to pass parameters from a shell script to a sql script and use the parameter in the sql query ..and then I want to spool a particular select query on to my unix box... for 4 different locations by writing only one sql script Right now no file is generated on the unix box...it is a... (2 Replies)
Discussion started by: phani
2 Replies

10. UNIX for Dummies Questions & Answers

Passing parameters in script

I have 2 scripts: script1 and script2 Script1 passes 4 parameters to script2 as follows #script1 code ... ... script2 $var1 $var2 $var3 $var4 Script2 uses the export command to know to expect these values #script2 export $1 $2 $3 $4 code ... ... The problem that I am having is... (1 Reply)
Discussion started by: eliguy
1 Replies
Login or Register to Ask a Question