Page 1 of 1
SQLSTATE and SQLCODE in COBOL 6.2.
Posted: Fri Apr 02, 2021 10:43 pm
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.
Re: SQLSTATE and SQLCODE in COBOL 6.2.
Posted: Sat Apr 03, 2021 8:30 pm
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
Re: SQLSTATE and SQLCODE in COBOL 6.2.
Posted: Tue Apr 06, 2021 1:18 pm
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.
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.