Here is the buildsessions.the macro.
Shimon
/* */
/* THE macro to build ICC session configuration.
input: <BuildSessions>.txt
output: <Buildsessions>.cfg
The name <BuildSessions> can be any file name.
<Input file> := <setup options>
<Server definition>
<sessions definition>
<setup options> := <option start> <option statement>... <option end>
<option start> := <OPTIONS>
<option statement> := A REXX statement to be interpreted and performed
<option end> := </OPTIONS>
<Server definition> := copied text from exported config.
<sessions definition> := <config start> <input line>... <config end>
<config start> := "<CONFIG_SESSION>"
<config end> := "</CONFIG_SESSION>"
<input line> := <LU-def> <MIF-def>
<LU-def> := LU=name_of_LU
<MIF-def> := MIF=n
Session numbers are consecutive from SESSION1 for the first defined session.
Device addresses are consecutive within MIF. That is, first session
defined with MIF=1 will be the starting device address (defaults to B000),
second for MIF=1 will be the next address (B001),
and first in MIF=2 will again be the starting address (default B000).
To set the starting address of an LPAR, use this option line:
'devaddr.5 = 16' which means "Set the first device in MIF=5 to 16,
X'010', resulting in (after appending to 'B') an address of 'B010'."
*/
/* if this macro is not in THE's macro path, use:
SET MACROPATH <path>[;<path>...]
e.g. SET MACROPATH D:\pub\DOCS\z890
(to paste the SET MACROPATH line into the THE session
from the Windows clipboard, position the THE cursor
on the edit command line, and right-click.)
usage: open the input file with THE, at the command line type:
buildsessions
the macro will close the THE session after creating the output file.
*/
TRACE N
parse source . . nameofthismacro
'extract /fpath/fname/filename' /* get info about input file */
output = fpath.1 || fname.1 || ".cfg" /* same path, same fn, new ext
*/
input = fpath.1 || filename.1 /* save full name of input file
*/
'x' output /* switch to <new?> output file
*/
'bot' /* follow any existing data */
'input // This file has been generated by the THE macro' nameofthismacro
'save' /* save with ID comment */
'x' input /* switch to input file */
'top' /* check for run options */
'locate /<OPTIONS>/' /* start of options info -
reqd! */
'locate +1' /* first opt line? */
optcount = 0
DO WHILE RC = 0
'extract /curline/' /* current option line */
if curline.3 = '</OPTIONS>' /* end of section */
then RC = 999 /* exit loop */
else do /* save the option statement */
optcount = optcount + 1
optlist.optcount = curline.3
'locate +1'
end
end /* DO WHILE */
'top' /* find and copy entire
serverdef */
'locate /<OSC_SERVER>/ set point .s'
'locate $</OSC_SERVER>$ +1 set point .e'
'locate .s put .e' /* put to temp file */
'x' output /* switch to output and get it
*/
'get'
'bot' /* move cursor past server def
*/
'x' input
'locate .s set point .s OFF' /* remove .points in input file
*/
'locate .e set point .e OFF'
'locate -1' /* back to end of server defs */
devaddr. = 0 /* starting value for all devaddrs */
sessnum = 1 /* starting value for session number */
do opt_I = 1 to optcount
optline = optlist.opt_I
interpret optline
end /* do opt_I */
/* begin main loop - read and copy all non "LU" lines. */
/* - convert "LU" lines to full session definition */
/* each loop iteration begins with focus on *input* file */
'locate +1' /* for RC=0 of loop */
DO WHILE RC = 0
'extract /curline/' /* current *input* line */
SELECT
when left(curline.3,1) = '*'
then NOP /* allow commenting of input lines */
when left(curline.3,3) = "LU="
then call createLU /* go create a session in the output file */
otherwise do
'x' output /* just copy this line into the output file
*/
'input' curline.3
'x' input /* and return to input for next iteration */
end
END /* of SELECT */
'locate +1' /* advance till EOF gives non-zero RC */
END
'x' output /* all output has been created.... */
'ffile' /* ... so save it */
'x' input /* finished reading input... */
'qquit' /* ... so quit with no changes */
exit /* no more file sessions, THE ends */
/* */
createLU:
parse var curline.3 'LU=' luid . 'MIF=' mifid .
'x' output /* switch to output to build session def */
'input <SESSION' || sessnum || '>' /* build session header */
mifdev = d2x(devaddr.mifid, 3) /* 3-digit hex addr for x'B...' */
/* CSS= 00 IID= 01 DEVICE= B000 */
luline = " CSS= 00 IID= " || right(mifid,2,'0') || " DEVICE= B" || mifdev
'input' luline /* build next session line, with correct dev
*/
/* GROUP= "GBYP-OP0" */
luline = ' GROUP= "' || luid || '"'
'input' luline /* build next session line, with LUname */
/* CONSOLE_TYPE= 1 RESPONSE= ON */
luline = " CONSOLE_TYPE= 1 RESPONSE= ON"
'input' luline /* more preset values */
/* READ_TIMEOUT= 10 */
luline = " READ_TIMEOUT= 10"
'input' luline /* last preset values */
'input </SESSION' || sessnum || '>'
'input ' /* session trailer tag */
sessnum = sessnum + 1 /* increment global session number */
devaddr.mifid = devaddr.mifid + 1 /* increment device for this mif */
'x' input /* return to input file for next iteration */
return
--
************************************************************************
Shimon Lebowitz mailto:[EMAIL PROTECTED]
VM System Programmer .
Israel Police National HQ.
Jerusalem, Israel phone: +972 2 542-9877 fax: 542-9308
************************************************************************