tldm-universe/Ardent/UV/APP.PROGS/TL.TRANS.B

359 lines
9.8 KiB
Plaintext
Raw Normal View History

2024-09-09 21:51:08 +00:00
$INCLUDE UNIVERSE.INCLUDE MTF.INCL.H
$INCLUDE UNIVERSE.INCLUDE FILENAMES.H
$INCLUDE UNIVERSE.INCLUDE MACHINE.NAME
$INCLUDE UNIVERSE.INCLUDE TLOG.H
******************************************************************************
*
* System Admin Transaction Logging - Tranfer Logs toMedia
*
* 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/26/96 18966 GMH Correct device field
* 03/25/96 18212 LAG Windows NT port
* 08/04/95 16158 DTM Fixed problem with releasing non-full files
* 03/09/95 15868 DTM Fixed problem where files were released even with error
* in backup
* 11/02/94 15225 DTM Added message of 'Working...'
* 10/12/94 15101 DTM Changed length of log number field
* 05/15/94 13286 DTM Initial programming
*
*******************************************************************************
id = "%W%"
******************
** Windows NT port
**
DEFFUN IS.FULLPATH(FILESPEC) CALLING "*IS.FULLPATH"
UV.TMP = SYSTEM(38)
TLSAVE.OK = UV.TMP:"/tlsave.ok"
**
******************
*******************************************************************************
TPRINT @(-1)
temp = NULL
CALL *ISUSER.B(0, temp)
IF temp = 0 THEN
TPRINT UVREADMSG(071000,"")
SLEEP 3
STOP
END
*******************************************************************************
GOSUB init.form
CALL *DRAW.SCRN.B( "Save Log Files", 1 )
GOSUB init.menu
CALL *MNU.BAR.PR.B(Menu.Bar,1)
*******************************************************************************
* Begin processing
*******************************************************************************
CALL *HELP.PRINT.B(UVREADMSG(073009,""),2)
CALL *PUT.FORM.B(form.size,form,temp.form,PRMPT,1)
help.loop:
CALL *HELP.PRINT.B(form<form.line,4>,1)
input.loop:
TPRINT form<form.line,2>:
temp=temp.form<form.line>
CALL *CINPUT.B(SEC.PRMPT,temp,special,form<form.line,6>,0)
IF special # 0 THEN
BEGIN CASE
CASE special = UP.ARROW
GOTO help.loop
CASE special = DOWN.ARROW
GOTO help.loop
CASE special = F.1
CALL *HELP.PRINT.B(form< form.line,5>,3)
GOTO input.loop
CASE special = ESCAPE
STOP @(-1)
CASE special = F.4
temp = "*"
GOTO new.enter
CASE special = F.10
action.value=1
CALL *DO.MNU.BAR.B(Menu.Bar,action.value,form.size,form,temp.form)
BEGIN CASE
CASE action.value = 1
STOP @(-1)
CASE action.value = 2
STOP @(-1)
CASE action.value = 3
message=UVREADMSG(073634,"")
CONVERT @FM TO " " IN message
CALL *HELP.BOX.B(3,10,60,message)
CASE action.value = 4
message=UVREADMSG(076001,"")
CONVERT @FM TO " " IN message
CALL *HELP.BOX.B(3,10,60,message)
CASE action.value = 5
CALL *HELP.BOX.B(3,10,45,UVREADMSG(076000,""))
END CASE
CALL *PUT.FORM.B(form.size,form,temp.form,PRMPT,1)
GOTO help.loop
CASE 1
GOTO input.loop
END CASE
END
ELSE
BEGIN CASE
CASE form.line = 1
new.enter:
IF temp = "*" THEN
CALL *HELP.PRINT.B(UVREADMSG(073058,""),2)
help.message = CONVERT(@FM, " ", UVREADMSG(073644,""))
CALL *HELP.PRINT.B(help.message, 2)
sel.val = 1
CALL *PTBCODE(device.file,2,sel.val)
CALL *HELP.PRINT.B(NULL,3)
IF sel.val = -1 THEN
temp = NULL
CALL *PUT.FORM.B(form.size, form, temp.form, PRMPT,1)
GOTO help.loop
END
ELSE
temp = sel.val
temp.form<form.line>=temp
END
CALL *PUT.FORM.B(form.size, form, temp.form, PRMPT, 1)
END
IF temp = NULL THEN
Blank.Message = @SYS.BELL:UVREADMSG(071004,"")
CALL *HELP.BOX.B(11,5,50,Blank.Message)
CALL *PUT.FORM.B(form.size, form, temp.form, PRMPT,1)
GOTO help.loop
END
tmpdev = temp
temp.form< form.line > = temp
CASE form.line = 2
IF temp MATCHES "0N" THEN
FirstLog = temp
temp.form< form.line > = temp
END
ELSE
message = "Answer must be a numeric value"
CALL *HELP.BOX.B(11,5,50,message)
temp.form<form.line> = ""
CALL *PUT.FORM.B(form.size, form, temp.form, PRMPT,1)
GOTO help.loop
END
CASE form.line = 3
IF temp > LastLog THEN
message = "Range includes files not ready for transfer. Value must be less than or equal to ":LastLog
CALL *HELP.BOX.B(10,5,50,message)
temp.form<form.line> = LastLog
CALL *PUT.FORM.B(form.size, form, temp.form, PRMPT,1)
GOTO help.loop
END
IF temp MATCHES "0N" THEN
LastLog = temp
temp.form< form.line > = temp
END
ELSE
message = "Answer must be a numeric value"
CALL *HELP.BOX.B(11,5,50,message)
temp.form<form.line> = ""
CALL *PUT.FORM.B(form.size, form, temp.form, PRMPT,1)
GOTO help.loop
END
END CASE
TPRINT form<form.line,2>:PRMPT:temp.form<form.line>:
TPRINT STR(SPACE,16-LEN(temp.form<form.line>)):
form.line+=1
IF form.line <= form.size THEN
GOTO help.loop
END
END
GOSUB transfer.release
CALL *HELP.BOX.B(17,5,50,UVREADMSG(001403,""))
STOP @(-1)
**********************************************************************
* transfer.release:
**********************************************************************
transfer.release:
;* Verify device
******************
** Windows NT port
**
IF IS.FULLPATH(tmpdev) THEN
DeviceName = tmpdev
END ELSE
READ tmpREC FROM device.file, tmpdev THEN
DeviceName = tmpREC<6>
END
ELSE
DeviceName = tmpdev
END
END
**
******************
msg = "Please prepare Tape Device and hit <RETURN> to back up files"
CALL *HELP.BOX.B(10,5,50, msg)
;* verify that the log numbers are sequential in number
FOR i = 1 TO id.number
IF id.array< i > # ( FirstLog - 1 + i ) THEN
msg = "Logs not in sequental order"
CALL *HELP.BOX.B(10,5,50, msg)
GOTO EXIT
END
NEXT i
;* Ok, verified that they are sequential in number
;* First, we should back them up to tape
PATH = ""
RECIO( PATH, RECIO$PATH )
exec.sentence = OS.EXEC:" '":UV.ROOT:"/bin/tlsave ":PATH:" -from "
exec.sentence := FirstLog:" -to ":LastLog:" -mt ":DeviceName:"'"
TPRINT @(-1)
PRINT "Backing up log file lg":FirstLog:" to lg":LastLog
EXECUTE exec.sentence
;* Did it work ?
******************
** Windows NT port
**
tl.fvar = ""
OPENSEQ TLSAVE.OK TO tl.fvar THEN
CLOSESEQ tl.fvar
PRINT "Finished with file backup"
PRINT "Now Releasing Files"
;* Now, files are backed up, need to release them
FOR i = FirstLog TO LastLog
PRINT "Release File lg":i
exec.sentence = "RELEASE.LFILE ":i
EXECUTE exec.sentence
NEXT i
CLOSE device.file
END
ELSE
PRINT "Error occured during back up of files... Files not released"
END
**
******************
RETURN
*************************************************************************
* Init.form
* This routine is used TO initialize the form TO be printed on the
* screen for data input. It also sets up the default answers, if
* any
*
*************************************************************************
init.form:
;* Get list of all qualified
EXECUTE "SSELECT UV_LOGS WITH STATUS = Full BY @ID TO 0" CAPTURING junk
READLIST id.array ELSE
;* If no logs with STATUS = Full are present...
msg = "No Logs are currently available (None are currently FULL)"
CALL *HELP.BOX.B(10,5,50, msg)
GOTO EXIT
END
id.number = DCOUNT( id.array, @FM )
FirstLog = id.array< 1 >
LastLog = id.array< id.number >
form = NULL
temp.form = NULL
temp.form<1> = "MT0"
temp.form<2> = FirstLog
temp.form<3> = LastLog
form.size = 3
form.line = 1
form<1,1> = @(5,7)
form<1,2> = @(30, 7)
form<1,3> = "Name of Device"
form<1,4> = "Name of the UniVerse device or Pathname from which to save."
form<1,5> = form<1,4>
form<1,6> = 45
form<2,1> = @(5,9)
form<2,2> = @(30, 9)
form<2,3> = "First Log to Backup"
form<2,4> = "Enter the number of the first log file to back up"
form<2,5> = form<1,4>
form<2,6> = 9
form<3,1> = @(5,11)
form<3,2> = @(30, 11)
form<3,3> = "Last Log to Backup"
form<3,4> = "Enter the number of the last log file to back up"
form<3,5> = form<1,4>
form<3,6> = 9
OPEN "","&DEVICE&" TO device.file ELSE
CALL *HELP.BOX.B( 5, 5, 50, "Cannot open &DEVICE& file!" )
STOP @(-1)
END
RETURN
***************************************************************************
* init.menu - initializes menu bar
***************************************************************************
init.menu:
scratch=UVREADMSG(073087,"")
Menu.Bar = NULL
Menu.Bar<1,1> = 3 ;* Number of Items in Menu.Bar
Menu.Bar<1,2> = 1 ;* Line # on which to print the Menu Bar
* First Item
Menu.Bar<2,1,1>=scratch<1> ;* SubMenu Title
Menu.Bar<2,1,2>=1 ;* # of items in SubMenu
* SubMenu #1
Menu.Bar<2,2,1>=scratch<6> ;* SubMenu Item
Menu.Bar<2,2,2>=1 ;* Action Code (Returned to calling process)
Menu.Bar<2,2,3>=scratch<7>
* Second Item
Menu.Bar<3,1,1>=scratch<8> ;* SubMenu Title
Menu.Bar<3,1,2>=1 ;* # of items in SubMenu
* SubMenu #1
Menu.Bar<3,2,1>=scratch<6> ;* SubMenu Item
Menu.Bar<3,2,2>=2 ;* Action Code
Menu.Bar<3,2,3>=scratch<7>
scratch=UVREADMSG(073089,"")
Menu.Bar<4,1,1>=scratch<1>
Menu.Bar<4,1,2>=3
Menu.Bar<4,2,1>=scratch<2>
Menu.Bar<4,2,2>=3
Menu.Bar<4,2,3>=scratch<3>
Menu.Bar<4,3,1>=scratch<4>
Menu.Bar<4,3,2>=4
Menu.Bar<4,3,3>=scratch<5>
Menu.Bar<4,4,1>=scratch<6>
Menu.Bar<4,4,2>=5
Menu.Bar<4,4,3>=scratch<7>
RETURN
EXIT:
STOP
END