openmainframeproject / cobol-programming-course

Training materials and labs for a "Getting Started" level course on COBOL
https://openmainframeproject.org/projects/cobol-programming-course/
Creative Commons Attribution 4.0 International
3.04k stars 589 forks source link

Handling SQL error codes #283

Closed vargajb closed 2 years ago

vargajb commented 2 years ago

Signed-off-by: Janos Varga 113785741+vargajb@users.noreply.github.com

Proposed changes

Handling SQL error codes after the SQL statements. If I compile the program without bind, the error message looks like this:

ERROR AT OPEN CUR1
 DSNT408I SQLCODE = -805, ERROR:  PACKAGE NAME DALLASC..CBLDB21.1B89E5800200F25A NOT FOUND IN PLAN Z91361. REASON 03
 DSNT418I SQLSTATE   = 51002 SQLSTATE RETURN CODE
 DSNT415I SQLERRP    = DSNXEPM SQL PROCEDURE DETECTING ERROR
 DSNT416I SQLERRD    = -251  0  0  -1  0  0 SQL DIAGNOSTIC INFORMATION
 DSNT416I SQLERRD    = X'FFFFFF05'  X'00000000'  X'00000000'  X'FFFFFFFF'  X'00000000'  X'00000000' SQL DIAGNOSTIC INFORMATION

If this modification is appropriate, I will also include SQL error handling in the other programs (CBLDB22.cbl and CBLDB23.cbl).

Fixes # (issue)

Type of change

What type of changes does your PR introduce to the COBOL Programming Course? Put an x in the boxes that apply.

Checklist:

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This checklist will be used as reference for both the contributor and the reviewer

tanto259 commented 2 years ago

Looks good to me! If you can add the error handling code to the CBLDB22 and CBLDB23, that will be great :)

vargajb commented 2 years ago

@tanto259