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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I want to control the execution of programs using control table

Status
Not open for further replies.

phashimoto

Programmer
Apr 18, 2001
1
0
0
JP
I am using Power Builder with SQL Server.
The following code has a problem. The counter 'proc_count'
has an incorrect value when any process cancels ('open'
without 'close'). Please, if some person knows the solution,
write me.

Process N (any process can not be executed if the special
process is executing):
'open'
select proc_count into :li_proc_count from control &
(updlock) where control_record = 1;
if li_proc_count = -9 then
rollback;
messagebox("Special process is executing", &
"Can not continue")
close(this)
else
update control set proc_count = proc_count + 1 &
where control_record = 1;
commit;
end if
'close'
update control set proc_count = proc_count - 1 &
where control_record = 1;
commit;

Special Process (must be executed alone):
'open'
select proc_count into :li_proc_count from control &
(updlock) where control_record = 1;
if li_proc_count = 0 then
update control set proc_count = -9 where &
control_record = 1;
commit;
else
rollback;
messagebox("Some process is executing", &
"Can not continue")
close(this)
end if
'close'
update control set proc_count = 0 where &
control_record = 1;
commit;


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top