Microsoft KB Archive/112986

{|
 * width="100%"|

The information in this article applies to: - Microsoft Embedded SQL version 4.21 for COBOL BUG# 9905 (4.21)

SYMPTOMS
In Embedded SQL for Cobol (ESQL/COBOL) applications, a transaction name in a user-defined transaction is ignored during run time. For example, if the ESQL/COBOL statement is BEGIN TRAN MYTRAN, only BEGIN TRAN is sent to SQL Server at run time, and MYTRAN is ignored.

This does not cause any problems with BEGIN TRAN, COMMIT TRAN or ROLLBACK TRAN, as the transaction name is optional. However, when SAVE TRAN is used, a syntax error will occur at run time because SAVE TRAN requires a transaction name:

Syntax error near "tran"

CAUSE
SQL Server Embedded SQL for COBOL incorrectly ignores transaction names for user-defined transactions.

WORKAROUND
As a single transaction management statement is never compiled into a stored procedure, you can always use the EXECUTE IMMEDIATE command to send the statement to SQL Server via a host variable. For example, to execute SAVE TRAN MYTRAN, you can first declare a host variable "hvar", copy the string into the variable, and execute it:

EXEC SQL BEGIN DECLARE SECTION END-EXEC 01 hvar         pic x(80). EXEC SQL END DECLARE SECTION END-EXEC ...  MOVE "SAVE TRAN MYTRAN" to hvar.

EXEC SQL EXECUTE IMMEDIATE :hvar END-EXEC

STATUS
Microsoft has confirmed this to be a problem in SQL Server Embedded SQL for COBOL version 4.21. We are currently researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
 * }

-

Last reviewed: April 29, 1997

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.