How to fetch Meta data of table or file to a file

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
rhaddur
Participant
Posts: 52
Joined: Mon Mar 13, 2006 7:33 am
Location: mumbai

How to fetch Meta data of table or file to a file

Post by rhaddur »

I want to fetch metadata of any source or target stage

of type db2 or seq file to xls file
Rhaddur
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Not sure I understand your question but normally you need to understand the system tables in order to do this. DB2 system tables are a little different based on the version of DB2. UNIX versions are different than mainframe. I have these SQL statements for several databases if you want them. Post a reply and maybe I will post the SQL.
Mamu Kim
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

'Fetch' why, for what purpose?
-craig

"You can never have too many knives" -- Logan Nine Fingers
rhaddur
Participant
Posts: 52
Joined: Mon Mar 13, 2006 7:33 am
Location: mumbai

Post by rhaddur »

chulett wrote:'Fetch' why, for wwe able to get job parameters using

SELECT
EVAL DS_JOBOBJECTS."@RECORD<14>" AS Param_Name,
EVAL DS_JOBOBJECTS."@RECORD<16>" AS Prompt,
EVAL DS_JOBOBJECTS."@RECORD<19>" AS Type,
EVAL DS_JOBOBJECTS."@RECORD<17>" AS Default_Value,
EVAL DS_JOBOBJECTS."@RECORD<18>" AS Help_Text
FROM
DS_JOBOBJECTS , DS_JOBS
WHERE
DS_JOBOBJECTS.OLETYPE='CJobDefn' AND DS_JOBS.JOBNO=DS_JOBOBJECTS.OBJIDNO AND DS_JOBS.NAME='<jobName>';



then what is the way to get the

fetch Meta data of souce or target stage to a file hat purpose? ...

Because our We want to prepare the test data , based on the metadata
for arround 100 jobs
Rhaddur
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

This SQL statement will return job parameters. Exactly what metadata do you need. You need source and target table names? You need column names too? You need run time metadata like job start and end times? You need run time parameter names and values?

Exactly what do you need and why?
Mamu Kim
rhaddur
Participant
Posts: 52
Joined: Mon Mar 13, 2006 7:33 am
Location: mumbai

Post by rhaddur »

kduke wrote:This SQL statement will return job parameters. Exactly what metadata do you need. You need source and target table names? You need column names too? You need run time metadata like job start and end t ...
Thanks for your reply

I am expecting the query , which will give the,


Table names and its meta data

like Column Name , Key, SQL type
Rhaddur
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

It is not that simple. Each stage type can be stored in a different format. Most PX jobs have a custom stage type so they may be easier to extract. The table name can also be an issue if you use user defined SQL.

If this was easy then we would all have a canned solution. Maybe it is easier in version 8. Not sure.
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It's actually more difficult in version 8, for example because DS_METADATA (which holds table definitions in earlier versions) now holds only category (folder) "pathnames" - the actual table definitions are in the unified metadata repository for Information Server.

The easiest way is probably a routine that ends up invoking DSGetLinkMetaData(), but that will only give the column definitions, not the table name or SQL.

You can, of course, obtain the information from the job configuration records, in particular the INPIN or OUTPIN records from RT_CONFIGnnn table for job number nnn. Or you can get it from the design records in DS_JOBOBJECTS, but not from the ROOT record. Again you'll need the link records.

None of this is documented. Reverse engineering is explicitly prohibited in the licensing agreement.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rhaddur
Participant
Posts: 52
Joined: Mon Mar 13, 2006 7:33 am
Location: mumbai

Post by rhaddur »

ray.wurlod wrote:It's actually more difficult in version 8, for example because DS_METADATA (which holds table definitions in earlier versions) now holds only category (folder) "pathnames" - the actual table definitio ...

When I am running the following query

SELECT * FROM DS_JOBOBJECTS , DS_JOBS WHERE DS_JOBS.JOBNO=DS_JOBOBJECTS.OBJIDNO AND DS_JOBS.NAME='job_name';


Getting following recods

record 1

Object type........ J
Object record id... 1911
Object record name. V0S63P2
Description........
Job name........... job_name

Description........
No................. 1911
Category........... Test
Object type........ J
Object record id... 1911
Object record name. V0
Description........
Job name........... job_name


Records 2

Description........
No................. 1911
Category........... Test
Object type........ J
Object record id... 1911


Object record name. V0S63
Description........
Job name........... job_name

Description........
No................. 1911
Category........... Test



my query

What exactly following values

Object record name. V0S63P2

Object record name. V0S63
Rhaddur
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There's not a whole lot you can do with the knowledge, because it's more for the internal management of jobs, but here goes...

VnSmPk is the DataStage Repository ID (DSRID) of an object.

V is a "view" - the basic job design is always V0 and containers are numbered V1, V2, and so on.

Sm is stage number m in the job, where m is the order in which added to the job design (the same number as used in the default name for the job).

Pk is a "pin", or one end of a link. VnSmPk is that end of the link that connects to stage VnSm.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply