Problem:
WINDOWS scripting ( .wsf) to update registries for Application Server 3.1 or 4.0 and Application Server KEYS DataBase on a computer where Application Server and Application Server KEYS DataBase are not installed. ( The aim is to use an Application Server and an Application Server KEYS DataBase available on the network ) .
Updating registries -> you'll be able to run on a PC where Application Server not installed .EXE application linked as shared DYNAMIC ( dynamic meaning i find in registries the location of the Application Server )
Resolution:
======
Modify csetas40env.bat so parameters
AS40InstDir et AS40LMFDIR conform to your environment
Modify:
ASLMF=ASLMF ( and not ASLMFx )
AS40RegistryEntry=Net Express\\4.0\\COBOL\\4.0\\Environment
launch in a DOS prompt:
csetas40env.bat
====================================================
csetas40env.bat
@echo off
cls
rem ===========================
set HKLM_MF=HKLM\\Software\\Micro Focus\\
rem ===========================
rem ASLMF =
set it to ASLMF
set ASLMF=ASLMF
rem ===========================
rem set AS40RegistryEntry to:
rem
for AS 4.0 of Netx 4.0: AS40RegistryEntry=Net Express\\4.0\\COBOL\\4.0\\Environment
rem
for AS 3.1 of Netx 3.1: AS40RegistryEntry=Net Express\\3.1\\COBOL\\3.1\\Environment
set AS40RegistryEntry=NetExpress\\4.x\\COBOL\\4.x\\Environment
rem AS40InstDir = UNC path of the Install DIR of AS on the network
rem Example:
rem
let's say AS 4.0 is installed on a server name named SERVERAS40
rem
and AS 40 installation DIR on SERVERAS40 is shared as SharedAS40
rem ---> AS40InstDir=\\\\SERVERAS40\\SharedAS40
set AS40InstDir=\\\\par2000yva\\c\\ne40\\base\\bin
rem ===========================
rem AS40LMFDIR = UNC path of the path of AS DB on the network
rem Example:
rem
let's say AS 4.0 is installed on a server name named SERVERAS40
rem
case 1:
and AS 40 installation DIR on SERVERAS40 is C:\\MFASLMF
rem
and drive C: of SERVERAS40 is shared as C
rem
---> AS40LMFDIR=\\\\SERVERAS40\\C\\mfaslmf
rem
case 2:
and AS 40 installation DIR on SERVERAS40 is C:\\MFASLMF
rem
and C:\\MFASLMF of C:\\MFASLMF shared as MFASLMF
rem
---> AS40LMFDIR=\\\\SERVERAS40\\MFASLMF
set AS40LMFDIR=\\\\par2000yva\\c\\yva\\yva_wrk\\apptrack\\bdapptrack
rem ===========================
rem echo %HKLM_MF%
rem echo %AS40RegistryEntry%
rem echo %AS40InstDir%
rem echo %ASLMFDIR%
rem ===========================
rem check params
:AS40InstDir
echo == check DIR existe: %AS40InstDir%
if exist %AS40InstDir% goto AS40LMFDIR
echo -- le répertoire %AS40InstDir% n'existe pas
( ERROR 1)
goto fin-ko
rem ===========================
:AS40LMFDIR
echo == check DIR existe: %AS40LMFDIR%
if exist %AS40LMFDIR% goto AS40LMFDIRTestWriteAccess
echo -- le répertoire %AS40LMFDIR% n'existe pas
( ERROR 2)
goto fin-ko
rem ===========================
:AS40LMFDIRTestWriteAccess
echo AS40LMFDIRTestWriteAccess >%AS40LMFDIR%\\test.log
if errorlevel 0 goto AS40LMFDIRTestDelAccess
echo -- Vous n'avez pas l'accès en écriture
echo --
au répertoire %AS40LMFDIR%
( ERROR 3 1)
goto fin-ko
rem ===========================
:AS40LMFDIRTestDelAccess
del %AS40LMFDIR%\\test.log
if errorlevel 0 goto lcscript
echo -- Vous n'avez pas l'accès en suppression
echo --
au répertoire %AS40LMFDIR%
( ERROR 3 2)
goto fin-ko
rem ===========================
:lcscript
cscript csetAS40env.wsf
if errorlevel 0 goto fin-ok
echo -- erreur dans la commande cscript.exe
( ERROR 4)
goto fin-ko
rem ===========================
:fin-ko
echo == Fin anormale du script
goto fin
rem ===========================
:fin-ok
echo == Fin normale du script
goto fin
rem ===========================
:fin
====================================================
csetas40env.wsf
<job id="ReadMFREG">
<script language="VBScript">
' Création d'un objet Shell
'WScript.Stdout.Write("Beginning of the script ")
WScript.StdOut.WriteBlankLines 1
Set Ws = Wscript.CreateObject("Wscript.Shell")
HKLM_MF=Ws.ExpandEnvironmentStrings("%HKLM_MF%")
AS40reg=Ws.ExpandEnvironmentStrings("%AS40RegistryEntry%")
AS40InstDir=Ws.ExpandEnvironmentStrings("%AS40InstDir%")
AS40ASLMFDIR=Ws.ExpandEnvironmentStrings("%AS40LMFDIR%")
ASLMF=Ws.ExpandEnvironmentStrings("%ASLMF%")
WScript.Stdout.Write("HKLM_MF:
" HKLM_MF)
WScript.StdOut.WriteBlankLines 1
WScript.Stdout.Write("AS40RegistryEntry:
" AS40reg)
WScript.StdOut.WriteBlankLines 1
WScript.Stdout.Write("AS40InstDir:
" AS40InstDir)
WScript.StdOut.WriteBlankLines 1
WScript.Stdout.Write("ASLMFDIR:
" AS40ASLMFDIR)
WScript.StdOut.WriteBlankLines 1
WScript.Stdout.Write("ASLMF:
" ASLMF)
Ws.RegWrite HKLM_MF AS40reg "\\COBDIR",AS40InstDir ";%COBDIR%","REG_EXPAND_SZ"
Ws.RegWrite HKLM_MF AS40reg "\\COBHNF",AS40InstDir ";%COBHNF%","REG_EXPAND_SZ"
Ws.RegWrite HKLM_MF AS40reg "\\PATH" ,AS40InstDir ";%PATH%","REG_EXPAND_SZ"
Ws.RegWrite HKLM_MF ASLMF "\\ASLMFDIR",AS40ASLMFDIR,"REG_EXPAND_SZ"
Ws.RegWrite HKLM_MF ASLMF "\\prompt","20041225","REG_EXPAND_SZ"
Ws.RegWrite HKLM_MF ASLMF "\\status","0","REG_EXPAND_SZ"
WScript.StdOut.WriteBlankLines 1
WScript.Stdout.Write("AS 40 Environment:")
WScript.StdOut.WriteBlankLines 1
WScript.Stdout.Write("COBDIR:
"
WS.RegRead(HKLM_MF AS40reg "\\COBDIR"))
WScript.StdOut.WriteBlankLines 1
WScript.Stdout.Write("COBHNF:
"
WS.RegRead(HKLM_MF AS40reg "\\COBHNF"))
WScript.StdOut.WriteBlankLines 1
WScript.Stdout.Write("PATH:
"
WS.RegRead(HKLM_MF AS40reg "\\PATH"))
WScript.StdOut.WriteBlankLines 1
WScript.StdOut.WriteBlankLines 1
WScript.Stdout.Write("ASLMF Environment:")
WScript.StdOut.WriteBlankLines 1
WScript.Stdout.Write("ASLMFDIR:
" WS.RegRead(HKLM_MF ASLMF "\\ASLMFDIR"))
WScript.StdOut.WriteBlankLines 1
WScript.Stdout.Write("prompt:
" WS.RegRead(HKLM_MF ASLMF "\\prompt"))
WScript.StdOut.WriteBlankLines 1
WScript.Stdout.Write("status:
" WS.RegRead(HKLM_MF ASLMF "\\status"))
WScript.StdOut.WriteBlankLines 1
'WScript.Stdout.Write("End of the script ")
</script>
</job>
====================================================