Re: [U2] Record locks (Unidata 7.2)

2013-02-07 Thread Mecki Foerthmann

The READU statement has a LOCKED clause that is true if a record is locked.
You can put all your locking ha logic in there.
READU record FROM filevariable,itemID THEN
   code if record exists and isn't locked (optional)
LOCKED
   code to handle locked record condition (optional)
END ELSE
   code if record doesn't exist (required)
END

Now if you put that into a loop you can display a message and give the 
user the option to try again or abort.
And if you put the code into a subroutine you can use that in all your 
programs with a single line like this.

CALL SR.READU(record,filevariable,ItemID,Option,Err)

On 06/02/2013 21:52, Jon Wells wrote:

Hi all,

I have not looked at the world of record locks since my R83 Pick days.  I'm 
hoping to add the ability for the program I'm working on to:

* Check if a record is locked
* Wait until the lock is removed
* Once the lock is removed, or if the record is not locked:
* Lock the record
* Perform the WRITE statement
I'm hoping someone can share an example of how to accomplish this in UniBasic. 



Thank you,


Jon Wells
Campbell University
___
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


Re: [U2] Record locks (Unidata 7.2)

2013-02-07 Thread Charlie Noah
Perhaps we should apply a little Systems Analysis 101 here - ask some 
questions. I'm not convinced that the original request completely 
described the need.


What is the logical scenario (batch update, transaction entry, file 
maintenance, etc.)?
Once a lock is removed, do you want your copy of the record to be 
written regardless of why it was locked in the first place, possibly 
overwriting someone else's changes?

Why do you want to do it this way?

I'm sure there are other questions, but these will do for a start. If, 
as Will suggested, this is a job application test, the OP should answer 
that more information is needed. Technically, what was described is 
completely doable, but is it the correct thing to do?


Regards,
Charlie Noah

Tiny Bear's Wild Bird Store
Home of Safety Net Shipping
http://www.TinyBearWildBirdStore.com
Toll Free: 1-855-TinyBear (855-846-9232)

On 02-07-2013 2:26 AM, Mecki Foerthmann wrote:
The READU statement has a LOCKED clause that is true if a record is 
locked.

You can put all your locking ha logic in there.
READU record FROM filevariable,itemID THEN
   code if record exists and isn't locked (optional)
LOCKED
   code to handle locked record condition (optional)
END ELSE
   code if record doesn't exist (required)
END

Now if you put that into a loop you can display a message and give the 
user the option to try again or abort.
And if you put the code into a subroutine you can use that in all your 
programs with a single line like this.

CALL SR.READU(record,filevariable,ItemID,Option,Err)

On 06/02/2013 21:52, Jon Wells wrote:

Hi all,

I have not looked at the world of record locks since my R83 Pick 
days.  I'm hoping to add the ability for the program I'm working on to:


* Check if a record is locked
* Wait until the lock is removed
* Once the lock is removed, or if the record is not locked:
* Lock the record
* Perform the WRITE statement
I'm hoping someone can share an example of how to accomplish this in 
UniBasic.


Thank you,


Jon Wells
Campbell University
___
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



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


Re: [U2] Record locks (Unidata 7.2)

2013-02-07 Thread Woodward, Bob
Sorry Mecki but I think you have the LOCKED in the wrong place.  At
least in my version of Unidata.  It comes before the THEN segment so the
full, proper syntax would be:

READU xxx FROM xxx, xxx ON ERROR
  Xxx what to do if a hard error like file not open
END LOCKED
  Xxx what to do if locked
END THEN
  Xxx what to do if lock is obtained and record is read
END ELSE
  Xxx what to do if lock is obtained but record does not exist.
END

There is a second format for the READU command but it's a lot easier if
the OP just reads about, himself, in the HELP information.  HELP
UNIBASIC READU from ECL in Unidata will get him that.

 

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Mecki
Foerthmann
Sent: Thursday, February 07, 2013 12:27 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Record locks (Unidata 7.2)

The READU statement has a LOCKED clause that is true if a record is
locked.
You can put all your locking ha logic in there.
READU record FROM filevariable,itemID THEN
code if record exists and isn't locked (optional) LOCKED
code to handle locked record condition (optional) END ELSE
code if record doesn't exist (required) END

Now if you put that into a loop you can display a message and give the
user the option to try again or abort.
And if you put the code into a subroutine you can use that in all your
programs with a single line like this.
CALL SR.READU(record,filevariable,ItemID,Option,Err)

On 06/02/2013 21:52, Jon Wells wrote:
 Hi all,

 I have not looked at the world of record locks since my R83 Pick days.
I'm hoping to add the ability for the program I'm working on to:

   * Check if a record is locked
   * Wait until the lock is removed
   * Once the lock is removed, or if the record is not locked:
   * Lock the record
   * Perform the WRITE statement
 I'm hoping someone can share an example of how to accomplish this in
UniBasic. 


 Thank you,


 Jon Wells
 Campbell University
 ___
 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
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


[U2] Turn pagination back on

2013-02-07 Thread Wjhonson
Someone remind me, how to do this.

If pagination has been turned off, and for my embedded routine, I want to turn 
it back on again.
How do I do this?

I've tried HEADING, and PAGE, and CRT @(0,0)
I know there's a trick but I can't quite recall what it is

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


Re: [U2] Turn pagination back on

2013-02-07 Thread David A. Green
BPIOCP

David A. Green
(480) 813-1725
DAG Consulting

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Thursday, February 07, 2013 1:21 PM
To: u2-users@listserver.u2ug.org
Subject: [U2] Turn pagination back on

Someone remind me, how to do this.

If pagination has been turned off, and for my embedded routine, I want to
turn it back on again.
How do I do this?

I've tried HEADING, and PAGE, and CRT @(0,0) I know there's a trick but I
can't quite recall what it is

___
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


Re: [U2] Turn pagination back on

2013-02-07 Thread larryh
BPIOCP (UD)
CALL !BPIOCP (UV)

Larry Hiscock
Western Computer Services


 Someone remind me, how to do this.

 If pagination has been turned off, and for my embedded routine, I want to
 turn it back on again.
 How do I do this?

 I've tried HEADING, and PAGE, and CRT @(0,0)
 I know there's a trick but I can't quite recall what it is

 ___
 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


Re: [U2] Turn pagination back on

2013-02-07 Thread Chris Austin

For pagination we setup an I-Descriptor for a CLIENT table as follows:

ROW_NUMBER I  @1+1 ; INT(@1)MD0  Row Number  5R 
S

The trick is the @1+1 ; INT(@1) bit.

Chris

   

 From: dgr...@dagconsulting.com
 To: u2-users@listserver.u2ug.org
 Date: Thu, 7 Feb 2013 13:28:23 -0700
 Subject: Re: [U2] Turn pagination back on
 
 BPIOCP
 
 David A. Green
 (480) 813-1725
 DAG Consulting
 
 -Original Message-
 From: u2-users-boun...@listserver.u2ug.org
 [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
 Sent: Thursday, February 07, 2013 1:21 PM
 To: u2-users@listserver.u2ug.org
 Subject: [U2] Turn pagination back on
 
 Someone remind me, how to do this.
 
 If pagination has been turned off, and for my embedded routine, I want to
 turn it back on again.
 How do I do this?
 
 I've tried HEADING, and PAGE, and CRT @(0,0) I know there's a trick but I
 can't quite recall what it is
 
 ___
 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
  
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Record locks (Unidata 7.2)

2013-02-07 Thread Jon Wells
What I'm wondering is; what can I put into the 'Xxx what to do if locked' 
section whereby it waits until the record lock clears, once it clears, set my 
own lock, read the record, alter the record, and then write the record (which 
would release my lock)?


Thank you,

Jon Wells



 From: Woodward, Bob bob_woodw...@k2sports.com
To: U2 Users List u2-users@listserver.u2ug.org 
Sent: Thursday, February 7, 2013 12:35 PM
Subject: Re: [U2] Record locks (Unidata 7.2)
 
Sorry Mecki but I think you have the LOCKED in the wrong place.  At
least in my version of Unidata.  It comes before the THEN segment so the
full, proper syntax would be:

READU xxx FROM xxx, xxx ON ERROR
  Xxx what to do if a hard error like file not open
END LOCKED
  Xxx what to do if locked
END THEN
  Xxx what to do if lock is obtained and record is read
END ELSE
  Xxx what to do if lock is obtained but record does not exist.
END

There is a second format for the READU command but it's a lot easier if
the OP just reads about, himself, in the HELP information.  HELP
UNIBASIC READU from ECL in Unidata will get him that.



-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Mecki
Foerthmann
Sent: Thursday, February 07, 2013 12:27 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Record locks (Unidata 7.2)

The READU statement has a LOCKED clause that is true if a record is
locked.
You can put all your locking ha logic in there.
READU record FROM filevariable,itemID THEN
    code if record exists and isn't locked (optional) LOCKED
    code to handle locked record condition (optional) END ELSE
    code if record doesn't exist (required) END

Now if you put that into a loop you can display a message and give the
user the option to try again or abort.
And if you put the code into a subroutine you can use that in all your
programs with a single line like this.
CALL SR.READU(record,filevariable,ItemID,Option,Err)

On 06/02/2013 21:52, Jon Wells wrote:
 Hi all,

 I have not looked at the world of record locks since my R83 Pick days.
I'm hoping to add the ability for the program I'm working on to:

     * Check if a record is locked
     * Wait until the lock is removed
     * Once the lock is removed, or if the record is not locked:
     * Lock the record
     * Perform the WRITE statement
 I'm hoping someone can share an example of how to accomplish this in
UniBasic. 


 Thank you,


 Jon Wells
 Campbell University
 ___
 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
___
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


Re: [U2] Record locks (Unidata 7.2)

2013-02-07 Thread John Jenkins
A WRITE automatically clears the lock, a WRITEU will keep it. If you are inside 
a transaction boundary however, then the lock is kept until the transaction is 
committed or abandoned.

Regards
JayJay



On 7 Feb 2013, at 20:46, Jon Wells jwaytwe...@yahoo.com wrote:

 What I'm wondering is; what can I put into the 'Xxx what to do if locked' 
 section whereby it waits until the record lock clears, once it clears, set my 
 own lock, read the record, alter the record, and then write the record (which 
 would release my lock)?
 
 
 Thank you,
 
 Jon Wells
 
 
 
 From: Woodward, Bob bob_woodw...@k2sports.com
 To: U2 Users List u2-users@listserver.u2ug.org 
 Sent: Thursday, February 7, 2013 12:35 PM
 Subject: Re: [U2] Record locks (Unidata 7.2)
 
 Sorry Mecki but I think you have the LOCKED in the wrong place.  At
 least in my version of Unidata.  It comes before the THEN segment so the
 full, proper syntax would be:
 
 READU xxx FROM xxx, xxx ON ERROR
   Xxx what to do if a hard error like file not open
 END LOCKED
   Xxx what to do if locked
 END THEN
   Xxx what to do if lock is obtained and record is read
 END ELSE
   Xxx what to do if lock is obtained but record does not exist.
 END
 
 There is a second format for the READU command but it's a lot easier if
 the OP just reads about, himself, in the HELP information.  HELP
 UNIBASIC READU from ECL in Unidata will get him that.
 
 
 
 -Original Message-
 From: u2-users-boun...@listserver.u2ug.org
 [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Mecki
 Foerthmann
 Sent: Thursday, February 07, 2013 12:27 AM
 To: u2-users@listserver.u2ug.org
 Subject: Re: [U2] Record locks (Unidata 7.2)
 
 The READU statement has a LOCKED clause that is true if a record is
 locked.
 You can put all your locking ha logic in there.
 READU record FROM filevariable,itemID THEN
 code if record exists and isn't locked (optional) LOCKED
 code to handle locked record condition (optional) END ELSE
 code if record doesn't exist (required) END
 
 Now if you put that into a loop you can display a message and give the
 user the option to try again or abort.
 And if you put the code into a subroutine you can use that in all your
 programs with a single line like this.
 CALL SR.READU(record,filevariable,ItemID,Option,Err)
 
 On 06/02/2013 21:52, Jon Wells wrote:
 Hi all,
 
 I have not looked at the world of record locks since my R83 Pick days.
 I'm hoping to add the ability for the program I'm working on to:
 
 * Check if a record is locked
 * Wait until the lock is removed
 * Once the lock is removed, or if the record is not locked:
 * Lock the record
 * Perform the WRITE statement
 I'm hoping someone can share an example of how to accomplish this in
 UniBasic. 
 
 
 Thank you,
 
 
 Jon Wells
 Campbell University
 ___
 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
 ___
 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
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Record locks (Unidata 7.2)

2013-02-07 Thread Woodward, Bob
With the LOCKED clause included, the READU does not pause.  You can put 
anything you want in that section but just realize that the statement fully 
executes and proceeds to the next command.  If you want to simulate wait until 
I obtain the lock then you just have to create this into a small loop.  
Something like this:

LOCKWAIT:
READU xxx FROM yyy, zzz LOCKED
  Xxx commands, if you want to do anything other than just loop
  GOTO LOCKWAIT
END THEN
  Xxx got the lock and have read the record so do whatever
  Xxx14 = I was here
END ELSE
  Xxx got the lock but it's a new record.
  Xxx = 
  Xxx14 = I was here
END
Do some more stuff.
WRITE xxx ON yyy, zzz

You don't HAVE to do anything in the locked section other than just goto your 
label.  You could add a small delay, if you wanted, just so your process isn't 
in a super tight loop chewing up all your computers horsepower.

Also, remember, you need to do something with the lock, even if it's a new 
record.  Either a WRITE or RELEASE statement on the zzz key value.

BobW


-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Jon Wells
Sent: Thursday, February 07, 2013 12:47 PM
To: U2 Users List
Subject: Re: [U2] Record locks (Unidata 7.2)

What I'm wondering is; what can I put into the 'Xxx what to do if locked' 
section whereby it waits until the record lock clears, once it clears, set my 
own lock, read the record, alter the record, and then write the record (which 
would release my lock)?


Thank you,

Jon Wells



 From: Woodward, Bob bob_woodw...@k2sports.com
To: U2 Users List u2-users@listserver.u2ug.org
Sent: Thursday, February 7, 2013 12:35 PM
Subject: Re: [U2] Record locks (Unidata 7.2)
 
Sorry Mecki but I think you have the LOCKED in the wrong place.  At least in my 
version of Unidata.  It comes before the THEN segment so the full, proper 
syntax would be:

READU xxx FROM xxx, xxx ON ERROR
  Xxx what to do if a hard error like file not open END LOCKED
  Xxx what to do if locked
END THEN
  Xxx what to do if lock is obtained and record is read END ELSE
  Xxx what to do if lock is obtained but record does not exist.
END

There is a second format for the READU command but it's a lot easier if the OP 
just reads about, himself, in the HELP information.  HELP UNIBASIC READU from 
ECL in Unidata will get him that.



-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Mecki Foerthmann
Sent: Thursday, February 07, 2013 12:27 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Record locks (Unidata 7.2)

The READU statement has a LOCKED clause that is true if a record is locked.
You can put all your locking ha logic in there.
READU record FROM filevariable,itemID THEN
    code if record exists and isn't locked (optional) LOCKED
    code to handle locked record condition (optional) END ELSE
    code if record doesn't exist (required) END

Now if you put that into a loop you can display a message and give the user the 
option to try again or abort.
And if you put the code into a subroutine you can use that in all your programs 
with a single line like this.
CALL SR.READU(record,filevariable,ItemID,Option,Err)

On 06/02/2013 21:52, Jon Wells wrote:
 Hi all,

 I have not looked at the world of record locks since my R83 Pick days.
I'm hoping to add the ability for the program I'm working on to:

     * Check if a record is locked
     * Wait until the lock is removed
     * Once the lock is removed, or if the record is not locked:
     * Lock the record
     * Perform the WRITE statement
 I'm hoping someone can share an example of how to accomplish this in
UniBasic. 


 Thank you,


 Jon Wells
 Campbell University
 ___
 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
___
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
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Record locks (Unidata 7.2)

2013-02-07 Thread Peter Cheney
I think it would also be useful to add some form of exit routine inside the 
LOCKWAIT loop.
Something like a counter to only allow say 10 attempts at trying to obtain the 
lock.
That way you don't keep looping for ever if some other process which has the 
lock does not release it for whatever reason.
Cheers
Peter

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Woodward, Bob
Sent: Friday, 8 February 2013 7:02
To: Jon Wells; U2 Users List
Subject: Re: [U2] Record locks (Unidata 7.2)

With the LOCKED clause included, the READU does not pause.  You can put 
anything you want in that section but just realize that the statement fully 
executes and proceeds to the next command.  If you want to simulate wait until 
I obtain the lock then you just have to create this into a small loop.  
Something like this:

LOCKWAIT:
READU xxx FROM yyy, zzz LOCKED
  Xxx commands, if you want to do anything other than just loop
  GOTO LOCKWAIT
END THEN
  Xxx got the lock and have read the record so do whatever
  Xxx14 = I was here
END ELSE
  Xxx got the lock but it's a new record.
  Xxx = 
  Xxx14 = I was here
END
Do some more stuff.
WRITE xxx ON yyy, zzz

You don't HAVE to do anything in the locked section other than just goto your 
label.  You could add a small delay, if you wanted, just so your process isn't 
in a super tight loop chewing up all your computers horsepower.

Also, remember, you need to do something with the lock, even if it's a new 
record.  Either a WRITE or RELEASE statement on the zzz key value.

BobW


-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Jon Wells
Sent: Thursday, February 07, 2013 12:47 PM
To: U2 Users List
Subject: Re: [U2] Record locks (Unidata 7.2)

What I'm wondering is; what can I put into the 'Xxx what to do if locked' 
section whereby it waits until the record lock clears, once it clears, set my 
own lock, read the record, alter the record, and then write the record (which 
would release my lock)?


Thank you,

Jon Wells



 From: Woodward, Bob bob_woodw...@k2sports.com
To: U2 Users List u2-users@listserver.u2ug.org
Sent: Thursday, February 7, 2013 12:35 PM
Subject: Re: [U2] Record locks (Unidata 7.2)
 
Sorry Mecki but I think you have the LOCKED in the wrong place.  At least in my 
version of Unidata.  It comes before the THEN segment so the full, proper 
syntax would be:

READU xxx FROM xxx, xxx ON ERROR
  Xxx what to do if a hard error like file not open END LOCKED
  Xxx what to do if locked
END THEN
  Xxx what to do if lock is obtained and record is read END ELSE
  Xxx what to do if lock is obtained but record does not exist.
END

There is a second format for the READU command but it's a lot easier if the OP 
just reads about, himself, in the HELP information.  HELP UNIBASIC READU from 
ECL in Unidata will get him that.



-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Mecki Foerthmann
Sent: Thursday, February 07, 2013 12:27 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Record locks (Unidata 7.2)

The READU statement has a LOCKED clause that is true if a record is locked.
You can put all your locking ha logic in there.
READU record FROM filevariable,itemID THEN
    code if record exists and isn't locked (optional) LOCKED
    code to handle locked record condition (optional) END ELSE
    code if record doesn't exist (required) END

Now if you put that into a loop you can display a message and give the user the 
option to try again or abort.
And if you put the code into a subroutine you can use that in all your programs 
with a single line like this.
CALL SR.READU(record,filevariable,ItemID,Option,Err)

On 06/02/2013 21:52, Jon Wells wrote:
 Hi all,

 I have not looked at the world of record locks since my R83 Pick days.
I'm hoping to add the ability for the program I'm working on to:

     * Check if a record is locked
     * Wait until the lock is removed
     * Once the lock is removed, or if the record is not locked:
     * Lock the record
     * Perform the WRITE statement
 I'm hoping someone can share an example of how to accomplish this in
UniBasic. 


 Thank you,


 Jon Wells
 Campbell University
 ___
 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
___
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

Re: [U2] Record locks (Unidata 7.2)

2013-02-07 Thread Anthonys Lists

On 07/02/2013 20:46, Jon Wells wrote:

What I'm wondering is; what can I put into the 'Xxx what to do if locked' 
section whereby it waits until the record lock clears, once it clears, set my 
own lock, read the record, alter the record, and then write the record (which 
would release my lock)?


Somebody will correct me if I'm wrong, but I thought that was exactly 
what READU did!


If you don't provide a LOCKED clause, READU will hang and wait until 
the lock clears, then read and lock the record.


As I say, check the docu and make sure I'm right ... I've never had to 
bother much with locks ...


Cheers,
Wol



Thank you,

Jon Wells




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


Re: [U2] Record locks (Unidata 7.2)

2013-02-07 Thread Woodward, Bob
You're exactly right.  The only time you REALLY need the LOCKED clause
if there is some need to change that approach.  That was what I
attempted to show in my first response.  I guess I was a bit terse in
that one, though.

BobW 

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Anthonys
Lists
Sent: Thursday, February 07, 2013 2:21 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Record locks (Unidata 7.2)

On 07/02/2013 20:46, Jon Wells wrote:
 What I'm wondering is; what can I put into the 'Xxx what to do if
locked' section whereby it waits until the record lock clears, once it
clears, set my own lock, read the record, alter the record, and then
write the record (which would release my lock)?

Somebody will correct me if I'm wrong, but I thought that was exactly
what READU did!

If you don't provide a LOCKED clause, READU will hang and wait until
the lock clears, then read and lock the record.

As I say, check the docu and make sure I'm right ... I've never had to
bother much with locks ...

Cheers,
Wol


 Thank you,

 Jon Wells



___
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


Re: [U2] Turn pagination back on

2013-02-07 Thread Gregor Scott
For a modern though totally undocumented alternative to !BPIOCP thy this...

The code ASSIGN 1 TO SYSTEM(1005) will enable pagination.
The code ASSIGN 0 TO SYSTEM(1005) will disable it.

I think this is documented on the U2UG.org wiki.

This email and any attachments to it are confidential.
You must not use, disclose or act on the email if you are not the intended
recipient.  Liability limited by a scheme approved under Professional
Standards Legislation.
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Record locks (Unidata 7.2)

2013-02-07 Thread Wjhonson
I wouldn't however *recommend* this approach to locking as the user can never 
tell if their terminal is waiting on a lock, or just hung in some other odd 
manner, or perhaps processing a batch of something.

So it's rather a nasty trick to play on the user, to just use READU without a 
LOCKED clause


 

 

 

-Original Message-
From: Woodward, Bob bob_woodw...@k2sports.com
To: U2 Users List u2-users@listserver.u2ug.org
Sent: Thu, Feb 7, 2013 2:43 pm
Subject: Re: [U2] Record locks (Unidata 7.2)


You're exactly right.  The only time you REALLY need the LOCKED clause
if there is some need to change that approach.  That was what I
attempted to show in my first response.  I guess I was a bit terse in
that one, though.

BobW 

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Anthonys
Lists
Sent: Thursday, February 07, 2013 2:21 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Record locks (Unidata 7.2)

On 07/02/2013 20:46, Jon Wells wrote:
 What I'm wondering is; what can I put into the 'Xxx what to do if
locked' section whereby it waits until the record lock clears, once it
clears, set my own lock, read the record, alter the record, and then
write the record (which would release my lock)?

Somebody will correct me if I'm wrong, but I thought that was exactly
what READU did!

If you don't provide a LOCKED clause, READU will hang and wait until
the lock clears, then read and lock the record.

As I say, check the docu and make sure I'm right ... I've never had to
bother much with locks ...

Cheers,
Wol


 Thank you,

 Jon Wells



___
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

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


Re: [U2] Record locks (Unidata 7.2)

2013-02-07 Thread Woodward, Bob
In an active user session where users are obtaining a lock for a length
of time, you're right.  There are lots of times, though, that lock
intervention is not a benefit.  It all depends on the need of the
application and many situations where I would highly recommend using the
default locking system of READU.


-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Thursday, February 07, 2013 3:41 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Record locks (Unidata 7.2)

I wouldn't however *recommend* this approach to locking as the user can
never tell if their terminal is waiting on a lock, or just hung in
some other odd manner, or perhaps processing a batch of something.

So it's rather a nasty trick to play on the user, to just use READU
without a LOCKED clause


 

 

 

-Original Message-
From: Woodward, Bob bob_woodw...@k2sports.com
To: U2 Users List u2-users@listserver.u2ug.org
Sent: Thu, Feb 7, 2013 2:43 pm
Subject: Re: [U2] Record locks (Unidata 7.2)


You're exactly right.  The only time you REALLY need the LOCKED clause
if there is some need to change that approach.  That was what I
attempted to show in my first response.  I guess I was a bit terse in
that one, though.

BobW 

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Anthonys
Lists
Sent: Thursday, February 07, 2013 2:21 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Record locks (Unidata 7.2)

On 07/02/2013 20:46, Jon Wells wrote:
 What I'm wondering is; what can I put into the 'Xxx what to do if
locked' section whereby it waits until the record lock clears, once it
clears, set my own lock, read the record, alter the record, and then
write the record (which would release my lock)?

Somebody will correct me if I'm wrong, but I thought that was exactly
what READU did!

If you don't provide a LOCKED clause, READU will hang and wait until
the lock clears, then read and lock the record.

As I say, check the docu and make sure I'm right ... I've never had to
bother much with locks ...

Cheers,
Wol


 Thank you,

 Jon Wells



___
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

 
___
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


Re: [U2] Record locks (Unidata 7.2)

2013-02-07 Thread Kevin King
+1. Well stated.

On Thursday, February 7, 2013, Woodward, Bob wrote:

 In an active user session where users are obtaining a lock for a length
 of time, you're right.  There are lots of times, though, that lock
 intervention is not a benefit.  It all depends on the need of the
 application and many situations where I would highly recommend using the
 default locking system of READU.


 -Original Message-
 From: u2-users-boun...@listserver.u2ug.org javascript:;
 [mailto:u2-users-boun...@listserver.u2ug.org javascript:;] On Behalf Of
 Wjhonson
 Sent: Thursday, February 07, 2013 3:41 PM
 To: u2-users@listserver.u2ug.org javascript:;
 Subject: Re: [U2] Record locks (Unidata 7.2)

 I wouldn't however *recommend* this approach to locking as the user can
 never tell if their terminal is waiting on a lock, or just hung in
 some other odd manner, or perhaps processing a batch of something.

 So it's rather a nasty trick to play on the user, to just use READU
 without a LOCKED clause








 -Original Message-
 From: Woodward, Bob bob_woodw...@k2sports.com javascript:;
 To: U2 Users List u2-users@listserver.u2ug.org javascript:;
 Sent: Thu, Feb 7, 2013 2:43 pm
 Subject: Re: [U2] Record locks (Unidata 7.2)


 You're exactly right.  The only time you REALLY need the LOCKED clause
 if there is some need to change that approach.  That was what I
 attempted to show in my first response.  I guess I was a bit terse in
 that one, though.

 BobW

 -Original Message-
 From: u2-users-boun...@listserver.u2ug.org javascript:;
 [mailto:u2-users-boun...@listserver.u2ug.org javascript:;] On Behalf Of
 Anthonys
 Lists
 Sent: Thursday, February 07, 2013 2:21 PM
 To: u2-users@listserver.u2ug.org javascript:;
 Subject: Re: [U2] Record locks (Unidata 7.2)

 On 07/02/2013 20:46, Jon Wells wrote:
  What I'm wondering is; what can I put into the 'Xxx what to do if
 locked' section whereby it waits until the record lock clears, once it
 clears, set my own lock, read the record, alter the record, and then
 write the record (which would release my lock)?

 Somebody will correct me if I'm wrong, but I thought that was exactly
 what READU did!

 If you don't provide a LOCKED clause, READU will hang and wait until
 the lock clears, then read and lock the record.

 As I say, check the docu and make sure I'm right ... I've never had to
 bother much with locks ...

 Cheers,
 Wol
 
 
  Thank you,
 
  Jon Wells
 
 

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


 ___
 U2-Users mailing list
 U2-Users@listserver.u2ug.org javascript:;
 http://listserver.u2ug.org/mailman/listinfo/u2-users
 ___
 U2-Users mailing list
 U2-Users@listserver.u2ug.org javascript:;
 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


Re: [U2] Record locks (Unidata 7.2)

2013-02-07 Thread Wjhonson
Then you're misunderstanding what I'm saying.

 

 

 

-Original Message-
From: Kevin King ke...@precisonline.com
To: U2 Users List u2-users@listserver.u2ug.org
Sent: Thu, Feb 7, 2013 6:48 pm
Subject: Re: [U2] Record locks (Unidata 7.2)


+1. Well stated.

On Thursday, February 7, 2013, Woodward, Bob wrote:

 In an active user session where users are obtaining a lock for a length
 of time, you're right.  There are lots of times, though, that lock
 intervention is not a benefit.  It all depends on the need of the
 application and many situations where I would highly recommend using the
 default locking system of READU.


 -Original Message-
 From: u2-users-boun...@listserver.u2ug.org javascript:;
 [mailto:u2-users-boun...@listserver.u2ug.org javascript:;] On Behalf Of
 Wjhonson
 Sent: Thursday, February 07, 2013 3:41 PM
 To: u2-users@listserver.u2ug.org javascript:;
 Subject: Re: [U2] Record locks (Unidata 7.2)

 I wouldn't however *recommend* this approach to locking as the user can
 never tell if their terminal is waiting on a lock, or just hung in
 some other odd manner, or perhaps processing a batch of something.

 So it's rather a nasty trick to play on the user, to just use READU
 without a LOCKED clause








 -Original Message-
 From: Woodward, Bob bob_woodw...@k2sports.com javascript:;
 To: U2 Users List u2-users@listserver.u2ug.org javascript:;
 Sent: Thu, Feb 7, 2013 2:43 pm
 Subject: Re: [U2] Record locks (Unidata 7.2)


 You're exactly right.  The only time you REALLY need the LOCKED clause
 if there is some need to change that approach.  That was what I
 attempted to show in my first response.  I guess I was a bit terse in
 that one, though.

 BobW

 -Original Message-
 From: u2-users-boun...@listserver.u2ug.org javascript:;
 [mailto:u2-users-boun...@listserver.u2ug.org javascript:;] On Behalf Of
 Anthonys
 Lists
 Sent: Thursday, February 07, 2013 2:21 PM
 To: u2-users@listserver.u2ug.org javascript:;
 Subject: Re: [U2] Record locks (Unidata 7.2)

 On 07/02/2013 20:46, Jon Wells wrote:
  What I'm wondering is; what can I put into the 'Xxx what to do if
 locked' section whereby it waits until the record lock clears, once it
 clears, set my own lock, read the record, alter the record, and then
 write the record (which would release my lock)?

 Somebody will correct me if I'm wrong, but I thought that was exactly
 what READU did!

 If you don't provide a LOCKED clause, READU will hang and wait until
 the lock clears, then read and lock the record.

 As I say, check the docu and make sure I'm right ... I've never had to
 bother much with locks ...

 Cheers,
 Wol
 
 
  Thank you,
 
  Jon Wells
 
 

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


 ___
 U2-Users mailing list
 U2-Users@listserver.u2ug.org javascript:;
 http://listserver.u2ug.org/mailman/listinfo/u2-users
 ___
 U2-Users mailing list
 U2-Users@listserver.u2ug.org javascript:;
 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

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


Re: [U2] Record locks (Unidata 7.2)

2013-02-07 Thread Tony Gravagno
I think people understand exactly what you're saying, but disagree.
Most applications don't use the more rigorous coding for having a
Locked clause that provides additional information to the user,
retries, etc. That's not wrong, it's just not necessary ...
depending on the site.

That said, when we used to have a lot of people in an office and a
dumb terminal beeping was a recognized message to everyone, it was OK
(generally) to just do the READU. These days with more alternative
UIs, thick-client, thin-client, web services, mobile, etc, there's no
one to hear that beep. So for modern development I would agree that
you really don't want an unconditional lock hanging around, you want a
Locked clause with logic to rollback the transaction and exit
gracefully, perhaps with a message sent to the site admin.

The penalty for Not having a Locked clause with a new UI is that the
port will hang, the UI will receive a timeout (which many clients
aren't prepared to process), and the DBMS port could be sitting there
indefinitely with no one aware of the condition. This can cascade to
multiple ports until suddenly everything grinds to a halt and GUI
users around the world are unable to access the app. I believe some
heads will be nodding here because I hear about this happening
occasionally.

T

 From: Wjhonson 
 Then you're misunderstanding what I'm saying.


 From: Kevin King 
 +1. Well stated.
 
 Woodward, Bob wrote: 
  In an active user session where users are obtaining a lock for a
  length of time, you're right.  There are lots of times, though,
that
  lock intervention is not a benefit.  It all depends on the need of
the
  application and many situations where I would highly recommend
  using the default locking system of READU.

  From: Wjhonson
  I wouldn't however *recommend* this approach to locking as the
user
  can never tell if their terminal is waiting on a lock, or just
hung
  in some other odd manner, or perhaps processing a batch of
something.
 
  So it's rather a nasty trick to play on the user, to just use
READU
  without a LOCKED clause


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