Re: [U2] Record locks (Unidata 7.2)

2013-02-08 Thread Wols Lists
On 08/02/13 07:30, Tony Gravagno wrote:
 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.

And even in an office, if you code properly, an unprotected READU can
make sense.

The proper way to program data entry (if you can) is to read everything,
get the info from the user, and then RERUN THE TRANSACTION using locks
to stash it safely away.

That way, you should never get a program hanging on a lock for more than
a second or so (I know I know ...)

Cheers,
Wol
___
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-08 Thread Wjhonson
We don't really have the luxury to rewrite the entire system.
But we can fix one program a day

 

 

 

-Original Message-
From: Wols Lists antli...@youngman.org.uk
To: u2-users u2-users@listserver.u2ug.org
Sent: Fri, Feb 8, 2013 1:22 am
Subject: Re: [U2] Record locks (Unidata 7.2)


On 08/02/13 07:30, Tony Gravagno wrote:
 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.

And even in an office, if you code properly, an unprotected READU can
make sense.

The proper way to program data entry (if you can) is to read everything,
get the info from the user, and then RERUN THE TRANSACTION using locks
to stash it safely away.

That way, you should never get a program hanging on a lock for more than
a second or so (I know I know ...)

Cheers,
Wol
___
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-08 Thread Jon Wells
I should add that (in our test account) I switched to the READU statement along 
with a LOCKED clause -

  READU STU.REC FROM STU.FILE, STU.ID LOCKED
    CRT STU.ID: RECORD IS LOCKED
  END THEN
    STU.REC48 = INST.CRED
    STU.REC49 = INET.CRED
    WRITE STU.REC ON STU.FILE, STU.ID
  END

 I locked one of the records in the list I was processing.  When the program 
was working on that record, the CRT statement was executed, and the program 
moved right along processing the rest of the list; and record I had locked was 
not updated. 

Looking through the 'UniBasic Commands Reference' PDF, I found 'RECORDLOCKED 
(file.var, rec.id.expr)'.  Perhaps this could be used within a LOOP to control 
things, allowing terminal input where the user can choose what to do about the 
record lock?

I've decided to write the data to a new file, so this is no longer a big issue 
for me.  If I had created the program using our vendor's tool kit, the 
generated code would have added all the appropriate gunk the system uses for 
record locks.  The responses have been interesting as I've been looking for a 
chance to better understand how Unidata shops handle locks.  

Thank you,
Jon Wells





 From: Tony Gravagno 3xk547...@sneakemail.com
To: u2-users@listserver.u2ug.org 
Sent: Friday, February 8, 2013 2:30 AM
Subject: Re: [U2] Record locks (Unidata 7.2)
 
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
___
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-08 Thread Wjhonson
Jon the LOCKED clause acts like a Then...else
You can only take one branch.  So for the locked record, it took the LOCKED 
branch and ignored the END THEN branch
Because the Locked clause is another case you see?

Like

Readu
CASE Locked: do this
CASE NotLockedANd Exists: do that
CASE NotLockedANDDoesNotExist: do a third thing


You understand?
This is why you MUST have a LOOPing structure around the Locking.
Which is what I sent you the other day.

 

 

 

-Original Message-
From: Jon Wells jwaytwe...@yahoo.com
To: U2 Users List u2-users@listserver.u2ug.org
Sent: Fri, Feb 8, 2013 9:57 am
Subject: Re: [U2] Record locks (Unidata 7.2)


I should add that (in our test account) I switched to the READU statement along 
with a LOCKED clause -

  READU STU.REC FROM STU.FILE, STU.ID LOCKED
CRT STU.ID: RECORD IS LOCKED
  END THEN
STU.REC48 = INST.CRED
STU.REC49 = INET.CRED
WRITE STU.REC ON STU.FILE, STU.ID
  END

 I locked one of the records in the list I was processing.  When the program 
was 
working on that record, the CRT statement was executed, and the program moved 
right along processing the rest of the list; and record I had locked was not 
updated. 

Looking through the 'UniBasic Commands Reference' PDF, I found 'RECORDLOCKED 
(file.var, rec.id.expr)'.  Perhaps this could be used within a LOOP to control 
things, allowing terminal input where the user can choose what to do about the 
record lock?

I've decided to write the data to a new file, so this is no longer a big issue 
for me.  If I had created the program using our vendor's tool kit, the 
generated 
code would have added all the appropriate gunk the system uses for record 
locks.  The responses have been interesting as I've been looking for a chance 
to 
better understand how Unidata shops handle locks.  

Thank you,
Jon Wells





 From: Tony Gravagno 3xk547...@sneakemail.com
To: u2-users@listserver.u2ug.org 
Sent: Friday, February 8, 2013 2:30 AM
Subject: Re: [U2] Record locks (Unidata 7.2)
 
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
___
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-08 Thread Lunt, Bruce
One technique that I have used, in the past, has been to save a list of locked 
ID's and at the end of the program re-try them when all else has finished. Then 
if they are still locked the program will send a message to me or the operator 
to alert that there is a locked record. 

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Jon Wells
Sent: Friday, February 08, 2013 9:57 AM
To: U2 Users List
Subject: Re: [U2] Record locks (Unidata 7.2)

I should add that (in our test account) I switched to the READU statement along 
with a LOCKED clause -

  READU STU.REC FROM STU.FILE, STU.ID LOCKED
    CRT STU.ID: RECORD IS LOCKED
  END THEN
    STU.REC48 = INST.CRED
    STU.REC49 = INET.CRED
    WRITE STU.REC ON STU.FILE, STU.ID
  END

 I locked one of the records in the list I was processing.  When the program 
was working on that record, the CRT statement was executed, and the program 
moved right along processing the rest of the list; and record I had locked was 
not updated. 

Looking through the 'UniBasic Commands Reference' PDF, I found 'RECORDLOCKED 
(file.var, rec.id.expr)'.  Perhaps this could be used within a LOOP to control 
things, allowing terminal input where the user can choose what to do about the 
record lock?

I've decided to write the data to a new file, so this is no longer a big issue 
for me.  If I had created the program using our vendor's tool kit, the 
generated code would have added all the appropriate gunk the system uses for 
record locks.  The responses have been interesting as I've been looking for a 
chance to better understand how Unidata shops handle locks.  

Thank you,
Jon Wells





 From: Tony Gravagno 3xk547...@sneakemail.com
To: u2-users@listserver.u2ug.org
Sent: Friday, February 8, 2013 2:30 AM
Subject: Re: [U2] Record locks (Unidata 7.2)
 
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
___
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-08 Thread Woodward, Bob
You should have written it something like this:

TRY.AGAIN:
  READU STU.REC FROM STU.FILE, STU.ID LOCKED
CRT STU.ID: RECORD IS LOCKED
SLEEP 2
GOTO TRY.AGAIN
  END THEN
STU.REC48 = INST.CRED
STU.REC49 = INET.CRED
WRITE STU.REC ON STU.FILE, STU.ID
  END

You have to add the label TRY.AGAIN: so you have a jump point then add the 
SLEEP command for 2 seconds and lastly the GOTO command so after the SLEEP 
expires, execution remains at the READU command.

BobW

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Jon Wells
Sent: Friday, February 08, 2013 9:57 AM
To: U2 Users List
Subject: Re: [U2] Record locks (Unidata 7.2)

I should add that (in our test account) I switched to the READU statement along 
with a LOCKED clause -

  READU STU.REC FROM STU.FILE, STU.ID LOCKED
    CRT STU.ID: RECORD IS LOCKED
  END THEN
    STU.REC48 = INST.CRED
    STU.REC49 = INET.CRED
    WRITE STU.REC ON STU.FILE, STU.ID
  END

 I locked one of the records in the list I was processing.  When the program 
was working on that record, the CRT statement was executed, and the program 
moved right along processing the rest of the list; and record I had locked was 
not updated. 

Looking through the 'UniBasic Commands Reference' PDF, I found 'RECORDLOCKED 
(file.var, rec.id.expr)'.  Perhaps this could be used within a LOOP to control 
things, allowing terminal input where the user can choose what to do about the 
record lock?

I've decided to write the data to a new file, so this is no longer a big issue 
for me.  If I had created the program using our vendor's tool kit, the 
generated code would have added all the appropriate gunk the system uses for 
record locks.  The responses have been interesting as I've been looking for a 
chance to better understand how Unidata shops handle locks.  

Thank you,
Jon Wells





 From: Tony Gravagno 3xk547...@sneakemail.com
To: u2-users@listserver.u2ug.org
Sent: Friday, February 8, 2013 2:30 AM
Subject: Re: [U2] Record locks (Unidata 7.2)
 
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
___
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-08 Thread Israel, John R.
I would also add some type of bailout logic in case the record NEVER frees up 
(user went home for the weekend).  Obviously, you need to make the call on this 
on a case by case situation, but you would not want a critical process (like 
month end) to fail because Joe Blow left a record locked.  Should you finish 
the other 99.% of month end or have it fail completely?  Again, you need to 
make this call on a case by case basis for your application.

MAX.TRIES = 1000
TRIES = 0
TRY.AGAIN:
   READU STU.REC FROM STU.FILE, STU.ID LOCKED
  CRT STU.ID: RECORD IS LOCKED
  SLEEP 2
  TRIES += 1
  IF (TRIES = MAX.TRIES) THEN
 * track this condition somehow and move on
 GOTO SKIP
  END
  GOTO TRY.AGAIN
   END THEN
  STU.REC48 = INST.CRED
  STU.REC49 = INET.CRED
  WRITE STU.REC ON STU.FILE, STU.ID
   END
SKIP:


John



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

You should have written it something like this:

TRY.AGAIN:
  READU STU.REC FROM STU.FILE, STU.ID LOCKED
CRT STU.ID: RECORD IS LOCKED
SLEEP 2
GOTO TRY.AGAIN
  END THEN
STU.REC48 = INST.CRED
STU.REC49 = INET.CRED
WRITE STU.REC ON STU.FILE, STU.ID
  END

You have to add the label TRY.AGAIN: so you have a jump point then add the 
SLEEP command for 2 seconds and lastly the GOTO command so after the SLEEP 
expires, execution remains at the READU command.

BobW

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Jon Wells
Sent: Friday, February 08, 2013 9:57 AM
To: U2 Users List
Subject: Re: [U2] Record locks (Unidata 7.2)

I should add that (in our test account) I switched to the READU statement along 
with a LOCKED clause -

  READU STU.REC FROM STU.FILE, STU.ID LOCKED
    CRT STU.ID: RECORD IS LOCKED
  END THEN
    STU.REC48 = INST.CRED
    STU.REC49 = INET.CRED
    WRITE STU.REC ON STU.FILE, STU.ID
  END

 I locked one of the records in the list I was processing.  When the program 
was working on that record, the CRT statement was executed, and the program 
moved right along processing the rest of the list; and record I had locked was 
not updated. 

Looking through the 'UniBasic Commands Reference' PDF, I found 'RECORDLOCKED 
(file.var, rec.id.expr)'.  Perhaps this could be used within a LOOP to control 
things, allowing terminal input where the user can choose what to do about the 
record lock?

I've decided to write the data to a new file, so this is no longer a big issue 
for me.  If I had created the program using our vendor's tool kit, the 
generated code would have added all the appropriate gunk the system uses for 
record locks.  The responses have been interesting as I've been looking for a 
chance to better understand how Unidata shops handle locks.  

Thank you,
Jon Wells





 From: Tony Gravagno 3xk547...@sneakemail.com
To: u2-users@listserver.u2ug.org
Sent: Friday, February 8, 2013 2:30 AM
Subject: Re: [U2] Record locks (Unidata 7.2)
 
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 

Re: [U2] Record locks (Unidata 7.2)

2013-02-08 Thread Mecki Foerthmann

Oh no, you don't have to add a label and you don't have to use GOTO.

TRY_AGAIN = 1
LOOP WHILE TRY_AGAIN
  READU STU.REC FROM STU.FILE, STU.ID LOCKED
CRT STU.ID: RECORD IS LOCKED
SLEEP 2
  END THEN
STU.REC48  = INST.CRED
STU.REC49  = INET.CRED
WRITE STU.REC ON STU.FILE, STU.ID
TRY_AGAIN = 0
  END
REPEAT



On 08/02/2013 18:10, Woodward, Bob wrote:

You should have written it something like this:

TRY.AGAIN:
   READU STU.REC FROM STU.FILE, STU.ID LOCKED
 CRT STU.ID: RECORD IS LOCKED
 SLEEP 2
 GOTO TRY.AGAIN
   END THEN
 STU.REC48  = INST.CRED
 STU.REC49  = INET.CRED
 WRITE STU.REC ON STU.FILE, STU.ID
   END

You have to add the label TRY.AGAIN: so you have a jump point then add the 
SLEEP command for 2 seconds and lastly the GOTO command so after the SLEEP 
expires, execution remains at the READU command.

BobW




___
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-08 Thread Mecki Foerthmann

On second thought this won't do either since it hasn't got an ELSE clause.

ERR = ''
LOOP
  TRY_AGAIN = 0
  READU STU.REC FROM STU.FILE, STU.ID LOCKED
CRT STU.ID: RECORD IS LOCKED - (Q)uit or Enter
INPUT REPLY:
IF REPLY # 'Q' THEN TRY_AGAIN = 1 ELSE ABORT
  END ELSE STU.REC = ''
UNTIL NOT(TRY_AGAIN) REPEAT
STU.REC48  = INST.CRED
STU.REC49  = INET.CRED
WRITE STU.REC ON STU.FILE, STU.ID





On 08/02/2013 20:12, Mecki Foerthmann wrote:

Oh no, you don't have to add a label and you don't have to use GOTO.

TRY_AGAIN = 1
LOOP WHILE TRY_AGAIN
  READU STU.REC FROM STU.FILE, STU.ID LOCKED
CRT STU.ID: RECORD IS LOCKED
SLEEP 2
  END THEN
STU.REC48  = INST.CRED
STU.REC49  = INET.CRED
WRITE STU.REC ON STU.FILE, STU.ID
TRY_AGAIN = 0
  END
REPEAT



On 08/02/2013 18:10, Woodward, Bob wrote:

You should have written it something like this:

TRY.AGAIN:
   READU STU.REC FROM STU.FILE, STU.ID LOCKED
 CRT STU.ID: RECORD IS LOCKED
 SLEEP 2
 GOTO TRY.AGAIN
   END THEN
 STU.REC48  = INST.CRED
 STU.REC49  = INET.CRED
 WRITE STU.REC ON STU.FILE, STU.ID
   END

You have to add the label TRY.AGAIN: so you have a jump point then 
add the SLEEP command for 2 seconds and lastly the GOTO command so 
after the SLEEP expires, execution remains at the READU command.


BobW




___
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-08 Thread John Hester
I agree, though I find the LOCKED clause is needed more often than not
in our particular environment.  I've always used the following logic to
determine which course of action to take.  In this example:

READU REC FROM FILE, ID THEN
   [do something]
END ELSE
   [do something else]
END
[operate on REC]
WRITE REC ON FILE, ID

if there is an INPUT statement or a READU attempt on another record
anywhere between the first READU and the WRITE in this program or any
other that will lock the same record, then there needs to be a LOCKED
clause and a loop.  In my experience, leaving a user session
unresponsive due to a missing LOCKED clause leads to closing the
terminal emulator window or power cycling a dumb terminal.  Sometimes
this simply orphans the session, and the user hits the lock a 2nd time
when they log back in.  Not fun for the user or the support desk
employee.  We have a standard subroutine call for all LOCKED clauses
that tells the user who has the lock so they can contact the culprit
directly and leave I.T. out of the loop.

-John

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

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


[U2] UniData 64 bit sanity check

2013-02-08 Thread Jeff Fitzgerald
Hi all,

Just want to get confirmation or a slap upside the head   It looks to
me like all the UDT Windows versions are 32 bit and that there isn't a 64
bit version - true?

Thanks!

Jeff Fitzgerald
Fitzgerald  Long, Inc.

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


Re: [U2] UniData 64 bit sanity check

2013-02-08 Thread Jeffrey Butera
Last check there are no 64 bit builds for intel (win/Linux)

Jeff Butera
--
A tree falls the way it leans.
Be careful which way you lean.
The Lorax

On Feb 8, 2013, at 9:57 PM, Jeff Fitzgerald j...@fitzlong.com wrote:

 Hi all,
 
 Just want to get confirmation or a slap upside the head   It looks to
 me like all the UDT Windows versions are 32 bit and that there isn't a 64
 bit version - true?
 
 Thanks!
 
 Jeff Fitzgerald
 Fitzgerald  Long, Inc.
 
 www.fitzlong.com
 ___
 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] UniData 64 bit sanity check

2013-02-08 Thread Daniel McGrath
Correct.

We are working on them.

Regards,
Dan

From: u2-users-boun...@listserver.u2ug.org 
[u2-users-boun...@listserver.u2ug.org] on behalf of Jeff Fitzgerald 
[j...@fitzlong.com]
Sent: Friday, 8 February 2013 7:57 PM
To: U2-Users@listserver.u2ug.org
Subject: [U2] UniData 64 bit sanity check

Hi all,

Just want to get confirmation or a slap upside the head   It looks to
me like all the UDT Windows versions are 32 bit and that there isn't a 64
bit version - true?

Thanks!

Jeff Fitzgerald
Fitzgerald  Long, Inc.

www.fitzlong.com
___
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