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

439 lines
13 KiB
Plaintext
Executable File

*****************************************************************************
*
* Transaction Logger Activation of file STUB
*
* 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.
* 09/18/96 19269 DJD Added NT file sep. support.
* 03/28/96 18212 LAG Windows NT port
* 11/17/94 15270 EAP Corrected type in file header
* 11/16/94 15270 EAP Moved index file handling into log_main
* 10/25/94 15178 EAP More informative when activating Indexed files
* 09/16/94 15016 DTM Fixed condition where file had been activated before
* 07/22/94 13286 DTM Cleaned up message output...
* 07/13/94 14357 EAP Modified to activate INDEX files
* 04/28/93 10228 DTM Enhanced to use MOTIF style...
* 02/09/93 11033 CSM Process file names containing $
* 12/19/91 8483 GMH Fixed error message from UV.ACCOUNT check
* 12/16/91 8997 GMH Added uvhome path
* 10/08/91 8439 GMH Added entry for multiple files per account
* 09/13/91 8438 GMH Added UV.ACCOUNT check
* 09/13/91 8436 GMH Removed TLprim/TLsec verification
* 05/14/91 8345 KIS Changed PRINTs to TPRINTs
* 04/25/91 8230 KIS Added null var for CINPUT
* 03/25/91 8169 KIS Added extra arg to CHOICE.box.B
* 03/11/91 7876 KIS Added args = ''
* 02/24/91 7915 KIS Added prompts for acct and filename
* 02/12/91 7911 KIS Changed HELP to CHOICE box for user to acknowl.
* 01/07/91 7896 KIS Changed call of log.activate to "log_main 1"
* 12/29/90 7791 KIS Added call to ISUSER.B
* 04/06/90 - KIS Initial
*
*******************************************************************************
*
$INCLUDE UNIVERSE.INCLUDE MTF.INCL.H
$INCLUDE UNIVERSE.INCLUDE FILENAMES.H
$INCLUDE UNIVERSE.INCLUDE MACHINE.NAME
*
**************************************
* Initializations
**************************************
CLSCR = @(-1)
CLLIN = @(-4)
*************************************************************************
* The program is a stub in SysAdmin to run the C program log.activate
*************************************************************************
title = 'Transaction Logging File Activation'
args = ""
temp = ""
temp2 = ""
b.array = ""
b.array<1> = 1
b.array<2> = UVREADMSG(073029,"")
sel = 1
dtype = 0
hit.return = ""
hit.return = UVREADMSG(001403,"")
EQU size TO 3
EQU devtype TO 4
* Get uid of user
CALL *ISUSER.B(0,id2)
* Display
GOSUB init.form
GOSUB init.menu
TPRINT CLSCR
CALL *DRAW.SCRN.B(title,1)
msg = "This program is used to allow the administrator to activate one or "
msg := "more programs for logging"
CALL *PUT.FORM.B(form.size,form,"","?",1)
CALL *MNU.BAR.PR.B(Menu.Bar,1)
* Do work if superuser
IF id2 = 1 THEN
* Make certain devices are configured
* Commented out for gtar 8436
* gosub VERIFY.LOG.DEVICES:
* Prompt for Account name and filename
* Let's first open the UV.ACCOUNT file
open 'UV.ACCOUNT' to VALID.ACCOUNTS else
temp = UVREADMSG(1322,"UV.ACCOUNT")
CALL *CHOICE.BOX.B(7,7,40,temp<1>:" ":hit.return<1>,b.array,sel,"")
stop
end
accnam = ''
CALL *HELP.PRINT.B(msg, 3)
INPUT.LOOP:
* Enter account name
* PRINT @(10,5):CLLIN:
* CALL *UVPRINTMSG(85122,"");
CALL *HELP.PRINT.B(form<form.line, 4>,2)
TPRINT form<form.line,2>:
inputvalue=''
special = ''
CALL *CINPUT.B(" ",inputvalue,special,form<form.line,6>,form<form.line,7>)
* Verify results
IF special # 0 THEN
BEGIN CASE
CASE special = ESCAPE
TPRINT CLSCR
STOP
CASE special = F.1
CALL *HELP.PRINT.B(form<form.line,4>, 3)
GOTO INPUT.LOOP
CASE special = F.4
BEGIN CASE
CASE form.line = 1
GOSUB List.Accounts
if (sel.val > 0) THEN
accnam = list.array<sel.val, 1>
end else
CALL *PUT.FORM.B(form.size,form,input.form,"?",1)
GOTO INPUT.LOOP
end
input.form<1> = accnam
form.line = 2
CASE form.line = 2
GOSUB List.Files
if (ans > 0) THEN
filnam = list.list<ans>
end else
CALL *PUT.FORM.B(form.size,form,input.form,"?",1)
CALL *HELP.PRINT.B("",1)
GOTO INPUT.LOOP
end
input.form<2> = filnam
CALL *PUT.FORM.B(form.size,form,input.form,"?",1)
GOTO DoFileCheck:
END CASE
CALL *PUT.FORM.B(form.size,form,input.form,"?",1)
CASE special = F.10
action.value=1
CALL *DO.MNU.BAR.B(Menu.Bar,action.value,form.size,form,input.form)
BEGIN CASE
CASE action.value = 1
STOP @(-1)
CASE action.value = 2
STOP @(-1)
CASE action.value = 3
message=gmsg
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,input.form,"?",1)
goto INPUT.LOOP
CASE special = UP.ARROW
if form.line # 2 then GOTO INPUT.LOOP:
form.line = 1
GOTO INPUT.LOOP:
CASE 1
sel = 1
CALL *PUT.FORM.B(form.size,form,input.form,"?",1)
goto INPUT.LOOP:
END CASE
END ELSE
BEGIN CASE
CASE form.line = 1
IF inputvalue = '' THEN TPRINT CLSCR;STOP
accnam = inputvalue
* Let's verify accname entered
readv temp from VALID.ACCOUNTS,accnam,0 else
temp = UVREADMSG(85001,accnam)
temp := " ":hit.return<1>
CALL *CHOICE.BOX.B(5,10,40,temp,b.array,sel,"")
CALL *PUT.FORM.B(form.size,form,input.form,"?",1)
goto INPUT.LOOP:
end
filnam = ''
input.form<1> = accnam
form.line = 2
GOTO INPUT.LOOP:
CASE form.line = 2
filnam = inputvalue
IF filnam = '' THEN GOTO INPUT.LOOP:
input.form<2> = filnam
CALL *HELP.PRINT.B(UVREADMSG(073058,""),3)
DoFileCheck:
* Check if DICT or PDICT part of file, then parse out.
numsp = COUNT(filnam,' ')
dname = ""
IF numsp = 1 THEN
dname = FIELD(filnam," ",1)
filnam = FIELD(filnam," ",2)
IF dname = 'DICT' THEN
dtype = 1
END ELSE IF dname = 'PDICT' THEN
dtype = 2
END ELSE
temp = UVREADMSG(85130,"")
CALL *CHOICE.BOX.B(7,7,40,temp<1>:" ":hit.return<1>,b.array,sel,"")
CALL *PUT.FORM.B(form.size,form,input.form,"?",1)
goto INPUT.LOOP:
END
END ELSE IF numsp = 0 THEN
IF filnam = 'DICT' OR filnam = 'PDICT' THEN
temp = UVREADMSG(85124,"")
CALL *CHOICE.BOX.B(7,7,40,temp<1>:" ":hit.return<1>,b.array,sel,"")
CALL *PUT.FORM.B(form.size,form,input.form,"?",1)
goto INPUT.LOOP:
END
dtype = 0
END ELSE
temp = UVREADMSG(85130,"")
CALL *CHOICE.BOX.B(7,7,40,temp<1>:" ":hit.return<1>,b.array,sel,"")
CALL *PUT.FORM.B(form.size,form,input.form,"?",1)
goto INPUT.LOOP:
END
GOSUB DisplayIt
msg = "Account (":accnam:") - Filename (":filnam:") has been "
msg :="activated. Please enter another, or hit return/ESCAPE to exit"
CALL *HELP.PRINT.B(msg, 2)
CALL *PUT.FORM.B(form.size,form,input.form,"?",1)
END CASE
END
goto INPUT.LOOP:
END ELSE
*Must be a superuser to execute this program.
temp = UVREADMSG(71000,"")
CALL *CHOICE.BOX.B(7,7,40,temp<1>:" ":hit.return<1>,b.array,sel,"")
TPRINT CLSCR:
END
* End of main
STOP
*
*Start of subroutines
*
VERIFY.LOG.DEVICES:
*** Open &DEVICE& file to make sure that devices were configured ***
OPEN '','&DEVICE&' TO fvdevice ELSE
temp = UVREADMSG(1322,"&DEVICE&")
CALL *CHOICE.BOX.B(7,7,40,temp<1>:" ":hit.return<1>,b.array,sel,"")
stop
END
READ TLprim FROM fvdevice, 'TLprim' ELSE
args<1> = "TLprim"
args<2> = "&DEVICE&"
temp = UVREADMSG(20052,args)
temp2 = UVREADMSG(85209,"")
CALL *CHOICE.BOX.B(7,7,40,temp<1>:" ":temp2<1>:" ":hit.return<1>,b.array,sel,"")
stop
END
READ TLsec FROM fvdevice, 'TLsec' ELSE
args<1> = "TLsec"
args<2> = "&DEVICE&"
temp = UVREADMSG(20052,args)
temp2 = UVREADMSG(85209,"")
CALL *CHOICE.BOX.B(7,7,40,temp<1>:" ":temp2<1>:" ":hit.return<1>,b.array,sel,"")
stop
END
*** Make sure TLprim & sec contain somewhat appropriate config. info
if TLprim<devtype>[1,1] # 'L' or NOT(NUM(TLprim<size>)) then
temp = UVREADMSG(85214,"TLprim")
CALL *CHOICE.BOX.B(7,7,40,temp<1>:" ":hit.return<1>,b.array,sel,"")
stop
END
if TLsec<devtype>[1,1] # 'L' or NOT(NUM(TLsec<size>)) then
temp = UVREADMSG(85214,"TLsec")
CALL *CHOICE.BOX.B(7,7,40,temp<1>:" ":hit.return<1>,b.array,sel,"")
stop
END
END.OF.VERIFY:
RETURN
init.form:
form= NULL
form.size = 2
form.line = 1
form<1,1> = @(3,6)
form<1,2> = @(52,6)
form<1,3> = "Enter account name containing file to activate:"
form<1,4> = "Enter account name containing file or F4 to get a complete "
form<1,4> := "list of uniVerse accounts"
form<1,5> = form<1,4>
form<1,6> = 25
form<1,7> = 1
form<2,1> = @(3,8)
form<2,2> = @(52,8)
form<2,3> = "Enter file to activate:"
form<2,4> = "Enter file to be activated for logging"
form<2,5> = form<1,4>
form<2,6> = 25
form<2,7> = 1
input.form = ""
input.form<1> = ""
input.form<2> = ""
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
gmsg = "Transaction Logging File Activation - This applications is used "
gmsg :=" to activate files for transaction logging."
Menu.Bar<4,2,3>=gmsg
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
List.Accounts:
CALL *HELP.PRINT.B(UVREADMSG(073058,""),2)
SELECT VALID.ACCOUNTS
list.array=""
lping = 1
uv.acct.cnt = 0
LOOP
READNEXT temp ELSE lping = 0
uv.acct.cnt+=1
list.array<uv.acct.cnt,1> = temp
READ invar FROM VALID.ACCOUNTS,temp ELSE NULL
list.array<uv.acct.cnt,2>=invar<11>
UNTIL lping = 0 REPEAT
sel.val=1
title=""
title<1>=0
title<2>="Account"
title<3>="Directory"
CALL *LIST.BOX.B(title,4,11,list.array,uv.acct.cnt,2,sel.val,0)
CALL *HELP.PRINT.B("",3)
RETURN
List.Files:
CALL *HELP.PRINT.B(UVREADMSG(073058,""),2)
command = 'SSELECT REMOTE.VOC WITH TYPE = "F" AND WITH F2 UNLIKE ".../..."'
command := ' AND WITH F2 UNLIKE "...\..."'
execute "SSELECT UV.ACCOUNT ":accnam:" SAVING PATH" capturing SCREEN
readlist tmp else return
rvoc = ""
rvoc<1> = "F"
rvoc<2> = tmp:"/VOC"
rvoc<3> = "D_VOC"
OPEN 'VOC' to UV.VOC ELSE RETURN
write rvoc on UV.VOC, "REMOTE.VOC" else
temp = UVREADMSG(085624,"")
RP = ""
RP<1> = 1
RP<2> = UVREADMSG(073029,"")
sel = 1
HR = UVREADMSG(001403,"")
call *CHOICE.BOX.B(5,7,40,temp<1>:" ":HR<1>,RP,sel,"")
CALL *PUT.FORM.B(form.size,form,input.form,"?",1)
RETURN
END
execute command capturing SCREEN
readlist list.list else
return
end
list.max = DCOUNT(list.list,@fm)
max.lines = if list.max > 11 then 11 else list.max
ans = 1
list.list = DELETE(list.list,1)
call *LIST.BOX.B("Files", 4, max.lines, list.list, list.max, 1, ans, 0)
IF ans # -1 THEN
filnam = list.list<ans>
END
RETURN
DisplayIt:
TPRINT CLSCR
command = OS.EXEC:" '":UV.ROOT:"/bin/log_main 1"
command:= " ":'"':accnam:'"':" ":dtype:" ":dname:" ":'"':filnam:'"':"'"
execute command
message = "Press Return to Continue"
CALL *HELP.BOX.B( 9, 10,50,message )
CALL *DRAW.SCRN.B( title, 1)
CALL *PUT.FORM.B(form.size,form,input.form,"?",1)
CALL *MNU.BAR.PR.B(Menu.Bar, 1)
RETURN
*
* End of program
*
END