Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NETCOBOL with SQL Server 2000

Status
Not open for further replies.

merlinthemago

Programmer
May 14, 2003
2
BR
Hi Everybody!

I need understand the LOCK of SQL. I´m development a program with instructions of SQL Syntax. Imagine, Client A and Client B, for the routine below, i hope that you understand (because is a COBOL Language), but is a SQL Syntax.

MOVE POW-NUMERIC OF FCODIGO TO WS-CODIGO-SQL (moving the DATA of FORM to VARIABLE)
EXEC SQL
DECLARE EDT CURSOR FOR
SELECT CODIGO, DESCRICAO FROM NATUREZAS WHERE CODIGO = :WS-CODIGO-SQL
END-EXEC
EXEC SQL
WHENEVER SQLERROR GO TO:p-ERROR
END-EXEC.
P-START.
EXEC SQL
OPEN EDT
END-EXEC
EXEC SQL
FETCH EDT INTO :TNAT-CODIGO, :TNAT-DESCRICAO
END-EXEC
DISPLAY SQLCODE SQLSTATE (SHOW THE RETURN CODES)
EXEC SQL
CLOSE EDT
END-EXEC
CALL "MOVE-DATA"
CALL "ENABLE-DATA"
GOBACK.

P-ERROR.
DISPLAY SQLSTATE SQLCODE
GOBACK

Well, when Client A, get the data, for exemple, CODIGO = 5, and Client B, execute the same program with the CODIGO = 5, the LOCK occurs at SQLServer. This is correct, because the Client B, will not be able alter this data while the Client A liberate the data. Occurs that, when the program execute the instruction EXEC SQL FETCH EDT INTO :TNAT-CODIGO, :TNAT-DESCRICAO END-EXEC, my application for Client B, stop and i don´t have more controller above my program. I obtain to controller again, when the Client A desists of data, with ROLLBACK or COMMIT instructions. I question: Exists any configuration for execute in the SQL Server, for this problem finish?!

Thanx for cooperation!

Nicola Losacco
From Brazil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top