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

122 lines
3.0 KiB
Plaintext
Executable File

******************************************************************************
*
* System Admin Transaction Logging - Save Files
*
* 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.
* 06/07/96 18591 EAP Module created
*
*******************************************************************************
$OPTIONS INFORMATION
id = "%W%"
*******************************************************************************
$INCLUDE UNIVERSE.INCLUDE TLOG.H
$INCLUDE UNIVERSE.INCLUDE FILENAMES.H
$INCLUDE UNIVERSE.INCLUDE MACHINE.NAME
$IFDEF UV.MSWIN
$DEFINE COMMAND.SEPARATOR "&&"
$ELSE
$DEFINE COMMAND.SEPARATOR ";"
$ENDIF
TMP = TRIM( @SENTENCE )
@SYSTEM.RETURN.CODE = 0
CNT = COUNT( TMP, " " )
IF ( CNT < 2 OR CNT > 4 ) THEN
PRINT "Error: Incorrect number of arguments"
@SYSTEM.RETURN.CODE = -1
END
FirstLog = FIELD( TMP, " ", 2 )
LastLog = FIELD( TMP, " ", 3 )
PATH = FIELD( TMP, " ", 4 )
IF PATH = "" THEN
* Use current logging directory
RECIO( PATH, RECIO$PATH )
END
* Check that the specified directory exists
OPENPATH PATH TO FVAR THEN
IF STATUS() <> 19 AND STATUS() <> 1 THEN
PRINT "Error: ":PATH:" is not a directory."
@SYSTEM.RETURN.CODE = -1
END
END
ELSE
PRINT "Error: Unable to open ":PATH
@SYSTEM.RETURN.CODE = -1
END
CLOSE FVAR
Device = FIELD( TMP, " ", 5 )
IF Device = "" THEN
* use MT0
Device = "MT0"
END
* If Device is the id of a record in the &DEVICE& file then it is a
* Universe device name otherwise its is an OS file name which on UNIX
* could be an OS tape device name.
OPEN "","&DEVICE&" TO FVAR ELSE
PRINT "Error: Unable to open &DEVICE& file."
@SYSTEM.RETURN.CODE = -1
END
READV REC FROM FVAR,Device,0 ELSE
Filename = Device
Device = ""
END
CLOSE FVAR
* Generate a list of log file names to save.
list = ""
FOR i = FirstLog TO LastLog
list := " lg":i
NEXT i
IF @SYSTEM.RETURN.CODE = 0 AND list <> "" THEN
* Get settings for terminal so that we can restore them after
* uvbackup has completed.
TTYGET tty.settings ELSE NULL
* cd to logging directory and save using file name list so that the log files
* can be easily restored somewhere else.
* Blocksize of 512 is temporary workaround for Gtar 18540
Exec.Sentence = OS.EXEC:" 'cd ":PATH:COMMAND.SEPARATOR:UV.ROOT:"/bin/uvbackup -v -b 512 -f":list
IF Device <> "" THEN
Exec.Sentence := " -t ":Device
END
ELSE
Exec.Sentence := " >":Filename
END
Exec.Sentence := "'"
EXECUTE Exec.Sentence
TTYSET tty.settings ELSE NULL
END
RETURN
END