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
 

 

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: 6968
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: 6968
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 XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm
No new posts pre-compiler for program in an HFS Pedro DB2 0 Fri Jun 23, 2017 11:13 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm


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