2012年3月13日 星期二

Converts ACF2 UID(LID) based Rules to LID based ROLES


RULE2ROLE

/* REXX EXEC */
/* Converts ACF2 Rulesets to Rolesets
- All Rule Lines must be written to the LID

- To execute:
1) Change the LIDPARMS variables:
- LIDSTART = Starting Position of LID in UID String
- LIDLENGTH = Length of LID
*/
lidstart = 17
lidlength = 8
/*
1) Change the Dataset Names:
- IN_DATASET = Unloaded Rules
- OUT_DATASET = Converted Roles
*/
in_dataset = 'KLERO03.ACF2.RULES.SEQ'
out_dataset = 'KLERO03.ACF2.ROLES.SEQ'
/*

Revision History:

Date Changes
-------- ------------------------------------------------
20100705 B.Kleamovich - Initial Release
*** End of Revision History
*/
trace o
/* */
/*Mainline - Start */
call define_vars
call read_file
call process_file
call write_file
say "Output has" j "lines"
Exit 0
/*Mainline - End */
/* */
define_vars:
Out. = ' '
i = 0
j = 0
k = 0
l = 0
x = 0
y = 0
ts = '----+----0'
tt = ts||ts||ts||ts||ts
sp = ' '
sp = sp||sp||sp||sp
sp = substr(sp,1,46)
return
/* */
read_file:
"ALLOC F(INPUT) DA('"||in_dataset||"') SHR REUSE"
"EXECIO * DISKR INPUT (STEM DATA. FINIS"
"FREE F(INPUT)"
return
/* */
process_file:
Do i=1 to Data.0
if pos('$KEY(',strip(data.i,both)) > 0 then
do
j = j + 1
out.j = strip(data.i,both)|| ' ROLESET '
iterate
end
if pos('UID(*)',strip(data.i,both)) > 1 then
do
parse var data.i what who other
role = 'LID(*)'
j = j + 1
out.j = ' ' what role other
iterate
end
if pos('UID(',strip(data.i,both)) > 1 then
do
parse var data.i what who other
who = strip(who,both)
spos = lidstart + 4
epos = lidlength
lid = substr(who,spos,epos)
/* say ' ' tt
say ' WHO: ' who
say 'SPOS: ' spos
say 'EPOS: ' epos
say ' LID: ' lid
say */
if pos(')',lid) > 1 then
do
k = pos(')',lid)
lid = strip(substr(lid,1,k - 1),both)
end
if pos('*',lid) > 1 then
do
k = pos('*',lid)
lid = strip(substr(lid,1,k - 1),both)
end
role = 'LID('||lid||')'
j = j + 1
out.j = ' ' what role other
iterate
end
j = j + 1
out.j = data.i
end
return
/* */
write_file:
"ALLOC F(OUTPUT) DA('"||out_dataset||"') OLD REUSE"
"EXECIO "j" DISKW OUTPUT (STEM OUT. FINIS"
"FREE F(OUTPUT)"
return
/*

沒有留言:

張貼留言