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

How DB2 find the qualifier of the table during the run time?


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

New User


Joined: 22 Dec 2009
Posts: 24
Location: hyderabad

PostPosted: Tue Feb 05, 2013 10:08 am
Reply with quote

Hi,
In my shop different tables have different qualifiers.
let's say
testing database: TEST1
Table name<--->Qualifier
-------------<---->----------
TABLE11 <------>QUAL11
TABLE22 <------>QUAL22

and database name is different for testing and prod environment.

when ever I write cobol-db2 program I write query like select * from table11;select * from table22;
which means I write query independent of qualifier. got the doubt like how my db2 getting the qualifier during the run time. what I understand is it has to do something with the BIND. and I knew we can give QUALIFIER in BIND option. but in my shop we do not use QUALIFIER option and we use OWNER. during the bind time and run time I use DSN SYSTEM(I give database name here) as a input to IKJEFT01. I feel db2 decide the qualifier either by looking at the database name what ever I am giving in DSN command or it has to get based on OWNER option I give during BIND. can some one help me how exactly db2 getting qualifier name during the run time? it will fill all the gaps

Thank you.
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Tue Feb 05, 2013 12:48 pm
Reply with quote

Hi,

Please refer the below topics from DB2 9 for z/OS: Packages Revisited

2.1.8 OWNER in BIND PACKAGE and BIND PLAN
2.1.10 QUALIFIER in BIND PACKAGE and BIND PLAN
Back to top
View user's profile Send private message
Raghu navaikulam

Active User


Joined: 27 Sep 2008
Posts: 193
Location: chennai

PostPosted: Tue Feb 05, 2013 7:45 pm
Reply with quote

Hi Harsha,

Regarding qualifier, please visit the link given by Gnanas. I shall try to clear your doubt regarding database that you have mentioned.
Quote:
I use DSN SYSTEM(I give database name here) as a input to IKJEFT01.

DSN SYSTEM(subsystem-id). It is the ssid of the DB2 subsystem. To my knowledge, you can not give Database name there.

Thanks
Raghunathan
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 756
Location: Pennsylvania

PostPosted: Tue Feb 05, 2013 8:58 pm
Reply with quote

Quote:
when ever I write cobol-db2 program I write query like select * from table11;select * from table22;


Have you actually done this successfully?

My guess is NO.

The reason is, when the BIND is attempted, it looks for the tables existing for the Qualifier (or Owner is Qualifier is omitted).

If both tables mentioned in your sql do not exist for your qualifier, your Bind will fail.

If this is a homework question, get clarification from your instructor.

If this is a work question, speak with your colleagues or DBA for clarification.
Back to top
View user's profile Send private message
Harsha1525

New User


Joined: 22 Dec 2009
Posts: 24
Location: hyderabad

PostPosted: Wed Feb 06, 2013 10:07 am
Reply with quote

Gnanas N wrote:
Hi,

Please refer the below topics from DB2 9 for z/OS: Packages Revisited

2.1.8 OWNER in BIND PACKAGE and BIND PLAN
2.1.10 QUALIFIER in BIND PACKAGE and BIND PLAN

Thank you. I am going thru this book. I hope it answer all of my queries.
Back to top
View user's profile Send private message
Harsha1525

New User


Joined: 22 Dec 2009
Posts: 24
Location: hyderabad

PostPosted: Wed Feb 06, 2013 11:19 am
Reply with quote

daveporcelan wrote:
Quote:
when ever I write cobol-db2 program I write query like select * from table11;select * from table22;


Have you actually done this successfully?

My guess is NO.

The reason is, when the BIND is attempted, it looks for the tables existing for the Qualifier (or Owner is Qualifier is omitted).

If both tables mentioned in your sql do not exist for your qualifier, your Bind will fail.

If this is a homework question, get clarification from your instructor.

If this is a work question, speak with your colleagues or DBA for clarification.

yes i agree with you. during the bind it look for the qualifier. i am not telling both tables does not exists in qualifier.what exactly we do is, we bind with OWNER(own1).so if qualifier is not mentioned it has to derive from Owner.

Table name<--->Qualifier (creator)
-------------<---->----------
TABLE11 <------>QUAL11
TABLE22 <------>QUAL22
along with above structure I found below .
Alias name<--->Qualifier (creator)
-------------<---->----------
TABLE11 <------>OWN11
TABLE22 <------>OWN22

In the BIND card I give OWNER(OWN11).why I got confusion is like if I have to query table I have to write
select * from QUAL11.TABLE11 but i am giving the OWN11 in my bind card so how it is substituting QUAL11 instead of OWN11. as I mentioned I have alias same as table name. which has qualifier as OWN11. if I think like actually in my application I am firing query on alias not on table I believe all of my questions has answers.isn't it?
and if I read Gnanas shared manual link, I believe I should be fine.
it is not a kind of home work question. if I do not know this information also my application work fine. my intension is I want to fill the gaps in my knowledge.
Thank you.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 756
Location: Pennsylvania

PostPosted: Wed Feb 06, 2013 6:07 pm
Reply with quote

Quote:
as I mentioned I have alias same as table name. which has qualifier as OWN11. if I think like actually in my application I am firing query on alias not on table I believe all of my questions has answers.isn't it?


You did not mention you had an alias. icon_evil.gif

Leaving this information off completely waisted my time.

This is why I do not respond as often as I could.

This is why other posters get so angry.

Good luck obtaining your knowledge.
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 Error while fetching the record from ... COBOL Programming 3
No new posts UUID4 - extracting time element COBOL Programming 1
No new posts Cobol-db2 : SQL query is running for ... DB2 4
No new posts How to find orphaned MCDS D records. JCL & VSAM 18
No new posts compare two file to find position/dat... SYNCSORT 2
Search our Forums:

Back to Top