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 - LOCK!

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:

MOVE POW-NUMERIC OF FCODIGO TO WS-CODIGO-SQL
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
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?!

Thanx for cooperation!

Nicola Losacco
From Brazil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top