/* RACFEXPG - Export RACF GROUP settings */ /* Runs on the source system */ /* output - REXX exec (RACFIMPG EXEC A) to be run on target system */ CMDFILE='RACFIMPG EXEC A' /* erase the output file if it exists */ ADDRESS COMMAND 'ESTATE 'CMDFILE If RC = 0 then 'Erase 'CMDFILE CMDCTR=1 CMDLST.CMDCTR='/* RACFIMPG - Run on the target z/VM System */' CMDCTR=CMDCTR+1 CMDLST.CMDCTR='/* */' 'pipe', 'command EXEC RAC LG *', '| locate W1 /INFORMATION/', '| specs ws space W4 1', '| stem GROUPS.' Do G = 1 to GROUPS.0 /* ignore system supplied groups or any unnecessary groups */ Select When GROUPS.G = 'GADM' then NOP When GROUPS.G = 'GBIN' then NOP When GROUPS.G = 'GNOBODY' then NOP When GROUPS.G = 'GSYS' then NOP When GROUPS.G = 'MAIL' then NOP When GROUPS.G = 'SECURITY' then NOP When GROUPS.G = 'STAFF' then NOP When GROUPS.G = 'SYSCTLG' then NOP When GROUPS.G = 'SYSTEM' then NOP When GROUPS.G = 'SYS1' then NOP When GROUPS.G = 'VSAMDSET' then NOP Otherwise Say 'Processing Group: ' GROUPS.G /* add a separator between groups */ CMDCTR=CMDCTR+1 CMDLST.CMDCTR='/* */' CMDCTR=CMDCTR+1 CMDLST.CMDCTR='/* Group: 'GROUPS.G' */' CMDCTR=CMDCTR+1 CMDLST.CMDCTR='/* */' DATA.1 = ' ' /* extract the superior group and owner */ 'pipe', 'command EXEC RAC LG 'GROUPS.G, '| locate word 1 /SUPERIOR/', '| split', '| specs wordsep = words 2-4 1 ', '| stem PARMS.' /* extract the installation data if any */ 'pipe', 'command EXEC RAC LG 'GROUPS.G, '| locate word 1 /INSTALLATION/', '| specs wordsep = words 2-* 1', '| stem DATA.' /* Some groups have a DATA field. Some do not. Each case needs */ /* to be handled differently. */ /* Group has a DATA field. */ If DATA.1 <> ' ' then Do /* RACF AG (ADDGROUP) command that is built becomes quite long. */ /* Add comma and create a multi line command. */ AGCMD=, "RAC AG "GROUPS.G" DATA('"DATA.1"')" CMDCTR=CMDCTR+1 CMDLST.CMDCTR='"'AGCMD'"' CMDLST.CMDCTR=CMDLST.CMDCTR||',' AGCMD=, "OWNER("PARMS.3") SUPGROUP("PARMS.2")" CMDCTR=CMDCTR+1 CMDLST.CMDCTR='"'AGCMD'"' End Else /* Group does not have a data field. */ Do /* RACF AG (ADDGROUP) command that is built becomes quite long. */ /* Add comma and create a multi line command. */ AGCMD=, "RAC AG "GROUPS.G" OWNER("parms.3")" CMDCTR=CMDCTR+1 CMDLST.CMDCTR='"'AGCMD'"' CMDLST.CMDCTR=CMDLST.CMDCTR||',' AGCMD=, "SUPGROUP("parms.2")" CMDCTR=CMDCTR+1 CMDLST.CMDCTR='"'AGCMD'"' End End End /* write the RACF commands to the output file */ CMDLST.0=CMDCTR 'pipe stem CMDLST. | >> 'CMDFILE Say 'File 'CMDFILE' has been created' Exit