tldm-universe/Ardent/UV/APP.PROGS/REC.CHKPT.B
2024-09-09 17:51:08 -04:00

227 lines
5.1 KiB
Brainfuck
Executable File

******************************************************************************
*
* System Admin Transaction Logging - Routine to get the CHECKPOINT data
*
* Module %M% Version %I% Date %H%
*
* (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved
* This is unpublished proprietary source code of Ardent Software Inc.
* The copyright notice above does not evidence any actual or intended
* publication of such source code.
*
*******************************************************************************
*
* Maintenence log - insert most recent change descriptions at top
*
* Date.... GTAR# WHO Description........................................
* 10/14/98 23801 SAP Change copyrights.
* 08/29/96 19074 JC Fix previous fix.
* 08/16/96 19074 JC Fix to setup correct first and last log numbers.
* 05/28/96 17839 LA Allow special call from UniVerse Admin subroutine
* 03/26/96 18212 LAG Windows NT port
* 11/04/94 15261 DTM Fixed by setting low mark to 999999999
* 10/14/94 15104 DTM Fixed to verify number of prompts
* 05/15/94 13286 DTM Initial programming
*
*******************************************************************************
id = "%W%"
*******************************************************************************
$INCLUDE UNIVERSE.INCLUDE TLOG.H
******************
** Windows NT port
**
DEFFUN IS.FULLPATH(FILESPEC) CALLING "*IS.FULLPATH"
**
******************
ADMINOPT = 0 ;* Assume not called from UVAdmin
TMP = TRIM( @SENTENCE )
CNT = COUNT( TMP, " " )
IF ( CNT NE 1 ) THEN
If ( CNT EQ 2 ) AND ( FIELD(TMP, " ", 3) = "1" ) Then
ADMINOPT = 1 ;* Called from UVAdmin
END ELSE
PRINT "Error: Incorrect number of arguments"
STOP
END
END
File = UPCASE( FIELD( TMP, " ", 2 ) )
Use.All = 0
IF File = "ALL" THEN
EXECUTE "SSELECT UV.TRANS WITH STATUS TO 0" CAPTURING junk
Use.All = 1
END
ELSE
GETLIST File TO 0 ELSE
IF ADMINOPT = 1 THEN
Print "-1"
END ELSE
PRINT "Cannot get select list"
END
STOP
END
END
lping = 1
LowMark = 999999999
HighMark = 0
open.acct = 1
FileRec = ""
File = ""
OPEN "", "UV.ACCOUNT" TO file.var ELSE
open.acct = 0
END
OPEN "", "UV.TRANS" TO trans.var ELSE
IF ADMINOPT = 1 THEN
PRINT "-2"
END ELSE
PRINT "Cannot open UV.TRANS file"
END
STOP
END
LOOP
READNEXT transRec THEN
If Use.All Then
* At this point, we have the UV.TRANS file rec. We need to get the
* ACCOUNT and FILE to find the pathname in there. If that doesn't
* exist, we should use the pathname supplied in the UV.TRANS file
* Ok, let's get the ACCOUNT
READ FileRec FROM trans.var, transRec THEN
IF open.acct THEN
Acct = FileRec<1>
READ AcctRec FROM file.var, Acct THEN
AcctFile = AcctRec<11> ;* Ok, now we got the unix path
OPENPATH AcctFile:"/VOC" TO xfile.var THEN
* We got the open path to the account, let's find
* out path to the file...
READ xFileRec from xfile.var, FileRec<2> THEN
* Now we have the open remote acct, and the file
tmpFile = xFileRec<2>
IF IS.FULLPATH(tmpFile) THEN
File = tmpFile
END
ELSE
File = AcctFile:"/":tmpFile
END
END
ELSE
File = FileRec<4>
END
END
ELSE
File = FileRec<4>
END
END
ELSE
File = FileRec<4>
END
END
ELSE
File = FileRec<4>
END
END
ELSE
If ADMINOPT = 1 Then
Print "-3"
End Else
Print "Unable to read item from UV.TRANS file"
End
Stop
END
END
ELSE
File = transRec
END
id = 0
@SYSTEM.RETURN.CODE = 0
RECIO( File, id, RECIO$CHECKPOINT )
IF @SYSTEM.RETURN.CODE = 0 THEN
* Set up the First Log file number.
IF id < LowMark And id > 0 THEN
LowMark = id
END
END
END
ELSE
lping = 0
END
UNTIL lping = 0 REPEAT
* Find the Last used log number
@SYSTEM.RETURN.CODE = 0
id = 0
RECIO (id, FINFO$AI.FIRSTSEQ, RECIO$FINFO)
If @SYSTEM.RETURN.CODE = 0 Then
HighMark = id - 1
End Else
* Unable to last log number from RECIO, so the log file
* must be full or none available, so get the last log number
* from the DICT UV_LOGS
Open "DICT", "UV_LOGS" to logfile Else
If ADMINOPT = 1 Then
Print "-4"
End Else
Print "Unable to open D_UV_LOGS"
End
Stop
End
Readv id from logfile,"LOG.NEXT",2 Else
If ADMINOPT = 1 Then
Print "-5"
End Else
Print "Unable to read LOG.NEXT record from D_UV_LOGS"
End
Stop
End
HighMark = id - 1
End
If HighMark = 0 Then
* No checkpointed logfiles so set both to zero
LowMark = 0
End
If LowMark = 999999999 Then
LowMark = 0
End
* If the first log is less than the last log then the first
* log is the one that has been used and synced, therefore
* add one the the first log.
If LowMark < HighMark Then
LowMark += 1
End
CLOSE xfile.var
CLOSE file.var
IF ADMINOPT = 1 THEN
PRINT LowMark : @VM : HighMark
END ELSE
PRINT "First log is ":LowMark
PRINT "Last log is ":HighMark
END
END