Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Stand-alone plan for a query

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Mon Oct 13, 2008 5:58 pm    Post subject:
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

Site Director


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

PostPosted: Mon Oct 13, 2008 11:55 pm    Post subject:
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: 1013
Location: India

PostPosted: Tue Oct 14, 2008 10:05 am    Post subject:
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

Site Director


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

PostPosted: Tue Oct 14, 2008 11:33 am    Post subject:
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: 1013
Location: India

PostPosted: Tue Oct 14, 2008 12:36 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Tue Oct 14, 2008 12:46 pm    Post subject: Reply to: Stand-alone plan for a query
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: 1013
Location: India

PostPosted: Tue Oct 14, 2008 2:32 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Tue Oct 14, 2008 4:17 pm    Post subject: Reply to: Stand-alone plan for a query
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: 1013
Location: India

PostPosted: Tue Oct 14, 2008 4:20 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Bind plan as a member to another bind... rexx77 DB2 0 Thu Feb 16, 2017 2:02 am
No new posts Omegamon for DB2 query ashek15 DB2 0 Wed Feb 15, 2017 11:25 am
No new posts Query on DB2 WLM stored procedures ashek15 DB2 8 Sun Feb 12, 2017 11:13 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us