I inherited a bunch of problematic "final commits".  Per the following,
consider performing a "Lock.And.Write" as users change individual fields
within a record.

--Bill


*---------------------------------------------------------------------------
--------
  SUBROUTINE SUB.LOCK.AND.WRITE.R1 ( R.This, This.File, Record.ID )

  prompt ''

  open This.File to F.This.File  else  gosub  Error.Opening.File

  gosub Lock.And.Write
  go    The.End

*---------------------------------------------------------------------------
--
*---------------------------------------------------------------------------
--
Lock.And.Write:

  Lock.Test = recordlocked (F.This.File, Record.ID) 

  begin case
        case Lock.Test =  0   ;                recordlocku F.This.File,
Record.ID   
                                  write R.This          on F.This.File,
Record.ID 
                                                   release F.This.File,
Record.ID

        case 1                    ;  gosub Error.Record.Locking 
  end   case

return

*---------------------------------------------------------------------------
---
Error.Opening.File:

  crt @(-1)
  crt @(-5)

  crt
  crt
  crt
  crt
  crt
  crt
  crt
  crt
  crt
  crt
  crt
  crt '      Big Problem...                                ' : @(-6)
  crt
  crt ' _________________________                          '
  crt ' \                        \      ' : This.File
  crt '  \   Error Opening File   \                        '
  crt '   \________________________\    Contact HK.IT      '
  crt '                                               [X]  ' 
  crt '                                                '   :

  input Ans, 1
        Ans  = upcase(Ans)

  begin case
        case Ans = 'X'  ;  null
        case 1          ;  go Error.Opening.File   
  end   case
  
return to The.End

*---------------------------------------------------------------------------
---
Error.Record.Locking:

  crt @(-1)
  crt @(-5)

  crt
  crt
  crt
  crt
  crt
  crt
  crt
  crt
  crt
  crt '      Big Problem...                                ' : @(-6)
  crt
  crt ' _________________________                          '
  crt ' \                        \      ' : This.File
  crt '  \   Error, Record Lock   \                        '
  crt '   \________________________\    Contact HK.IT      '
  crt 
  crt '                                 Open New Gull Session, Try UNLOCK.ME
'                       
  crt '
[X]  ' 
  crt '
'   :

  input Ans, 1
        Ans  = upcase(Ans)

  begin case
        case Ans = 'X'  ;  null
        case 1          ;  go Error.Record.Locking
  end   case
  
return to The.End

*---------------------------------------------------------------------------
---
The.End:

  RETURN
  END

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Moderator
Sent: Wednesday, May 09, 2007 6:10 AM
To: u2-users@listserver.u2ug.org
Subject: [U2] Locks in a transaction


REPOSTED FOR NON-MEMBER: Greg Livingston <[EMAIL PROTECTED]>

I have a routine that runs in a transaction. Within the transaction I call a
routine that generates the next sequential number for the record key.  The
problem I'm having is that one of my customer records has so many
transaction to process that it holds the lock on the key generation program
and my other users then hang as they are waiting for the record to unlock.
Does anyone know a way of releasing the lock on a record with in a
transaction before the final commit?
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to