Highlighted
Absent Member.
Absent Member.
791 views

Test insert update success

Jump to solution

HI,

I have many question to post because I returned to Cobol years later. The most important question regards the database pre-compiler. In particular:

1) With EXEC SQL Can I set isolation level and begin transaction ?

2) How Can I test if an insert or updated does not succeed because of constraints violations?

3) If I set autocommit disabled in SQl properties can I use commit and rollback ?

4) To set a null value it is sufficient move -1 to :name-fileld-null  ?

Claudio 

Tags (1)
0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Test insert update success

Jump to solution

Hi Claudio,

I am assuming that your are using a native code project on Windows and you are using ODBC with OpenESQL, is that correct?

You can set the isolation level for a transaction in several different ways.
You can set it using the ISOLATION compiler directive or as part of the BEHAVIOR directive.
You can also use the EXEC SQL SET TRANSACTION ISOLATION statement.

Please see the documentation here:

You might also look at the DECLARE CURSOR as you can set concurrency options directly when declaring the cursor.

If an insert or update fails then the sqlcode should be set to the appropriate error code and the error message will be placed in the sqlerrmc field of the SQLCA structure.

If you turn off AUTOCOMMIT then yes, you can use EXEC SQL BEGIN TRANS with ROLLBACK or COMMIT to control your own transactions.

To set a null value in a column you would move a -1 to the associated null indicator.

Thanks.

View solution in original post

0 Likes
1 Reply
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Test insert update success

Jump to solution

Hi Claudio,

I am assuming that your are using a native code project on Windows and you are using ODBC with OpenESQL, is that correct?

You can set the isolation level for a transaction in several different ways.
You can set it using the ISOLATION compiler directive or as part of the BEHAVIOR directive.
You can also use the EXEC SQL SET TRANSACTION ISOLATION statement.

Please see the documentation here:

You might also look at the DECLARE CURSOR as you can set concurrency options directly when declaring the cursor.

If an insert or update fails then the sqlcode should be set to the appropriate error code and the error message will be placed in the sqlerrmc field of the SQLCA structure.

If you turn off AUTOCOMMIT then yes, you can use EXEC SQL BEGIN TRANS with ROLLBACK or COMMIT to control your own transactions.

To set a null value in a column you would move a -1 to the associated null indicator.

Thanks.

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.