Externalize SQL Query

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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Parameters and SQL Files are mutually exclusive. Only workaround I found was to maintain multiple sql file variations and use parameters in the filename to pull in the right one at the right time. Obviously limits just how dynamic they can be, however. :(
-craig

"You can never have too many knives" -- Logan Nine Fingers
vincentjeevan
Participant
Posts: 12
Joined: Thu Jan 08, 2004 9:45 am

Post by vincentjeevan »

Thanks Craig. I uderstand the workaround. However, we have multiple filters and it will be difficult to maintain hunderds of QUERY file for a single Job.
throbinson
Charter Member
Charter Member
Posts: 299
Joined: Wed Nov 13, 2002 5:38 pm
Location: USA

Post by throbinson »

Build template SQL files with a token in place of the filter. sed the token to the desired parameter filters you want at runtime and redirect to a temp SQL file and run the Temp SQL in DataStage. Hopelessly complicated? You betcha! But it makes the SQL file(s) dynamic as opposed to static. Basically another level of abstraction and obfuscation.
vincentjeevan
Participant
Posts: 12
Joined: Thu Jan 08, 2004 9:45 am

Post by vincentjeevan »

throbinson wrote:Build template SQL files with a token in place of the filter. sed the token to the desired parameter filters you want at runtime and redirect to a temp SQL file and run the Temp SQL in DataStage. Hopelessly complicated? You betcha! But it makes the SQL file(s) dynamic as opposed to static. Basically another level of abstraction and obfuscation.
Thanks. I'll try this option.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Re: Externalize SQL Query

Post by ray.wurlod »

vincentjeevan wrote:Hi, I have a requirement to maintain all SQL Queries outside Datastage.
Resist stupid requirements.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

throbinson wrote:Basically another level of abstraction and obfuscation.
Excellent! Nothing like a layer of abstration, followed by a nice chocolate creme and then some rich obfuscation to top it all off. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

I have done this for a reference data job where I am pulling code and description from dozens of tables but it only works because all the source tables use the same metadata. Different SQL files and the table name and WHERE clause column name are passed in as job parameters.
Post Reply