Page 1 of 1

How to use perl to query info from DS repository

Posted: Thu Sep 15, 2005 6:39 pm
by mchaves
Hi there,

Has anyone ever queried the ds repository using perl? If so, can you provide an example ?

Thanks,
Melquior

Posted: Thu Sep 15, 2005 8:04 pm
by ray.wurlod
The DataStage Repository is a database. Like any other database it must be queried using a query language (for example SQL) within its own environment.

You can wrap this in Perl or any other scripting language, but you still need to know how to construct the query.

Posted: Thu Sep 15, 2005 10:04 pm
by mchaves
Hi Ray,

Thanks for reply. Mate, I know that ds repository is a database but I couldn't find any information on how to pull data from it. Do you mind elaborating a bit more on it? Just tell me how setup a connection to it like odbc or something.

Cheers,

Posted: Fri Sep 16, 2005 12:26 am
by ray.wurlod
The easiest way is to use the dssh or uv command in the project directory. This can take a double-quoted command (query) as its command line argument.

You may need to have set environment variables first by sourcing the dsenv script.

Code: Select all

. $DSHOME/dsenv
$DSHOME/bin/dssh "SELECT NAME FMT '32L', CATEGORY FMT '32L' FROM DS_JOBS ORDER BY 1;"
Wrap that in Perl, capture the output, and parse it.

Posted: Fri Sep 16, 2005 5:17 am
by melquior
Thanks Ray.

Posted: Fri Sep 16, 2005 7:48 am
by ray.wurlod
Same person, new nick? That's one way to get to 10,000 users! :twisted: