See below for modification.

Bob Woodward
Programmer/Analyst
Harbor Wholesale Grocery
[EMAIL PROTECTED]


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:owner-u2-
> [EMAIL PROTECTED] On Behalf Of Wendy Smoak
> Sent: Friday, October 29, 2004 2: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'     ;* KEY VALUE IS LOCKED
     RCD.EXISTS = 1     ;* RCD IS IN FILE
> * END ;*END READU
  END ELSE
     X.LOCKED = 1               ;* KEY VALUE IS LOCKED
     RCD.EXISTS = 0     ;* RCD NOT IN FILE
  END
> 
> 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