![]() | |
![]() |
| | Thread Tools | Display Modes |
#11
| |||
| |||
|
|
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 |
#12
| |||
| |||
|
|
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. |
#13
| |||
| |||
|
|
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. |
#14
| |||
| |||
|
|
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. |
![]() |
| Thread Tools | |
| Display Modes | |
| |