View previous topic :: View next topic
|
Author |
Message |
sm_2009
New User
Joined: 10 May 2009 Posts: 72 Location: bangalore
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
sm_2009
New User
Joined: 10 May 2009 Posts: 72 Location: bangalore
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|