IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Stand-alone plan for a query


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Mon Oct 13, 2008 5:58 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Oct 13, 2008 11:55 pm
Reply with quote

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
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Tue Oct 14, 2008 10:05 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Oct 14, 2008 11:33 am
Reply with quote

Hello,

Is there some reason you cannot simply run your query via SPUFI?
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Tue Oct 14, 2008 12:36 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Oct 14, 2008 12:46 pm
Reply with quote

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
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Tue Oct 14, 2008 2:32 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Oct 14, 2008 4:17 pm
Reply with quote

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 icon_biggrin.gif
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
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Tue Oct 14, 2008 4:20 pm
Reply with quote

Ok. Enrico.

I will see that.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts RC query -Time column CA Products 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
No new posts Issue with EXEC CICS QUERY SECURITY c... CICS 6
Search our Forums:

Back to Top