Skip to content

Commit a470520

Browse files
authored
Add files via upload
1 parent b65feb4 commit a470520

File tree

1 file changed

+200
-0
lines changed

1 file changed

+200
-0
lines changed
Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
/* rexx */
2+
/* */
3+
/* Broadcom has provided this REXX as an example of the */
4+
/* on how to convert RACF cmds from ISRACR SDSF utility */
5+
/* to TSS commands */
6+
/* */
7+
/* SYNTAX: SDSFTSS data_set_name */
8+
/* where "data_set_name" is output of ISFACR utility */
9+
/* */
10+
/* Version 1.0 March 2024 */
11+
/* 1.1 September 2024 */
12+
/* */
13+
/* created by steve hosie March 20 2024 */
14+
/* */
15+
parse arg p1
16+
current_seconds = TIME(S)
17+
last_qual = "D"current_seconds
18+
user = userid()
19+
udsn = user'.ATSS.TEMP.'last_qual
20+
udsn = strip(udsn)
21+
udsn = udsn||'.SDSFCMDS'
22+
x = 1
23+
ddname = "A"current_seconds
24+
sdname = "S"current_seconds
25+
/* for testing, otherwise take input P1 as dataset name */
26+
if length(p1) = 0 then
27+
do
28+
say 'No dataset name provided, please try again'
29+
exit
30+
end
31+
else
32+
sdsf_dsn=p1
33+
/* */
34+
say 'Processing file' sdsf_dsn
35+
if sysdsn("'"sdsf_dsn"'") = ok then
36+
"alloc f("sdname") da('"sdsf_dsn"') shr reu"
37+
if sysdsn("'"udsn"'") = OK then
38+
"alloc f("ddname") da('"udsn"') shr reu"
39+
else
40+
"alloc f("ddname") da('"udsn"') NEW SP(25 15)
41+
TR DSORG(PS) RECFM(F B) LRECL(80) BLKSIZE(3120)"
42+
"execio * diskr "sdname" (stem sdsf_racf. FINIS"
43+
total_racf_records = sdsf_racf.0
44+
sdsf_out.1 = '/* */'
45+
sdsf_out.2 = '/* REVIEW AND EDIT BEFORE EXECUTING */'
46+
sdsf_out.3 = '/* */'
47+
sdsf_out.4 = 'TSS ADD(owndept)SDSF(ISF)'
48+
sdsf_out.5 = 'TSS ADD(owndept)JESSPOOL(sysid.)'
49+
sdsf_out.6 = 'TSS ADD(owndept)OPERCMDS(MVS.)'
50+
sdsf_out.7 = 'TSS ADD(owndept)OPERCMDS(JES2.)'
51+
sdsf_out.8 = 'TSS ADD(owndept)WRITER(JES2.)'
52+
sdsf_out.9 = 'TSS ADD(owndept)XFACILIT(HZS.)'
53+
y = 9
54+
data_string = "DATA("
55+
owner_string = "OWNER("
56+
g_cnt = 1
57+
do until x > total_racf_records
58+
/* load all GSDSF records into Stem variable */
59+
If ralter = "RALTER" then do
60+
if substr(sdsf_racf.x,9,5) = 'GSDSF' then
61+
do
62+
ralter_class = substr(sdsf_racf.x,9,5)
63+
ralter_attr = substr(sdsf_racf.x,15,10)
64+
res_name = substr(sdsf_racf.x,26,44)
65+
attr.g_cnt = ralter_attr' 'res_name
66+
g_cnt = g_cnt + 1
67+
end
68+
x = x + 1
69+
end
70+
end
71+
x = 1
72+
do until x > total_racf_records
73+
addgroup = substr(sdsf_racf.x,2,8)
74+
ralter = substr(sdsf_racf.x,2,6)
75+
permit = substr(sdsf_racf.x,2,6)
76+
pos_data = POS('DATA(',sdsf_racf.x)
77+
If addgroup = "ADDGROUP" then
78+
do
79+
pos_owner = INDEX(sdsf_racf.x,' OWNER(')
80+
length_xrole = pos_owner - 12
81+
sdsf_xrole = substr(sdsf_racf.x,12,length_xrole)
82+
pos_data = INDEX(sdsf_racf.x,' DATA(')
83+
pos_data_start = pos_data + 7
84+
pos_data_last = index(sdsf_racf.x,"')")
85+
pos_data_last = pos_data_last - pos_data_start
86+
sdsf_desc = SUBSTR(sdsf_racf.x,pos_data_start,pos_data_last)
87+
sdsf_out.y = 'TSS CRE('sdsf_xrole')TYPE(PROFILE)DEPT(owndept)'
88+
sdsf_out.y = sdsf_out.y"NAME('"sdsf_desc"')"
89+
if length(sdsf_out.y) > 71 then
90+
do
91+
sdsf_out.y = 'TSS CRE('sdsf_xrole')TYPE(PROFILE)DEPT(owndept) -'
92+
y = y + 1
93+
sdsf_out.y = "NAME('"sdsf_desc"')"
94+
end
95+
y = y + 1
96+
end
97+
If permit = "PERMIT" then
98+
do
99+
if substr(sdsf_racf.x,19,5) = 'CLASS' then
100+
do
101+
attr_role = substr(sdsf_racf.x,35,8)
102+
attr_role = STRIP(attr_role,,')')
103+
last_pos_attr = lastpos(attr_role,')')
104+
attr_cmd = substr(sdsf_racf.x,9,9)
105+
access_pos = POS('ACCESS(',sdsf_racf.x)
106+
access_pos = access_pos + 7
107+
attr_access = substr(sdsf_racf.x,access_pos,15)
108+
access_last_pos = LASTPOS(')',sdsf_racf.x)
109+
if access_last_pos > 0 then
110+
do
111+
access_last_pos = access_last_pos - access_pos
112+
attr_access = substr(attr_access,1,access_last_pos)
113+
if attr_access = 'ALTER' then
114+
attr_access = 'ALL'
115+
end
116+
do
117+
/* process permits for GSDSF items direct to roles */
118+
attr_cnt = 1
119+
do until attr_cnt > g_cnt
120+
If attr_cmd = substr(attr.attr_cnt,1,9) then
121+
do
122+
resname = STRIP(substr(attr.attr_cnt,18,44))
123+
resname = STRIP(resname,,')')
124+
resname = STRIP(resname,,'(')
125+
/* create sdsf_TSS_commands */
126+
sdsf_out.y = 'TSS PER('attr_role')SDSF('resname')'
127+
sdsf_out.y = sdsf_out.y'ACCESS('attr_access')'
128+
if length(sdsf_out.y) > 71 then
129+
do
130+
sdsf_out.y = 'TSS PER('attr_role')SDSF('resname') -'
131+
y = y + 1
132+
sdsf_out.y = 'ACCESS('attr_access')'
133+
end
134+
y = y + 1
135+
end
136+
attr_cnt = attr_cnt + 1
137+
end
138+
end
139+
end
140+
else
141+
/* handle all other permits */
142+
do
143+
class_pos = POS(' CLASS',sdsf_racf.x)
144+
last_resname_char = class_pos - 9
145+
resource_name = substr(sdsf_racf.x,9,last_resname_char)
146+
class_pos = class_pos + 7
147+
res_pos = POS('.',resource_name)
148+
res_start = res_pos + 1
149+
res_neg = res_pos - 1
150+
res_length = length(resource_name)
151+
res_length = res_length - res_pos
152+
res_key = substr(resource_name,1,res_neg)
153+
resname = substr(resource_name,res_start,res_length)
154+
id_pos = POS(' ID(',sdsf_racf.x)
155+
id_pos_neg = id_pos - class_pos - 1
156+
class = substr(sdsf_racf.x,class_pos,id_pos_neg)
157+
access_pos = POS(') ACCESS(',sdsf_racf.x)
158+
id_pos = POS(') ID(',sdsf_racf.x)
159+
id_pos = id_pos + 5
160+
id_pos_last = access_pos - id_pos
161+
role = substr(sdsf_racf.x,id_pos,id_pos_last)
162+
access_pos = access_pos + 9
163+
access_pos_last = LASTPOS(')',sdsf_racf.x) - access_pos
164+
access = substr(sdsf_racf.x,access_pos,access_pos_last)
165+
if access = 'ALTER' then
166+
access = 'ALL'
167+
if class = 'JESSPOOL' then
168+
do
169+
end
170+
sdsf_out.y = 'TSS PER('role')'class'('resource_name')'
171+
sdsf_out.y = sdsf_out.y'ACCESS('access')'
172+
if length(sdsf_out.y) > 71 then
173+
do
174+
sdsf_out.y = 'TSS PER('role')'class'('resource_name') -'
175+
y = y + 1
176+
sdsf_out.y = 'ACCESS('access')'
177+
end
178+
y = y + 1
179+
end
180+
end
181+
x = x + 1
182+
end
183+
"execio * diskw "ddname" (stem sdsf_out. FINIS"
184+
say 'Processing Completed - Press Enter'
185+
STATUS = MSG('ON')
186+
STATUS = MSG('OFF')
187+
TIM = TIME()
188+
DAT = DATE()
189+
STATUS = MSG('ON')
190+
STATUS = MSG('OFF')
191+
/* call esmtype */
192+
"ISPEXEC EDIT DATASET('"udsn"')"
193+
address tso "free f("sdname")"
194+
address tso "free f("ddname")"
195+
return
196+
/* address tso "DELETE '"udsn"'" */
197+
exit
198+
/* */ 01810004
199+
/* END OF CODE */ 01820004
200+
/* */ 01830004

0 commit comments

Comments
 (0)