home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
netdor3.zip
/
DISK_13
/
IMAGE12.ZIP
/
CATALOG
/
nvdm2be.cmd
< prev
next >
Wrap
OS/2 REXX Batch file
|
1994-12-12
|
9KB
|
320 lines
/*****************************************************************************
* Licensed Materials-Property of IBM *
* 5604-472 (c) Copyright IBM Corporation, 1993 *
* All rights reserved. *
* US Government Users Restricted Rights - *
* Use, duplication or disclosure restricted *
* by GSA ADP Schedule Contract with IBM Corp. *
*****************************************************************************/
/*****************************************************************************
* Configuration back-end NVDM2BE *
*****************************************************************************/
signal on error
signal on syntax
signal on novalue
call on halt
call rxfuncadd 'CADDINIT', 'RXCADD', 'CADDINIT'
call rxfuncadd 'RXLOADFUNCS', 'RXUTILS', 'RXLOADFUNCS'
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
rc=RxLoadFuncs('QUIET')
Ver = 'CAddInit'()
if abbrev(Ver, 'ERROR:')
then exit 200
ndm2obj=rxcadd.proginfo.5 /* NVDM2 Object Name */
cdminstcomm='CDM INSTALL '
cdmremcomm='CDM REMOVE '
nvdm2ini=GetNvDM2Path() ;
nvdm2ini=nvdm2ini||'IBMNVDM2.INI' ; /*Full path to NvDM2 INI file */
clientkey='ClientName'
serverkey='ServerName'
Title = RxCAdd.STitle 'Installation'
XCode = 0
if 'REGFUNC'('COUENV') <> 0
then call AddExit 206, 'Error registering COUENV.DLL.'
CDr = GetRemoteDrive()
CDr = strip(CDr, 'T', '\')'\'
call directory CDr
wsid=getwsid() /* NDM2 workstation name */
ndm2obj=getndmname() /* NVDM2 Object Name */
call startndmagent
select
when RxCAdd.OpType = 'ADD'
then do
call DeleteQ
call CreateQ
call dmobput ndm2obj rxcadd.stitle
say 'Invoking NvDM/2...'
'@net run cmd /c "'cdminstcomm ndm2obj '/WS:'wsid '/R:Y' '"'
if rc=0 then
do
call 'MessageBox' Title, 'The NvDM/2 CDM Install Request for' RxCAdd.Stitle 'was succesfully started.',
'NvDM/2 is installing 'RxCAdd.Stitle 'on your machine, please wait...'
say 'Please wait...'
ndm2instrc=SyncNdmEnd()
XCode = ndm2instrc
end
else
do
call dmobdel ndm2obj
call 'MessageBox' Title, 'The NvDM/2 CDM Install Request for' RxCAdd.Stitle 'was unsuccesful - RC:' RC
XCode = -1
end
call DeleteQ
end
when RxCAdd.OpType = 'REMOVE'
then do
call DeleteQ
call CreateQ
call dmobput ndm2obj rxcadd.stitle
say 'Invoking NvDM/2...'
'@net run cmd /c "'cdmremcomm ndm2obj '/WS:'wsid '/DA:A' '"'
if rc=0 then
do
call 'MessageBox' Title, 'The NvDM/2 CDM Remove Request for' RxCAdd.Stitle 'was succesfully started.',
'NvDM/2 is removing 'RxCAdd.Stitle 'on your machine, please wait...'
say 'Please wait...'
ndm2instrc=SyncNdmEnd()
XCode = ndm2instrc
end
else
do
call 'MessageBox' Title, 'The NDM/2 CDM Remove Request for' RxCAdd.Stitle 'was unsuccesful - RC:' RC
XCode = -1
end
call DeleteQ
end
otherwise do
call 'MessageBox' Title, 'Unexpected operation type "'RxCAdd.OpType'"'
XCode = 201
end
end
DetachRemoteDrive(CDr)
call AddExit XCode
GetNvDM2Path:
Nvdmpath = ''
Nvdmpath = SysSearchPath( 'DPATH', 'syslevel.ndm')
if Nvdmpath = '' then do
say ' Error : NvDM/2 is not installed on this workstation'
XXC = 991
signal DebugExit
end
drive = FILESPEC("drive", Nvdmpath)
path = FILESPEC("path", Nvdmpath)
Nvdmpath = drive||path
return Nvdmpath
/* end GetNvDM2Path */
DetachRemoteDrive:
parse arg drive .
remote = RxCouInfo("GET","REMOTE")
drive = LEFT(drive,2)
remote = LEFT(remote,2)
if drive <> remote then do
'@GIME 'drive' /D'
end
return
/* end DetachRemoteDrive */
GetRemoteDrive:
drive = ''
parse var rxcadd.proginfo.5 'PARAMS=' NDargs
parse var rxcadd.proginfo.5 . 'NDM2Server=' servername
remote = RxCouInfo("GET","REMOTE")
remote = LEFT(remote,1)
ServFile = remote||':\LOCAL\COMPLEX\SERVERS.COR'
Temp = NameFind(ServFile ':NICK 'servername' :ID')
if abbrev(Temp, '$RXERROR') | abbrev(Temp, 'ERROR:') then do
say ' Error : Reading SERVERS.COR for NvDM/2 server 'servername
XXC = 991
signal DebugExit
end
else
do
parse var Temp ':ID.' id
id = LEFT(id,LENGTH(id)-1)
'@gime \\'||servername||'\'||id||' |pipe'
parse upper pull output
do queued()
parse upper pull .
end
parse var output first rest
if first = 'Error' then do
say ' Error : Unable to connect to NvDM/2 server 'servername
XXC = 991
signal DebugExit
end
drive = RIGHT(rest,2)
end
return drive
/* end GetRemoteDrive */
getwsid:
name = ''
if stream(nvdm2ini,'c','query exists') <> '' then do
'@type 'nvdm2ini '|find "'clientkey'" |pipe'
if rc=0 then do
do queued()
parse upper pull . clientkey '=' pname .
if pname <> ' ' then name = pname
end
do queued()
pull
end
if name <> '' then
return name
end
'@type 'nvdm2ini '|find "'serverkey'" |pipe'
if rc=0 then do
do queued()
parse upper pull . serverkey '=' pname .
if pname <> ' ' then name = pname
end
do queued()
pull
end
return name
end
end
say ' Error : Unable to get the NvDM/2 workstation name'
XXC = 991
signal DebugExit
/* end getwsid*/
getndmname:
parse var rxcadd.proginfo.5 'PARAMS=' NDargs
parse var NDargs NDArgsLeft 'NDM2Name=' ndm2objname 'NDM2Server=' servername NDArgsRight
rxcadd.proginfo.5 = 'PARAMS='NDargsLeft||NDArgsRight
return ndm2objname
/* end getndmname */
startndmagent:
status=''; pstatus=''
'@cdm status | pipe'
do queued()
parse upper pull . 'THE CDM AGENT STATUS IS' pstatus .
if pstatus <> '' then status=pstatus
end
if status = 'INACTIVE.' then
do
/* call directory 'c:' */
'@cdm start'
end
call directory CDr
return
SyncNdmEnd: procedure
rqname="IBMCOUDM2"
qname=rxqueue("Set",rqname)
/*call SysSleep 4 */
do while queued()=0
/* call SysSleep 3 */
end
pull ndm2rc
return ndm2rc
/* end SyncNdmEnd */
CreateQ: procedure
rqname="IBMCOUDM2"
qname=rxqueue("Create",rqname)
if rqname <> qname then
do
say "Error unable to create queue:" rqname
say "rqname=" rqname
say "qname=" qname
return 1111
end
return 0
/* end CreateQ */
DeleteQ: procedure
rqname="IBMCOUDM2"
call rxqueue "Delete",rqname
return 0
/* end DeleteQ */
RunItl: procedure expose RXCADD.
parse arg ItlName
CDr = RxCouInfo('GET', 'REMOTE')
CDr = strip(CDr, 'T', '\')||'\'
List = 'VERSION STITLE OPTYPE PREVIOUS'
do I = 1 to words(List)
Name = 'RXCADD.'word(List, I)
call value Name, value(Name), 'OS2ENVIRONMENT'
end I
do I = 1 to RXCADD.PROGINFO.0
call value 'RXCADD.PROGINFO.'I, RXCADD.PROGINFO.I, 'OS2ENVIRONMENT'
end I
if pos('\', ItlName) = 0
then do
parse source . . Me
ItlName = left(Me, lastpos('\', Me))||ItlName
end
'@CALL' CDr'IMPIT.CMD /R:'ItlName '/NOPAUSE'
return rc
AddExit:
parse arg XCode, Msg
if XCode = ''
then XCode = 0
if Msg <> ''
then call 'MessageBox' Title, Msg
call 'CAddComplete' XCode
call 'CAddExit'
exit XCode
/***********************************************************************
* ERROR TRAPS *
***********************************************************************/
BugInit:
signal off error; signal off failure; signal off halt
signal off novalue; signal off notready; signal off syntax
parse upper source . . Me
if symbol('TITLE') = 'LIT'
then Title = 'COREADD Failure'
Me = Me':'||'0A'x
if symbol('GLOBALS') = 'LIT'
then do
Globals = 'TrVal'
TrVal = 'O'
end
return
Halt:
Where = SigL
call BugInit
call 'MessageBox' Title, Me||'Execution halted by user in line' Where
XXC = 204
signal DebugExit
Syntax:
Where = SigL
call BugInit
call 'MessageBox' Title,,
Me||'Syntax error' rc '('errortext(rc)') in line' Where'.'
XXC = 203
signal DebugExit
Novalue:
Where = SigL
call BugInit
call 'MessageBox' Title, Me||'NOVALUE error ('condition('D')') in line' Where'.'
XXC = 203
signal DebugExit
DebugExit:
call 'CAddComplete' XXC
call 'CAddExit'
exit XXC
Error:
errormsg='Error' rc 'in line' sigl':' sourceline(sigl)
say errormsg
XXC = 999
signal DebugExit