ECHO OFF
PUSHD %BICSUITEHOME%\..
SET HOMEDIR=%CD%
CD %BICSUITEHOME%

MKDIR %HOMEDIR%\tmp 2>NUL
MKDIR %HOMEDIR%\taskfiles 2>NUL

HOSTNAME > HOSTNAME.TXT
SET /P HOSTNAME= < HOSTNAME.TXT
DEL HOSTNAME.TXT

echo begin multicommand > tmp.sdms
echo. >> tmp.sdms
echo create or alter scope GLOBAL.'EXAMPLES' >> tmp.sdms
echo with >> tmp.sdms
echo 	   group = 'PUBLIC', >> tmp.sdms
echo    config = ( >> tmp.sdms
echo 		'REPOHOST' = '%HOSTNAME%', >> tmp.sdms
echo 		'REPOPORT' = '2506', >> tmp.sdms
echo 		'BOOTTIME' = 'NONE', >> tmp.sdms
echo 		'USEPATH' = 'true', >> tmp.sdms
echo 		'JOBEXECUTOR' = '%BICSUITEHOME%\bin\jobserver', >> tmp.sdms
echo 		'DEFAULTWORKDIR' = '%HOMEDIR%\tmp', >> tmp.sdms
echo 		'VERBOSELOGS' = 'true', >> tmp.sdms
echo 		'NAME_PATTERN_LOGFILES' = '.*\\.log' >> tmp.sdms
echo 	); >> tmp.sdms
echo. >> tmp.sdms
echo create or alter named resource RESOURCE.'EXAMPLES' >> tmp.sdms
echo with >> tmp.sdms
echo 	group = 'PUBLIC', >> tmp.sdms
echo 	usage = CATEGORY; >> tmp.sdms
echo. >> tmp.sdms
echo create or alter named resource RESOURCE.'EXAMPLES'.'STATIC' >> tmp.sdms
echo with >> tmp.sdms
echo 	group = 'PUBLIC', >> tmp.sdms
echo 	usage = CATEGORY; >> tmp.sdms
echo. >> tmp.sdms
echo create or alter named resource RESOURCE.'EXAMPLES'.'STATIC'.'NODE' >> tmp.sdms
echo with >> tmp.sdms
echo 	group = 'PUBLIC', >> tmp.sdms
echo 	usage = CATEGORY; >> tmp.sdms
echo. >> tmp.sdms
echo create or alter named resource RESOURCE.'EXAMPLES'.'STATIC'.'USER' >> tmp.sdms
echo with >> tmp.sdms
echo 	group = 'PUBLIC', >> tmp.sdms
echo 	usage = CATEGORY; >> tmp.sdms
echo. >> tmp.sdms
echo create or alter named resource RESOURCE.'EXAMPLES'.'STATIC'.'USER'.'SERVER' >> tmp.sdms
echo with >> tmp.sdms
echo 	group = 'PUBLIC', >> tmp.sdms
echo 	usage = STATIC; >> tmp.sdms
echo. >> tmp.sdms
echo create or alter scope GLOBAL.'EXAMPLES'.'LOCALHOST' >> tmp.sdms
echo with >> tmp.sdms
echo 	group = 'PUBLIC', >> tmp.sdms
echo 	config = ( >> tmp.sdms
echo 		'HTTPHOST' = '%HOSTNAME%' >> tmp.sdms
echo 	), >> tmp.sdms
echo 	parameter = ( >> tmp.sdms
echo 		'E0015_SCOPE_PARAMETER' = 'SCOPE_PARAMETER_VALUE' >> tmp.sdms
echo 	); >> tmp.sdms
echo. >> tmp.sdms
echo create or alter named resource RESOURCE.'EXAMPLES'.'STATIC'.'NODE'.'LOCALHOST' >> tmp.sdms
echo with >> tmp.sdms
echo 	group = 'PUBLIC', >> tmp.sdms
echo 	usage = STATIC; >> tmp.sdms
echo. >> tmp.sdms
echo create or alter resource RESOURCE.'EXAMPLES'.'STATIC'.'NODE'.'LOCALHOST' in GLOBAL.'EXAMPLES'.'LOCALHOST' >> tmp.sdms
echo with >> tmp.sdms
echo 	group = 'PUBLIC', >> tmp.sdms
echo 	online; >> tmp.sdms
echo. >> tmp.sdms
echo create or alter job server GLOBAL.'EXAMPLES'.'LOCALHOST'.'SERVER' >> tmp.sdms
echo with >> tmp.sdms
echo 	group = 'PUBLIC', >> tmp.sdms
echo 	rawpassword = 'cf1e8c14 e54505f6 0aa10ceb 8d5d8ab3', >> tmp.sdms
echo 	node = '%HOSTNAME%', >> tmp.sdms
echo 	config = ( >> tmp.sdms
echo 		'JOBFILEPREFIX' = '%HOMEDIR%\taskfiles\localhost-', >> tmp.sdms
echo 		'NOTIFYPORT' = '45500', >> tmp.sdms
echo 		'HTTPPORT' = '8900' >> tmp.sdms
echo 	); >> tmp.sdms
echo. >> tmp.sdms
echo create or alter resource RESOURCE.'EXAMPLES'.'STATIC'.'USER'.'SERVER' in GLOBAL.'EXAMPLES'.'LOCALHOST'.'SERVER' >> tmp.sdms
echo with >> tmp.sdms
echo 	group = 'PUBLIC', >> tmp.sdms
echo 	online; >> tmp.sdms
echo. >> tmp.sdms
echo create or alter scope GLOBAL.'EXAMPLES'.'HOST_1' >> tmp.sdms
echo with >> tmp.sdms
echo 	group = 'PUBLIC', >> tmp.sdms
echo 	config = ( >> tmp.sdms
echo 		'HTTPHOST' = '%HOSTNAME%' >> tmp.sdms
echo 	); >> tmp.sdms
echo. >> tmp.sdms
echo create or alter named resource RESOURCE.'EXAMPLES'.'STATIC'.'NODE'.'HOST_1' >> tmp.sdms
echo with >> tmp.sdms
echo 	group = 'PUBLIC', >> tmp.sdms
echo 	usage = STATIC; >> tmp.sdms
echo. >> tmp.sdms
echo create or alter resource RESOURCE.'EXAMPLES'.'STATIC'.'NODE'.'HOST_1' in GLOBAL.'EXAMPLES'.'HOST_1' >> tmp.sdms
echo with >> tmp.sdms
echo 	group = 'PUBLIC', >> tmp.sdms
echo 	online; >> tmp.sdms
echo. >> tmp.sdms
echo create or alter job server GLOBAL.'EXAMPLES'.'HOST_1'.'SERVER' >> tmp.sdms
echo with >> tmp.sdms
echo 	group = 'PUBLIC', >> tmp.sdms
echo 	rawpassword = 'cf1e8c14 e54505f6 0aa10ceb 8d5d8ab3', >> tmp.sdms
echo 	node = '%HOSTNAME%', >> tmp.sdms
echo 	config = ( >> tmp.sdms
echo 		'JOBFILEPREFIX' = '%HOMEDIR%\taskfiles\host_1-', >> tmp.sdms
echo 		'NOTIFYPORT' = '45501', >> tmp.sdms
echo 		'HTTPPORT' = '8901' >> tmp.sdms
echo 	); >> tmp.sdms
echo. >> tmp.sdms
echo create or alter resource RESOURCE.'EXAMPLES'.'STATIC'.'USER'.'SERVER' in GLOBAL.'EXAMPLES'.'HOST_1'.'SERVER' >> tmp.sdms
echo with >> tmp.sdms
echo 	group = 'PUBLIC', >> tmp.sdms
echo 	online; >> tmp.sdms
echo. >> tmp.sdms
echo create or alter scope GLOBAL.'EXAMPLES'.'HOST_2' >> tmp.sdms
echo with >> tmp.sdms
echo 	group = 'PUBLIC', >> tmp.sdms
echo 	config = ( >> tmp.sdms
echo 		'HTTPHOST' = '%HOSTNAME%' >> tmp.sdms
echo 	); >> tmp.sdms
echo. >> tmp.sdms
echo create or alter named resource RESOURCE.'EXAMPLES'.'STATIC'.'NODE'.'HOST_2' >> tmp.sdms
echo with >> tmp.sdms
echo 	group = 'PUBLIC', >> tmp.sdms
echo 	usage = STATIC; >> tmp.sdms
echo. >> tmp.sdms
echo create or alter resource RESOURCE.'EXAMPLES'.'STATIC'.'NODE'.'HOST_2' in GLOBAL.'EXAMPLES'.'HOST_2' >> tmp.sdms
echo with >> tmp.sdms
echo 	group = 'PUBLIC', >> tmp.sdms
echo 	online; >> tmp.sdms
echo. >> tmp.sdms
echo create or alter job server GLOBAL.'EXAMPLES'.'HOST_2'.'SERVER' >> tmp.sdms
echo with >> tmp.sdms
echo 	group = 'PUBLIC', >> tmp.sdms
echo 	rawpassword = 'cf1e8c14 e54505f6 0aa10ceb 8d5d8ab3', >> tmp.sdms
echo 	node = '%HOSTNAME%', >> tmp.sdms
echo 	config = ( >> tmp.sdms
echo 		'JOBFILEPREFIX' = '%HOMEDIR%\taskfiles\host_2-', >> tmp.sdms
echo 		'NOTIFYPORT' = '45502', >> tmp.sdms
echo 		'HTTPPORT' = '8902' >> tmp.sdms
echo 	); >> tmp.sdms
echo. >> tmp.sdms
echo create or alter resource RESOURCE.'EXAMPLES'.'STATIC'.'USER'.'SERVER' in GLOBAL.'EXAMPLES'.'HOST_2'.'SERVER' >> tmp.sdms
echo with >> tmp.sdms
echo 	group = 'PUBLIC', >> tmp.sdms
echo 	online; >> tmp.sdms
echo. >> tmp.sdms
echo create or alter environment 'SERVER@LOCALHOST' >> tmp.sdms
echo with >> tmp.sdms
echo 	resources = ( >> tmp.sdms
echo 		RESOURCE.'EXAMPLES'.'STATIC'.'NODE'.'LOCALHOST', >> tmp.sdms
echo 		RESOURCE.'EXAMPLES'.'STATIC'.'USER'.'SERVER' >> tmp.sdms
echo 	); >> tmp.sdms
echo. >> tmp.sdms
echo grant USE, VIEW >> tmp.sdms
echo on environment 'SERVER@LOCALHOST' >> tmp.sdms
echo to 'PUBLIC'; >> tmp.sdms
echo. >> tmp.sdms
echo create or alter environment 'SERVER@HOST_1' >> tmp.sdms
echo with >> tmp.sdms
echo 	resources = ( >> tmp.sdms
echo 		RESOURCE.'EXAMPLES'.'STATIC'.'NODE'.'HOST_1', >> tmp.sdms
echo 		RESOURCE.'EXAMPLES'.'STATIC'.'USER'.'SERVER' >> tmp.sdms
echo 	); >> tmp.sdms
echo. >> tmp.sdms
echo grant USE, VIEW >> tmp.sdms
echo on environment 'SERVER@HOST_1' >> tmp.sdms
echo to 'PUBLIC'; >> tmp.sdms
echo. >> tmp.sdms
echo create or alter environment 'SERVER@HOST_2' >> tmp.sdms
echo with >> tmp.sdms
echo 	resources = ( >> tmp.sdms
echo 		RESOURCE.'EXAMPLES'.'STATIC'.'NODE'.'HOST_2', >> tmp.sdms
echo 		RESOURCE.'EXAMPLES'.'STATIC'.'USER'.'SERVER' >> tmp.sdms
echo 	); >> tmp.sdms
echo. >> tmp.sdms
echo grant USE, VIEW >> tmp.sdms
echo on environment 'SERVER@HOST_2' >> tmp.sdms
echo to 'PUBLIC'; >> tmp.sdms
echo. >> tmp.sdms
echo end multicommand; >> tmp.sdms

type tmp.sdms | sdmsh %*
del tmp.sdms
POPD
