Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How syntax check at Bind time is diff. from Pre-compilation

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

New User


Joined: 31 Aug 2016
Posts: 43
Location: India

PostPosted: Wed Mar 21, 2018 9:16 pm    Post subject: How syntax check at Bind time is diff. from Pre-compilation
Reply with quote

Hi All,

I have read that at pre-compilation stage DB2 does a syntax check for the sql query written in COBOL-DB2 program based on the table declaration values. But during Bind, it also checks the syntax of SQL with help from the data in the DB2 catalog.

But i am not sure what does it actually means and how it is different from pre-compilation time syntax check. Can anyone please explain the difference between these two syntax checking with an example.


Thanks a lot in Advance !
Back to top
View user's profile Send private message

Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1969
Location: NY,USA

PostPosted: Mon Mar 26, 2018 7:21 pm    Post subject:
Reply with quote

Quote:
But i am not sure what does it actually means and how it is different from pre-compilation time syntax check. Can anyone please explain the difference between these two syntax checking with an example

It is very simple.
1. SELECT int(abc from table a where abc>0
You will get pre compilation error because its a syntax error ")" is missing
2.Once you correct that to below the pre compilation will be successful. But at this point the abc column and table is not validated against the IBM catlog tables, so once you BIND then those all Catlog tables are engaged and validated so if abc is not part of table column then -206 is given and all other errors if present.
SELECT int(abc) from table a where abc>0

Read here futhe to know in detail.
Preparation process for an application program
Back to top
View user's profile Send private message
Poha Eater

New User


Joined: 31 Aug 2016
Posts: 43
Location: India

PostPosted: Wed Apr 04, 2018 9:49 pm    Post subject:
Reply with quote

Hi Rohit,

Thank you for taking out the time to respond on my query. But i am still in doubt. My understanding is, during Pre-compilation the INCLUDE statement member is copied in the program so when syntax check is performed during pre-compilation, it has column name for reference from DCLGEN and if the column name is not correct then it will give -206.

That is why i had the doubt that if this type of syntax check (wrong column name, bracket is missing, etc) is being done during Pre-compilation then what extra syntax check is happening during Bind time.

Please correct me if i am wrong.


Thank You !
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 714
Location: Pennsylvania

PostPosted: Wed Apr 04, 2018 10:58 pm    Post subject:
Reply with quote

Just because all the table information is correct with regard to the Include (DCLGEN), it does not mean the table/columns exist IN THE DATABASE.

For example, when a new table or column is added, it is probably only added to the DB2 TEST Subsystem regions. A bind to one of these regions (schemas) would be successful.

If however a bind is attempted to a Quality or Production region, where the changes have yet to be released, the bind would fail.

To summarize, a compile time, the syntax is checked and existence in the dclgen is done.

At bind time, existence in the database is required for a successful bind.
Back to top
View user's profile Send private message
Poha Eater

New User


Joined: 31 Aug 2016
Posts: 43
Location: India

PostPosted: Wed Apr 04, 2018 11:08 pm    Post subject:
Reply with quote

I got the picture now and the difference i was looking for. Thanks a lot Dave & Rohit for clearing out the doubt.

icon_biggrin.gif
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1969
Location: NY,USA

PostPosted: Thu Apr 05, 2018 12:01 am    Post subject:
Reply with quote

Quote:
so when syntax check is performed during pre-compilation, it has column name for reference from DCLGEN and if the column name is not correct then it will give -206.
No -206 is given at the time of Bind. In DCLGEN column name is for ref. purpose only. You don't need DECLGEN always, you can declare as copybook too instead.
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 How to control the elapsed time for a... Philippe JCL & VSAM 12 Thu Aug 09, 2018 5:54 pm
No new posts JCL COND CODE check juares castro JCL & VSAM 5 Tue Jun 26, 2018 7:43 pm
No new posts Submit JCL to INTRDR and check the st... srajendran2 COBOL Programming 7 Sat Jun 16, 2018 1:30 am
No new posts Run time proc edit Niki JCL & VSAM 7 Fri Jun 08, 2018 5:42 pm
No new posts JCL to set Return code when Time Out ... vinu78 JCL & VSAM 6 Wed May 30, 2018 11:27 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us