dbTalk Databases Forums  

Unwanted RELEASE, my record locks are not holding

comp.databases.pick comp.databases.pick


Discuss Unwanted RELEASE, my record locks are not holding in the comp.databases.pick forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
Symeon
 
Posts: n/a

Default Re: Unwanted RELEASE, my record locks are not holding - 10-04-2006 , 07:43 AM







glseniaga wrote:
Quote:
I know, I know, I know, the LOCKED isn't what locks the record, sorry
for the slip.

Here is a sample of whats going on:

001 PROG1 ;* CALLING PROGRAM
002 OPEN 'FILE' TO FILE ELSE CRT "ERROR"
003 CALL PROG2(FILE.ITEM,ITEM.ID)
004 * AT THIS POINT THE RECORD IS NO LONGER LOCKED
EOI 004

001 SUBROUTINE PROG2(FILE.ITEM,ITEM.ID)
002 OPEN 'FILE' TO FILE ELSE CRT "ERROR"
003 SELECT FILE
004 LOOP
005 READNEXT FILE.ID ELSE EXIT
006 READU FILE.ITEM FROM FILE,ITEM.ID LOCKED
007 CRT "DISPLAY LOCKED BY INFO"
008 END ELSE
009 CRT "ERROR"
010 END
011 EXIT
012 REPEAT
013 *AT THIS POINT RECORD IS LOCKED
014 RETURN
EOI 014

If a file is opened in a subroutine, any locks will be released when
the subroutine ends. This is what you are doing here. you may be
opening the file in the calling program but firstly the file variable
"FILE" is not passed to the subroutine, and secondly the READU
statement in the subroutine uses FILE which is opened on line 2 of the
subroutine.


I think line 3 of the calling prog should be
CALL PROG2(FILE,FILE.ITEM,ITEM.ID)

Line 1 of the subroutine should be
SUBROUTINE PROG2(FILE,FILE.ITEM,ITEM.ID)
and line 2 of the subroutine should be deleted.

Rgds
Symeon.



Reply With Quote
  #12  
Old   
glseniaga
 
Posts: n/a

Default Re: Unwanted RELEASE, my record locks are not holding - 10-04-2006 , 09:35 AM






Thanks for all the suggestions. I have it working now. I'm now
passing all file vars needed and NOT opening them in the called code.
The lock now holds until I release it.
Symeon wrote:
Quote:
glseniaga wrote:
I know, I know, I know, the LOCKED isn't what locks the record, sorry
for the slip.

Here is a sample of whats going on:

001 PROG1 ;* CALLING PROGRAM
002 OPEN 'FILE' TO FILE ELSE CRT "ERROR"
003 CALL PROG2(FILE.ITEM,ITEM.ID)
004 * AT THIS POINT THE RECORD IS NO LONGER LOCKED
EOI 004

001 SUBROUTINE PROG2(FILE.ITEM,ITEM.ID)
002 OPEN 'FILE' TO FILE ELSE CRT "ERROR"
003 SELECT FILE
004 LOOP
005 READNEXT FILE.ID ELSE EXIT
006 READU FILE.ITEM FROM FILE,ITEM.ID LOCKED
007 CRT "DISPLAY LOCKED BY INFO"
008 END ELSE
009 CRT "ERROR"
010 END
011 EXIT
012 REPEAT
013 *AT THIS POINT RECORD IS LOCKED
014 RETURN
EOI 014


If a file is opened in a subroutine, any locks will be released when
the subroutine ends. This is what you are doing here. you may be
opening the file in the calling program but firstly the file variable
"FILE" is not passed to the subroutine, and secondly the READU
statement in the subroutine uses FILE which is opened on line 2 of the
subroutine.


I think line 3 of the calling prog should be
CALL PROG2(FILE,FILE.ITEM,ITEM.ID)

Line 1 of the subroutine should be
SUBROUTINE PROG2(FILE,FILE.ITEM,ITEM.ID)
and line 2 of the subroutine should be deleted.

Rgds
Symeon.


Reply With Quote
  #13  
Old   
Albino Timberwolf
 
Posts: n/a

Default Re: Unwanted RELEASE, my record locks are not holding - 10-04-2006 , 10:19 AM



A trick you may wish to incorporate is to put the LOOP and READNEXT
together. As long as there is a next record READNEXT returns a TRUE to the
LOOP.

SUBROUTINE PROG2(FILE.ITEM,ITEM.ID)
OPEN "FILE" TO FILE ELSE
CRT "'FILE' ERROR"
RETURN
END
SELECT FILE
LOOP WHILE READNEXT FILE.ID DO
READU FILE.ITEM FROM FILE,ITEM.ID LOCKED
CRT "RECORD '":FILE.ID:"' LOCKED BY ANOTHER PROCESS"
END ELSE
CRT "ERROR READING '":FILE.ID:"'"
END
REPEAT
CRT "COMPLETE"
RETURN

"glseniaga" <glseniaga (AT) alltel (DOT) net> wrote

Quote:
Thanks for all the suggestions. I have it working now. I'm now
passing all file vars needed and NOT opening them in the called code.
The lock now holds until I release it.
Symeon wrote:
glseniaga wrote:
I know, I know, I know, the LOCKED isn't what locks the record, sorry
for the slip.

Here is a sample of whats going on:

001 PROG1 ;* CALLING PROGRAM
002 OPEN 'FILE' TO FILE ELSE CRT "ERROR"
003 CALL PROG2(FILE.ITEM,ITEM.ID)
004 * AT THIS POINT THE RECORD IS NO LONGER LOCKED
EOI 004

001 SUBROUTINE PROG2(FILE.ITEM,ITEM.ID)
002 OPEN 'FILE' TO FILE ELSE CRT "ERROR"
003 SELECT FILE
004 LOOP
005 READNEXT FILE.ID ELSE EXIT
006 READU FILE.ITEM FROM FILE,ITEM.ID LOCKED
007 CRT "DISPLAY LOCKED BY INFO"
008 END ELSE
009 CRT "ERROR"
010 END
011 EXIT
012 REPEAT
013 *AT THIS POINT RECORD IS LOCKED
014 RETURN
EOI 014


If a file is opened in a subroutine, any locks will be released when
the subroutine ends. This is what you are doing here. you may be
opening the file in the calling program but firstly the file variable
"FILE" is not passed to the subroutine, and secondly the READU
statement in the subroutine uses FILE which is opened on line 2 of the
subroutine.


I think line 3 of the calling prog should be
CALL PROG2(FILE,FILE.ITEM,ITEM.ID)

Line 1 of the subroutine should be
SUBROUTINE PROG2(FILE,FILE.ITEM,ITEM.ID)
and line 2 of the subroutine should be deleted.

Rgds
Symeon.




Reply With Quote
  #14  
Old   
Bill H
 
Posts: n/a

Default Re: Unwanted RELEASE, my record locks are not holding - 10-04-2006 , 04:12 PM



This works fine on UniData v7.1:

TEST
001: SUBROUTINE TEST
002: OPEN '', 'VOC' TO VOC.FV ELSE RETURN
003: READU TESTREC FROM VOC.FV, 'TEST' ELSE NULL
004: RETURN
005: END

2 Demo (0)->BPTEST OPEN '', 'VOC' TO VOC.FV ELSE STOP 201, 'VOC' ; CALL TEST
; INPUT ZZ,1 ; END

The lock is set until I press [Enter] at the "INPUT ZZ,1" prompt of the
calling program.

3 Demo (0)-> LIST.READU
UNO UNBR UID UNAME TTY FILENAME RECORD_ID M TIME
DATE
4 2248 197615 wphasket pts/4 VOC TEST X 14:06:54 Oct
04

I'm wondering if there isn't some setting in UniVerse to act like this.

Bill

"glseniaga" <glseniaga (AT) alltel (DOT) net> wrote

Quote:
Thanks for all the suggestions. I have it working now. I'm now
passing all file vars needed and NOT opening them in the called code.
The lock now holds until I release it.
Symeon wrote:
glseniaga wrote:
I know, I know, I know, the LOCKED isn't what locks the record, sorry
for the slip.

Here is a sample of whats going on:

001 PROG1 ;* CALLING PROGRAM
002 OPEN 'FILE' TO FILE ELSE CRT "ERROR"
003 CALL PROG2(FILE.ITEM,ITEM.ID)
004 * AT THIS POINT THE RECORD IS NO LONGER LOCKED
EOI 004

001 SUBROUTINE PROG2(FILE.ITEM,ITEM.ID)
002 OPEN 'FILE' TO FILE ELSE CRT "ERROR"
003 SELECT FILE
004 LOOP
005 READNEXT FILE.ID ELSE EXIT
006 READU FILE.ITEM FROM FILE,ITEM.ID LOCKED
007 CRT "DISPLAY LOCKED BY INFO"
008 END ELSE
009 CRT "ERROR"
010 END
011 EXIT
012 REPEAT
013 *AT THIS POINT RECORD IS LOCKED
014 RETURN
EOI 014


If a file is opened in a subroutine, any locks will be released when
the subroutine ends. This is what you are doing here. you may be
opening the file in the calling program but firstly the file variable
"FILE" is not passed to the subroutine, and secondly the READU
statement in the subroutine uses FILE which is opened on line 2 of the
subroutine.


I think line 3 of the calling prog should be
CALL PROG2(FILE,FILE.ITEM,ITEM.ID)

Line 1 of the subroutine should be
SUBROUTINE PROG2(FILE,FILE.ITEM,ITEM.ID)
and line 2 of the subroutine should be deleted.

Rgds
Symeon.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.