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
 
INITIALIZE SQLCODE - what does this do in Cobol DB2 program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> ABENDS & Debugging
View previous topic :: :: View next topic  
Author Message
sm_2009

New User


Joined: 10 May 2009
Posts: 72
Location: bangalore

PostPosted: Tue May 12, 2009 1:36 pm    Post subject: INITIALIZE SQLCODE - what does this do in Cobol DB2 program
Reply with quote

hi all,

can anyone tell me what does this statement 'INITIALIZE SQLCODE' do in a cobol-db2 program.

it is placed just before any SQL query (EXEC SQL) in program.

thanks
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

PostPosted: Tue May 12, 2009 2:50 pm    Post subject:
Reply with quote

INITIALIZE SQLCODE will populate the field, SQLCODE, with zero.

It just shows that the coder does not understand DB2.

He probably got burnt checking the SQLCODE after a DECLARE Cursor and did not learn anything.
Back to top
View user's profile Send private message
sm_2009

New User


Joined: 10 May 2009
Posts: 72
Location: bangalore

PostPosted: Tue May 12, 2009 3:00 pm    Post subject: Reply to: INITIALIZE SQLCODE - what does this do in Cobol DB
Reply with quote

Thanks.

probably you are right. the coder might not undersatnd DB2.
And this is the way one learns.

but this may be true that the coder got to know about the statement from some where and tries to find out its usage.

Using INITIALIZE SQLCODE before each SQL query, moves LOW-VALUES to SQLCODE. This avoids garbage value in the variable.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

PostPosted: Tue May 12, 2009 4:34 pm    Post subject:
Reply with quote

were you trying to say something with your 'bold' font?

Quote:
Using INITIALIZE SQLCODE before each SQL query, moves LOW-VALUES to SQLCODE.

It populates the COMP field, SQLCODE, with binary zeroes.

Which are often interpreted as low-values in a COMP field
by those overwhelmed and challanged by technical terms
or incapable of being precise.

LOW-VALUES is an alphanumeric figurative constant
and as such, can not be MOVED to a COMP field, ya' gotta move the
NUMERIC figurative constant - ZERO.
(sorry about my 'boldness', but it is a rather important distinction.

Quote:
This avoids garbage value in the variable.

which only has a meaning if some idiot checks the SQLCODE before a CALL to 'db2', (or after a DECLARE Cursor).
DB2 always populates the SQLCODE during a CALL to a DB2 service invoked by SQL.
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 May 12, 2009 8:28 pm    Post subject:
Reply with quote

Hello,

Quote:
which only has a meaning if some idiot checks the SQLCODE before a CALL to 'db2', (or after a DECLARE Cursor).
And if this has been done, it should probably be removed lest it confuse someone as actually having some worth. . .
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 -> ABENDS & Debugging All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Linkage editor is part of COBOL, z/OS... ankit.jain COBOL Programming 4 Fri Apr 20, 2018 4:17 pm
This topic is locked: you cannot edit posts or make replies. Difference between EQUAL and EQUAL TO... jithinraghavan COBOL Programming 3 Thu Apr 19, 2018 2:22 am
No new posts How do you attach a DB2 plan to a CIC... John Poulakos DB2 0 Wed Apr 18, 2018 1:49 am
No new posts Call COBOL or PLI with a click from w... vaibhav gs All Other Mainframe Topics 1 Mon Apr 16, 2018 7:29 pm
No new posts VSAM file NOT Found error while proce... SumaReva CICS 5 Wed Apr 11, 2018 9:54 pm

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