SQLSTATE and SQLCODE in COBOL 6.2.

RDBMS from IBM and IBM's Hierarchical DBMS and Transaction Manager (IMS DC).
Post Reply
LalitaForums
New Member
Posts: 8
Joined: Thu Jul 31, 2014 11:33 am

SQLSTATE and SQLCODE in COBOL 6.2.

Post by LalitaForums »

Hi,

Is there been a change the way SQLSTATE and SQLCODE are treated in cobol 6.2? I had been searching for it but could not really loacte something worthwhile on IBM site.

https://www.google.com/search?q=SQLSTAT ... e&ie=UTF-8

If some one can provide a direction about this, would appreciate that.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: SQLSTATE and SQLCODE in COBOL 6.2.

Post by Robert Sample »

What do you think has changed? Since SQLSTATE and SQLCODE are really part of DB2 and not COBOL, it is unlikely that they were changed in COBOL 6.2 -- however, there were a lot of changes in 6.2 and it is entirely possible that one or more of those changes impacted the way SQLSTATE and SQLCODE are implemented in COBOL. The only mention of SQL in the What's new in Enterprise COBOL 6.2 manual is a statement that messages will not be generated for even-digit packed decimal variables starting with SQL (and other system prefixes) -- as long as a certain PTF is applied. This can be seen at https://www.ibm.com/docs/en/cobol-zos/6 ... um__sum004
LalitaForums
New Member
Posts: 8
Joined: Thu Jul 31, 2014 11:33 am

Re: SQLSTATE and SQLCODE in COBOL 6.2.

Post by LalitaForums »

We have our compiler being changed to COBOL 6.2. I am part of a Team who is compiling the programs and reporting those errors. Now we have got the instruction that – SQLSTATE needs to change to SQLCODE only if it is being used to evaluate the response. If it is used to record the SQLSTATE then it does not need to be changed.

For example, a program, PGM1, is moving SQLSTATE to a program specific SQLSTATE field so that if the program abends, both SQLCODE and SQLSTATE are known. This does not need to change.

Code: Select all

MOVE SQLSTATE TO EMR-SQLSTATE.
In another program, PGM2, SQLSTATE is being used to evaluate the success of the DB2 call and should be changed to check SQLCODE.

Code: Select all

IF SQLSTATE = DB2-NORESP
    some process
END-IF
I looked at the documentation of COBOL 6.2 but it didn't really referred to any such notion or I could not find it yet.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM DB2 and IMS DB/DC”