Obtain SQL Statements from the jobs

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
joycerecacho
Participant
Posts: 298
Joined: Tue Aug 26, 2008 12:17 pm

Obtain SQL Statements from the jobs

Post by joycerecacho »

Hi everybody.

How do I obtain a list of all SQL statements from my jobs?
I mean, the SQL statements that are inside "DB2 stages".
I need to list them.

Thank you guys!

Best Regards,
Joyce A. Recacho
São Paulo/SP
Brazil
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

They will be in the link properties, and therefore in those entries in DS_JOBOBJECTS for which the OLETYPE suggests a link (for example contains the word "Input" or "Output", such as "CCustomInput").
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There may be other OLETYPE values. Try

Code: Select all

WHERE OLETYPE LIKE '%Input' OR OLETYPE LIKE '%Output'
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If that doesn't work, and you know a fairly unique fragment of one of the SQL statements, try these commands in the Command window:

Code: Select all

SEARCH DS_JOBOBJECTS
  (enter the fragment of SQL)(press Enter)
  (press Enter)
LIST DS_JOBOBJECTS ID.SUP @ID FMT '40L' OLETYPE
Post your results.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Do the same again, but use LIST.ITEM rather than LIST.

Code: Select all

SEARCH DS_JOBOBJECTS
LIST.ITEM DS_JOBOBJECTS
From this you will learn the field number in which the SQL statement resides, and which you can use in an EVAL expression to extract it.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Code: Select all

EVAL "@RECORD<17>"
included in a query will extract field number 17.
I leave it up to you how to parse out the SQL statement. Something like

Code: Select all

Field(string[Index(string, "[CDATA", 1)+6, 9999], "]", 1)
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