[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::hackers_v1

Title:-={ H A C K E R S }=-
Notice:Write locked - see NOTED::HACKERS
Moderator:DIEHRD::MORRIS
Created:Thu Feb 20 1986
Last Modified:Mon Aug 03 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:680
Total number of notes:5456

483.0. "How to delete a file on close (RMS-11) ?" by SERPNT::SONTAKKE (Vikas Sontakke) Thu May 28 1987 12:32

                <<< RSTS32::USER$:[NOTES$LIBRARY]RMS11.NOTE;1 >>>
                               -< RMS-11 Issues >-
================================================================================
Note 46.0            How do I get FB$MKD to work on $CLOSE ?           3 replies
SERPNT::SONTAKKE "Vikas Sontakke"                    15 lines  27-MAY-1987 19:51
--------------------------------------------------------------------------------

                   <<< DUA0:[NOTES$LIBRARY]CTNOTES.NOTE;1 >>>
                       -< CT Development/Support Notes >-
================================================================================
Note 1153.0        How do you mark a file for delete on close?        No replies
SERPNT::SONTAKKE "Vikas Sontakke"                     8 lines  27-MAY-1987 19:43
--------------------------------------------------------------------------------

    RMS manual says that if FB$MKD bit is set on FOP, the $CLOSE operation
    wll delete the file after it is closed.
    
    Does anyone know what is trick involved in getting this function
    to work?  Do you have a small MACRO-11 program which will demonstrate
    this feature?
    
    - Vikas
================================================================================
Note 46.1            How do I get FB$MKD to work on $CLOSE ?              1 of 3
RSTS32::HERBERT                                       5 lines  27-MAY-1987 21:46
                -< I have a really fuzzy memory about this... >-
--------------------------------------------------------------------------------

    Well, I don't have my book handy, and haven't coded RMS-11 for years,
    but I think that you move it into the FAB using some MACRO (I think
    that it is $STORE) before doing your $CLOSE, and it will do it.
    
    Kevin
================================================================================
Note 46.2            How do I get FB$MKD to work on $CLOSE ?              2 of 3
SERPNT::SONTAKKE "Vikas Sontakke"                    76 lines  28-MAY-1987 08:26
--------------------------------------------------------------------------------

    Page 5-4 of PRO/RMS-11 Manual says
"    
    Marking the File for Deletion
    
    If you want the closed file marked for deletion, set the FB$MKD
    mask in the 1-word FOP field of the FAB; this causes the operating
    system to delete the file as soon as it as no accessing programs.
"    
    A simple MACRO-11 program follows at the end of this note.  When
    this program is ran, the file did not get deleted.

	.TITLE	TSTRMS
	.IDENT	/X01.00/
;
	.MCALL	FAB$B, RAB$B, POOL$B
	.MCALL	$OPEN, $CLOSE, $CONNECT, $GET, $FIND, $FETCH, $STORE, $COMPARE
	.MCALL	$CREATE, $ERASE
	.MCALL	$SET,$OFF
	.MCALL DIR$, QIOW$, EXIT$S
;
FAB:	FAB$B
	F$LCH	1
	F$FAC	FB$GET!FB$PUT!FB$UPD
	F$SHR	FB$NIL
	F$FOP	FB$DLK
	F$FNA	FILE
	F$FNS	FILEZ
	FAB$E
;
RAB:	RAB$B
	R$FAB	FAB
	R$RAC	RB$SEQ
	RAB$E
;
	POOL$B
	P$FAB	1
	P$RAB	1
	P$BDB	1
	P$BUF	512.
	POOL$E
;
FILE:	.ASCII	/TMP.TMP;/
FILEZ	= . - FILE
	.EVEN
;

	.SBTTL	CODE SECTION
START:	
	MOV	#FAB,R0		;
	$CREATE	R0		;
	CALL	CHECK		;
	BCC	5$
	BPT
5$:
	MOV	#FAB,R0
;	$SET	#FB$MKD,FOP,R0
	$STORE	#FB$MKD,FOP,R0
	$CLOSE	R0
	CALL	CHECK		;
	BCC	10$
	BPT
10$:	EXIT$S

Check:
	$Fetch	R1,STS,R0	; Check the status from RMS operation
	Bpl	10$		; PL -> Success
	$Fetch	R2,STV,R0	; Else save the STV value too
	Br	99$		; And set carry
10$:	Tst	(PC)+		; Clear carry and skip the next instruction
99$:	Sec			;
	Return			;

.END	START

        
    
================================================================================
Note 46.3            How do I get FB$MKD to work on $CLOSE ?              3 of 3
SERPNT::SONTAKKE "Vikas Sontakke"                     9 lines  28-MAY-1987 08:29
           -< There must be some trick involved to get this working >-
--------------------------------------------------------------------------------

    I also tried "$SET	#FB$MKD,FOP,R0" just before $CLOSE but had no
    effect.
    
    However when I added that statement on $CREATE, the file was deleted
    regardless of the option flag on $CLOSE; *but* the directory entry was
    not removed resulting in an IE.NSF (-26.) error on its access by any
    other programs. 
    
    - Vikas
T.RTitleUserPersonal
Name
DateLines
483.1BISTRO::HEINIf We don't Have it,You don't Need it!Thu May 28 1987 12:4815
    Here is what I just answered in the RMS11 conference. (it was
    still in my NOTES$EDIT buffer) Anyone knows better?....
    
    	Vikas, I think it is supposed to work that way.
    The DOC for the FOP field, MKD bit shows that is input to the
    CREATE only. This is confirmed by the DOC on $CREATE, $OPEN
    and $CLOSE. You may want to call $ERASE to delete a file that
    is already open.
    
    	The fact that you keep your directory entry might be a bug.
    The way to prevent it is probably through the FB$TMP option. 
    
    Hope this helps,
                    Hein van den Heuvel, Valbonne.