I am trying to make sure that if one Customer.Service rep is updating a
Sales Order, then the other Cust.Svc rep is 
blocked from accessing the same record.

The following code will indicates that the record is locked but when the 2nd
user goes in (in an independent session), the second user gets in no
problem.

Since it does not seem to do what I think that it should, [1] I am wondering
if I am missing something.  [2] I am inclined to create a file to handle
this (brute force) with multivalues for user, port, time, date, program,
file, record.

Comments would be appreciated.

--Bill



  SUBROUTINE SUB.LOCK.SOH.R0 ( Record.ID, Error.Code )

  prompt ''

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

  gosub Lock.And.Hold

  go    The.End

*---------------------------------------------------------------------------
--
*---------------------------------------------------------------------------
--
Lock.And.Hold:

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

 crt '**11 Lock.Test ' : Lock.Test : '  [<] ' 
 input Ans

  begin case
        case Lock.Test =  0  ;  recordlocku F.This.File, Record.ID   
        case 1               ;  gosub Error.Record.Locked 
  end   case

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

 crt '**12 Lock.Test ' : Lock.Test : '  [<] ' 
 input Ans

return

*---------------------------------------------------------------------------
---
Error.Record.Locked: 

  Lock.Test = recordlocked (F.This.File, Record.ID) 
 
  crt '**13 Lock.Test ' : Lock.Test : '  [<] ' 
  input Ans

  Error.Code = 'E'    

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

  crt
  crt
  crt
  crt
  crt
  crt
  crt
  crt
  crt
  crt '                                                    ' : @(-6)
  crt
  crt ' ___________________________                          '
  crt ' \                          \                         ' 
  crt '  \   Error, Record Locked   \                        '
  crt '   \__________________________\    Try Later          '
  crt '                                                      '
  crt '                                                      '

  crt '                                              [X]  ' 
  crt '                                               '   :

  input Ans, 1
        Ans  = upcase(Ans)

  begin case
        case Ans = 'X'  ;  null
        case 1          ;  go Error.Record.Locked 
  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 ' \                        \      SOH                '
  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

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

  RETURN
  END
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to