The other consideration is that each case statement uses the same
RECORDLOCKED(PICH.TX, SO) function reference, meaning it runs the function 3
times (according to your snippet).

I would normally assign the function result to a variable and test the
variable in the case statements:

stat.LOCK = RECORDLOCKED(PICH.TX, SO)

CASE stat.LOCK = ....
CASE stat.LOCK = ...

Gregor Scott

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of
raul_doming...@neimanmarcus.com
Sent: Wednesday, 16 December 2009 10:27 AM
To: U2 Users List
Subject: Re: [U2] RECORDLOCKED statement

The only consideration is that your second case statement picks up at -2 
instead of -1.

I think you are going for 
 CASE RECORDLOCKED(PICH.TX, SO) <= LOCK$OTHER.READL which is the -1 return 
value. At least according to the UniVerse documentation.

Regards,
Raul Dominguez
raul_doming...@neimanmarcus.com
972-401-6502



Baker Hughes <baker.hug...@mouser.com> 
Sent by: u2-users-boun...@listserver.u2ug.org
12/15/2009 05:17 PM
Please respond to
U2 Users List <u2-users@listserver.u2ug.org>


To
'U2 Users List' <u2-users@listserver.u2ug.org>
cc

Subject
[U2] RECORDLOCKED statement






I admit I have never used this little jewel of a [UV] statement, so 
although the code runs and works as designed, before I load it to 
production, someone please tell me if there are any nuances that would 
improve the design/operation.

      CASE RECORDLOCKED(PICH.TX, SO) >= LOCK$MY.READU
* This user/process already has a lock on the record, and we DO NOT
* WANT to clear the lock if process is ORDER.UPDATE so check the stack.
         IF INDEX(SYSTEM(9001),"ORDER.UPDATE",1) THEN
            WRITEVU "" ON PICH.TX, SO, 37
         END ELSE
            WRITEV "" ON PICH.TX, SO, 37
            RELEASE PICH.TX, SO
         END
         CLEARED.CCA.HOLD = TRUE

      CASE RECORDLOCKED(PICH.TX, SO) <= LOCK$OTHER.READU
* Another User has the record locked, we cannot update at this time
         ERR.NUM = 'C043'
         ERR.MSG = 'PICH.TX RECORD IS LOCKED, TRYING TO CLEAR CREDIT CARD 
HOLD'
         DOC.NUM = SO ; DOC.TYP = 'ORDER' ; FILE.NM = 'PICH.TX'
         GOSUB SEND.ERROR

      CASE RECORDLOCKED(PICH.TX, SO) =  LOCK$NO.LOCK
* There is no lock on this record presently, free and clear
         READVU HOLD.RSN FROM PICH.TX, SO, 37 LOCKED
* ...but that could change in 1 ms so still handle the locked condition.
            ERR.NUM = 'C043'
            ERR.MSG = 'PICH.TX RECORD IS LOCKED, TRYING TO CLEAR CREDIT 
CARD HOLD'
            DOC.NUM = SO ; DOC.TYP = 'ORDER' ; FILE.NM = 'PICH.TX'
            GOSUB SEND.ERROR
            RELEASE PICH.TX, SO
         END THEN WRITEV "" ON PICH.TX, SO, 37
         CLEARED.CCA.HOLD = TRUE
   END CASE


Thank you.
-Baker


This communication, its contents and any file attachments transmitted with 
it are intended solely for the addressee(s) and may contain confidential 
proprietary information.
Access by any other party without the express written permission of the 
sender is STRICTLY PROHIBITED.
If you have received this communication in error you may not copy, 
distribute or use the contents, attachments or information in any way. 
Please destroy it and contact the sender.
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
-- 
Message  protected by DealerGuard: e-mail anti-virus, anti-spam and content
filtering.
http://www.pentanasolutions.com

Click here to report this message as spam:
https://login.mailguard.com.au/report/1yT6IW24xN/50V5hqHqZ3Up5ajJTQzChu/3


_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to