Change Date Stamp in Revmedia (OpenInsight)
At 05 JAN 2000 05:10:04PM Marc Radley wrote:
Re Date Stamp Posted Nov '99. To be more specific we want a simple way to copy a directory with REV files in it. Once a set of data tables are duplicated we are unable to alias attach the duplicate data set. This is because OI (and AREV) use the internal data stamp in the REVMEDIA file to decide this is the same volume. We want a way to change this internal date stamp perhaps by OSREAD and OSWRITE.
At 05 JAN 2000 05:27PM WinWin/Revelation Support wrote:
An oldie but a goodie…
Hope it helps
Mike Ruane
WinWin Solutions Inc.
/*
RENAME_VOLUME
VERSION : Advanced Revelation 2.12PURPOSE : Changes the volume label (media name) on the volume directoryand on all indexes in the target volume.AUTHOR :CREATED :PROCEDURES :WARNINGS :THEORY OF OPERATION :REVISION HISTORY (Most CURRENT first) :DATE IMPLEMENTOR FUNCTION
——- ————— ————MM-DD-YY initials Modification*/
* $INSERT Blocks :
* COMMON Variables (Terminate with '%') :
* LABELED COMMON Variables (Terminate with '@') :
* EQUATE Variables (Terminate with '$') :
EQU OPEN_MEDIA$ TO 16
EQU OPEN_FILE$ TO 11
EQU WRITE_MEDIA$ TO 19
EQU TRUE$ TO 1
EQU FALSE$ TO 0
* MESSAGES called (Terminate with '$') :
* DECLARED - FUNCTIONS called :
* DECLARED - SUBROUTINES called :
DECLARE SUBROUTINE MSG
/
INDIRECT - FUNCTIONS/SUBROUTINES called if known (Make COMMENTS) :/
/* PROGRAM TOP */
NAME='
TEXT=Volume to change?"
MSG(TEXT, 'RCE', NAME,
) * Logical volume? VOL_REC=XLATE('VOC',NAME,
,'X')IF VOL_REC THEN
PATH=VOL_RECEND ELSE
PATH=NAMEEND
IF PATH-1,1 NE '\' THEN PATH := '\'
* Get a volume handle
CALL RTP57(OPEN_MEDIA$, 'RTP57',
, PATH,
, HANDLE, STATUS)IF STATUS ELSE
TEXT=UNABLE TO ACCESS VOLUME ':NAMEMSG(TEXT,'','','')STOPEND
MEDIA_HANDLE=RTP57' : @VM : HANDLE
*————————————————————————
* Get the new volume label
NEW_VOLUME_LABEL='
TEXT=New volume name?'
MSG(TEXT, 'RCE', NEW_VOLUME_LABEL,
) IF NEW_VOLUME_LABEL ELSE STOP IF INDEX(NEW_VOLUME_LABEL,'"', 1) THEN TEXT=No quotes!' msg(TEXT,
,,
)STOPEND
* Stamp the new volume label on the media map
CALL RTP57(WRITE_MEDIA$, 'RTP57', HANDLE,
,
, NEW_VOLUME_LABEL, STATUS)IF STATUS THEN
NEW_VOL_LAB=TRUE$END ELSE
NEW_VOL_LAB=FALSE$END
* Need to have a resolved select list
SELECT MEDIA_HANDLE
DONE=0
ID_LIST='
LOOP
READNEXT @ID ELSE DONE=1ID_LIST=@IDUNTIL DONE REPEAT
CHANGES=0
COL=0
FLAG='
LOOP
REMOVE @ID FROM ID_LIST AT COL SETTING FLAGWHILE FLAG
READ @RECORD FROM MEDIA_HANDLE, @ID THEN
', 1)
Is this a bang file?IF NAME1,1=!' THENGOSUB CHANGE_INDEXENDEND ; * ReadREPEAT
STOP
*————————————————————————-
CHANGE_INDEX:
/* Three things need to be done:
1) Open the !file2) Remove the !record (thereby forcing a re-init when next opened)3) Modify the !file record to change the volume label*/
* Open the file with a direct BFS call
CALL RTP57(OPEN_FILE$, 'RTP57', HANDLE, @ID,
, FILE_HANDLE, STATUS) IF STATUS ELSE TEXT=NAME : " can't be opened!" MSG(TEXT,
,,
)RETURNEND
FILE_HANDLE=RTP57' : @VM : FILE_HANDLE
* delete ! record
DELETE FILE_HANDLE, '!'
/* Change the volume label in !file rec:
Loop through each entry (they are @SVM-delim).
Match the 'field' (@TM-delim) against the index entries from *INDEXES. if there's a
Match (relational only?) then change appropriately.
The first field (@SVM delim) contains the file*acct*vol info;Change that as follows:*/
BANG_REC_NAME=FIELD(NAME,'*',1)
READ BANG_REC FROM FILE_HANDLE, BANG_REC_NAME THEN
Change 'field' 1 to reflect the new file*acct*vol_labelINDEX_INFO=BANG_RECCONVERT '*' TO @FM IN INDEX_INFOINDEX_INFO=NEW_VOLUME_LABELCONVERT @FM TO '*' IN INDEX_INFOBANG_REC=INDEX_INFO/* Loop through the remainder, looking for relational index names.If one is found, change 'field' 5 (@TM-delim) to reflect currentFile*acct*volume. */CONVERT @SVM TO @FM IN BANG_RECINDEX_CNT=COUNT( BANG_REC, @FM ) + ( BANG_REC NE '' )FOR INDEX_CTR=3 TO INDEX_CNT
(Skip first two 'fields', as these do not contain relevant information)NEXT_INDEX=BANG_RECCONVERT @TM TO @SVM IN NEXT_INDEXNEXT_INDEX_NAME=NEXT_INDEXIF INDEX(NEXT_INDEX_NAME, '*', 1) THEN
RelationalINDEX_INFO=NEXT_INDEXCONVERT '*' TO @FM IN INDEX_INFOINDEX_INFO=NEW_VOLUME_LABELCONVERT @FM TO '*' IN INDEX_INFONEXT_INDEX=INDEX_INFO
Fix the appropriate record for the relational indexGOSUB FIX_RELATIONALENDCONVERT @SVM TO @TM IN NEXT_INDEXBANG_REC=NEXT_INDEXNEXT INDEX_CTRCONVERT @FM TO @SVM IN BANG_RECWRITE BANG_REC ON FILE_HANDLE, BANG_REC_NAMEEND ELSE
TEXT=BANG_REC_NAME: ' is not available!'MSG(TEXT,'','','')END
RETURN
*————————————————————————
FIX_RELATIONAL:
/* For each relational index there is a record in the !file with the
the key as per the name in the !file record. This contains afile*acct*vol_label pointer that needs to be updated */READ RELATIONAL_REC FROM FILE_HANDLE, NEXT_INDEX_NAME THEN
INDEX_INFO=RELATIONAL_RECCONVERT '*' TO @FM IN INDEX_INFOINDEX_INFO=NEW_VOLUME_LABELCONVERT @FM TO '*' IN INDEX_INFORELATIONAL_REC=INDEX_INFOWRITE RELATIONAL_REC ON FILE_HANDLE, NEXT_INDEX_NAMEEND
RETURN
At 06 JAN 2000 09:20AM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:
Whilst Revelation Support's answer is perfect for AREV it will not work for OpenInsight for a number of reasons based in two areas.
1) AREV constructs omitting End Elses (such as Write and Delete) will not compile in OI. There is no STOP statement in OI.
2) The answer fails to address fundamental differences betwen OI and AREV.
The first area is easily addressed the second less so. Regretfully failure to address the second area will lead to data integrity problems.
The problems vis a vis OI can be split into three areas.
1) Volume information is also stored in the DBT file. This also needs to be updated. Failure to update this can lead to synchronisation errors.
2) Volume information is also stored in SYSVOLUMES. Failure to update this can lead to indexes getting out of sync.
3) Volume information in RevBoot has certain discrepancies which need to be addressed.
We have a program which addresses all of these issues (it was written for OI rather than AREV) and would be pleased to email the object code to all interested parties, please request via support@sprezzatura.com.
[/i]World leaders in all things RevSoft[/i]
At 06 JAN 2000 09:45AM Mike Ruane wrote:
As Andrew has pinted out, this program is obviously written for Arev, version 2.12, as noted in the comments. It will also work in Arev3.
At 06 JAN 2000 10:04AM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:
Actually you're right, READ needs a then else qualifier but write and delete will still compile without it.
[/i]World leaders in all things RevSoft[/i]