Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting SQL dynamic variable value through a flat file.

Status
Not open for further replies.

TeraJCL

Programmer
Oct 30, 2002
1
US
I have a huge SQL script which is run on a monthly basis.
Whenever the script is ran, the date field values need to be changed. Something like this,

Select ........
Where date between '09012002' and '09302002'

now if I want to run it for october I have to change the script.
so if I use dynamic varaibles instead,
where date betwwen :range1 and :range2 , it will be alot easier.

The problem is I use a JCL PROC to run this script for Teradata database using BTEQ Program. so tis script is stored as a member in mainframe. I cannot figure out a way to supply this variables to the script.
IS there a way, I can read in a file with the variable values using some BTEQ command and supply it to the script.

I am really really stuck with this problem.
Any help will be highly appreciated.

Thanks
 
Why not use BTEQ (TPUMP or whatever) to pick up the two variables and store these in a small table, then simply include this small table in the SQL

If the dates ranges are more predictable, then just create a custom CALENDAR table and update a flag variable to choose the dates you want prior to running your "big" SQL

Wouldn't that work ?

Roger...
 
i dunno if i'm missing something but can't you just add parameters to your procedure?

this way you run the script with the two parameters and that's that?

I am new to proc's so i might be talking out my rear but thought i'd mention it anyway....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top