to get job names of a category through unix command

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
ksudhir466
Participant
Posts: 11
Joined: Fri Sep 05, 2008 4:20 am
Location: chennai

to get job names of a category through unix command

Post by ksudhir466 »

Hi,

i am in need of unix command which can give us all job names and annotation in the job of a category.
say i have three job in the folder /test/prjct1
j1ext
j2tfm
j3load

if i pass argument to unix command as /test/prjct1 , i should get job names and annotation given in that job.

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

Post by ray.wurlod »

Do you mind if your UNIX command invokes a database query? Because you are going to need a database query to determine the category contents.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ksudhir466
Participant
Posts: 11
Joined: Fri Sep 05, 2008 4:20 am
Location: chennai

Post by ksudhir466 »

Hi Ray,
thx for reply, please suggest the approach , it should be k if it invokes database query.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Usually categories are delimited by backslash, so you might need either to specify the argument with backslashes or, within your script, translate forward slashes to backslashes. For example

Code: Select all

category=$1
catpath=`echo $category | tr \/ \\`
The command has to be executed while attached to a project directory. Therefore you need to provide the name of a project or, preferably, the pathname of the project directory as an additional command line argument.

Code: Select all

projectdir=$2
cd $projectdir
If the DSEngine bin directory is not in your PATH then you will need the full pathname of the dssh executable. The query is probably the easiest part.

Code: Select all

export DSHOME=`cat /.dshome`
${DSHOME}/bin/dssh "SELECT NAME FMT '60L' FROM DS_JOBS WHERE CATEGORY = '$catpath';"
Error and argument checking has been omitted for clarity.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dsedi
Participant
Posts: 220
Joined: Wed Jun 02, 2004 12:38 am

Post by dsedi »

a batch file with the below can help to get just the Job name in the category...
but i am sure the experts gave you the way to get the annotation given in that job

Code: Select all

     @echo off 
    
    SETLOCAL 

    SET Host= 
    SET /p Host=Type host and press Enter: 

    SET User= 
    SET /p User=Type User and press Enter: 
  
    SET PW= 
    SET /p PW=Type Password and press Enter: 

    SET project= 
    SET /p project=Type Project Name and press Enter: 

    SET folder= 
    SET /p folder=Type folder path and press Enter: 

    SET DsSearch=C:\Progra~1\Ascential\DataStage7.5.2\dssearch.exe 
    SET JobList=JobList.txt 
      
    %DsSearch% -server %Host% -user %User% -password %PW% -ljobs -matches -sub -c %folder% %project% >> %JobList% 

    ENDLOCAL
Accept that some days you're the pigeon and some days you're the statue.
joycerecacho
Participant
Posts: 298
Joined: Tue Aug 26, 2008 12:17 pm

Post by joycerecacho »

The command bellow doesnt work.

%DsSearch% -server %Host% -user %User% -password %PW% -ljobs -matches -sub -c %folder% %project% >> %JobList%

If a cut the part: "-matches -sub -c %folder%" it works fine.

It says:
"Valid primary command options are: -ljobs
Status code = -9999 DSJE_DSSEARCH_ERROR"

Any idea?

Tks!
Joyce A. Recacho
São Paulo/SP
Brazil
Post Reply