Page 1 of 1

List of jobs uses a specific parameter

Posted: Thu Sep 07, 2017 10:58 am
by raji33
Hi All,

I have a requirement where i need capture the list of the jobs where a specific parameter is being used.

Query i am using

LIST DS_JOBS WITH JOBTYPE = 3 AND EVAL "TRANS('DS_JOBOBJECTS','J\':@RECORD<5>:'\ROOT',14,'X')" LIKE ...ABC...

Where ABC is my parameter.
My issue is, I am getting complete list of jobs which are using the parameter starting with ABC and its even pulling the jobs which uses ABC_D parameter.

Any suggestions on how to modify query to get the desired result.

Thanks

Posted: Thu Sep 07, 2017 1:46 pm
by PaulVL
You could brute force the search with a script like this:

Code: Select all


#!/usr/bin/ksh
##
##  Description:  Create a list of parms for each job and put into repository directory .
##
DSHOME=`cat /.dshome`;export DSHOME;
hName=`hostname`



set -A projects `$DSHOME/bin/dsjob -lprojects 2>/dev/null;`

for pEntry in ${projects[*]}; do
        echo "Working in $pEntry";

        set -A jList `$DSHOME/bin/dsjob -ljobs $pEntry 2>/dev/null;`

        for jEntry in ${jList[*]}; do

                echo `$DSHOME/bin/dsjob -lparams $pEntry $jEntry 2>/dev/null;` > /fsdsadm/scripts/fsa/repository/$hName.$pEntry.$jEntry.parmlist;

        done

done

Then just grep in that repository path for your parms. If you are about to do a ton of searches over and over... might be the way to go.

Posted: Thu Sep 07, 2017 2:20 pm
by chulett
If you want a specific parameter then don't use "LIKE ...ABC..." as that is a wildcard search. Worst case get rid of the "..." on either side, does that not get you want you want if you do that?

Posted: Fri Sep 08, 2017 7:53 am
by rkashyap
If you are using Operations Console, then following query will give desired results ...

Code: Select all

SELECT distinct X.ProjectName, X.FOLDERPATH,  X.JobName, P.PARAMNAME, P.PARAMVALUE
     FROM  DSODB.JOBRUN R 
     JOIN  DSODB.JOBEXEC X          ON R.JOBID = X.JOBID 
     JOIN  DSODB.JOBRUNPARAMSVIEW P ON R.RUNID = P.RUNID 
     WHERE P.PARAMNAME = <parameternm>
    --   AND R.RUNSTARTTIMESTAMP > (Current_timestamp - 7 days) 
     ORDER BY 1, 2, 3

Posted: Fri Sep 08, 2017 11:42 am
by raji33
Thanks Chulett. Its working.