@echo off
rem
rem NetVault_Adabas_PrePost	Pre- and Post-Script templates
rem				for NetVault-Adabas D coupling

rem 	SAP AG		1996-05-03

rem To use these templates, perform the following steps:
rem 1. Make a copy of this file and in it set the variables
rem    a) DBROOT to the ADABAS installation directory
rem       (not needed if the system-wide setting is correct),
rem    b) SERVERDB to the name of your database, and
rem    c) NV_DIR to the NetVault installation directory.
rem 2. For each variant of saves you use for this database,
rem    copy this DB-specific file and set the variables
rem    a) ACTION ('SAVEDATA', 'SAVELOG', 'SAVEPAGES') and
rem    b) MEDIUM (e.g. 'EXTERN_D', 'EXTERN_L').
rem 3. Make two extracts of each of these DB- and action-
rem    specific copies:
rem    a) the "Common Variables" and the "PreScript",
rem    b) the "Common Variables" and the "PostScript",
rem    store them as '.bat' files in the 'scripts' subdirectory
rem    of your NetVault installation, they are the pre-
rem    and post-scripts for BACKUP.
rem 4. Make a copy of the pre-script and change 'xbackup' to
rem    'xrestore', this is the RESTORE pre-script.
rem    You do not need a restore post-script.
rem 5. Use CONTROL (menu item "Backup" -> "Media Manager")
rem    to define the media (set in step 2):
rem    the NetVault pipe name 'XYZ' corresponds to the
rem    ADABAS device name '\\.\Pipe\XYZ', device type is 'P'.
rem 6. Administer NetVault to associate the pipe names
rem    with the pre- and post-scripts.
rem These steps must be executed for each database you want to
rem save using NetVault.


rem	Conventions:
rem DBROOT, SERVERDB: standard Adabas semantics
rem ACTION	see CONTROL / xbackup manual
rem MEDIUM	must start 'EXTERN', optional two more chars
rem %1		NetVault job number
rem %2 = pipe name    must be defined in CONTROL and NetVault

rem =================================
rem	Common Variables

rem set DBROOT=E:\ADABAS

set SERVERDB=SAVETEST
set NV_DIR=E:\NETVAULT
set ACTION=SAVEDATA
set MEDIUM=EXTERN_D

set XB_PROT=%DBROOT%\wrk\%SERVERDB%\xbackup.%1.prt

rem =================================
rem	PreScript

start cmd /c "%DBROOT%\bin\xbackup -d %SERVERDB% -a %ACTION% -m %MEDIUM% -f \\.\Pipe\%2 > %XB_PROT%"

rem =================================
rem	PostScript

%SYSTEMROOT%\system32\find "finished successfully" %XB_PROT%  > NUL
if not errorlevel 1 goto :good

rem No 'ok' message in protocol - produce error info
echo "No ADABAS success info for job %1 to pipe %2"
%NV_DIR%\bin\joberr %1 9
goto :finish

:good
echo "ADABAS was successful for job %1 to pipe %2"

:finish

rem =================================
