View previous topic :: View next topic
|
Author |
Message |
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Hi,
Is there any way to create a plan to execute a query without the actual cobol-program.
That is, usually a plan(executable) is created after the BIND PLAN. Which executes the query for a cobol program or any other program. The process is like
COB-PROGRAM --> PRE COMPILE --> DBRM --> PLAN
What i want to know is, just say i have a query like
select * from test.employee;
for this i want to create a plan.
process like
QUERY -->___This is a Blank is waiting for your ideas____-->PLAN
like this. Is it possible..
Sushanth Bobby |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
When you have a new question you need to start a new topic for your question. You should not reply to some other topic with your new questions.
Continuing to do this will simply result in the new questions being deleted. . . |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Dick,
Thank You Very Much for starting a new thread on this topic. As i was reading the posts on "differences between plan and package". This question came along, and thank you for giving it a name "Stand-alone plan for a query".
Can something like this be done ?
Eagerly waiting to know the answer,
Sushanth Bobby |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Is there some reason you cannot simply run your query via SPUFI? |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Dick,
Yes. QUERY can be executed via SPUFI. That is the purpose of SPUFI.
PLAN also serves the same purpose, executing query. But, there is a lot of difference in executing a plan & running a query in SPUFI.
Till now, my thinking goes like this, PLAN can be made for a programs(COBOL). Those programs need data to further continue their processing. And the data happens to be in DB2 tables, and to access the data from the table. program needs to execute a query. Query can be executed by a plan. So, the program uses the plan to execute the query. In the meantime, all the authorizations, previleges & syntax checkings all being done.
COBOL PROGRAM with SQL query --> pre-compile --> DBRM --> PLAN
And i was wondering can something like this can it be done.
DIRECT QUERY --> --> PLAN
Sushanth |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
You do not execute a plan, You execute/run a program...
anyway the answer is NO,
but why such a strange requirement/curiosity
how would You exploit such a possibility..
You need anyway to execute a program to achieve some useful results
the things that gets closer but it uses an empty plan is the prepare execute approach
the way spufi or dsnep2 do
get a string which represents a query, prepare it ( a quick an dirty in flight bind ) and the execute it |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Enrico,
Quote: |
anyway the answer is NO, |
I can live with that.
Quote: |
why such a strange requirement/curiosity |
Not a requirement. Curiosity & Imagination.
Quote: |
how would You exploit such a possibility.. |
hmmm. Let me start from what i know now & correct me if iam wrong. Just bare with me
You cannot execute a plan, you can execute only a program. The plan is used by the program and it can be used only by that program due to timestamp consistency token put in the modified source program(after pre-compile) and consistency token in plan. Programs consistency token has to match the plan's consistency token.
So, there is no chance for a program to execute a different plan. Because, It is all built like that.
So, a program can't be made to execute different plans
i.e., Instead of program having SQL queries, let them call plans.
i.e., A program capable of getting different results by executing different plans.
Consider a program with just one type of query is executed and results are got.
Another doubt, i just got now, consider program which has already has a plan to execute a query. Now the program wants to execute another/replace that query. No codings has been changed, just the query.
Now what should be done to that programs (DBRM,PACKAGE,PLAN) ? [I hope this doesn't come into new topic, i get diverted a lot]
When thinking about one thing, i also think about other things.
Sushanth Bobby |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
Now what should be done to that programs (DBRM,PACKAGE,PLAN) ? [I hope this doesn't come into new topic, i get diverted a lot] |
I gave already the answer, use the prepare statement
Quote: |
get a string which represents a query, prepare it ( a quick an dirty in flight bind ) and the execute it |
if You are curious to see how it does it search the db2 samplib for the source
the library name should contain something like ....SDSNSAMP |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Ok. Enrico.
I will see that. |
|
Back to top |
|
|
|