Wendy,

        We're on UV 10.1.2, on AIX.  We have the READU..LOCKED..THEN..ELSE logic in 
MANY of our programs:

READU dyn.arr FROM F.FILE1,rec.id LOCKED
   ***handle the locked condition
END THEN
   * do the update
END ELSE
   * type in the right item-id, dude!
END

        If you have an example of one that's not compiling right, post the code for us 
to examine.  This logic worked on UV 9.6 as well...

--Ron P.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Wendy Smoak
Sent: Friday, October 29, 2004 4:08 PM
To: [EMAIL PROTECTED]
Subject: [U2] READU ... THEN _or_ ELSE but not both?


>From the documentation:

READU dyn.array.var FROM [file.var,] record.ID.expr [LOCKED statements]
[ON ERROR statements] {THEN statements [END] | ELSE statements [END]}

Am I reading this right?  When I READU I can either have a THEN or an
ELSE, but not both?  (That it does not compile with both tends to
confirm that...) 

At the moment I think I need both. :/ And I need to do the same thing in
either case, so I ended up with:

READU R.XBWU FROM F.XBWU, X.ONE.ID LOCKED
   CRT 'XBWU RECORD IS LOCKED, IGNORE IT'
END THEN
   X.LOCKED = '1'
END ;*END READU

IF X.LOCKED = '1' THEN
   CRT 'OBTAINED LOCK ON XBWU RECORD'
   R.XBWU<XBWU.ASURITE> = X.ASURITE
   WRITE R.XBWU TO F.XBWU, X.ONE.ID ON ERROR
      IF STATUS() = 10 THEN 
         ;* Either the ASURITE or USER.ID is duplicated
         X.ERROR = X.DUPLICATE.ON.WRITE
      END ;* IF STATUS
   END ;* END WRITE
END ;* IF X.LOCKED

Suggestions for improvement are welcome!

-- 
Wendy Smoak
-------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to