//**REXX**/
/*.................................................................
Analyse output from RACF LISTUSER (LU) command and save
the results in ISPF variables.
To use in your EXEC....
call TCSLU userid
then "ISPEXEC VGET (variables)"
where variables are....
ruser Userid
rname User name
rowner Owning group
rcrdate Create date
rdefgrp Default group
rpdate Password date
rpint Password interval
rattr1 Attributes
rattr2 Attributes
rrevdate Revoke date
rresdate Resume date
rlastacc Last access
rclasaut Class authorisations
rmodnme Model name
rinstdta Installation data
TSO TSO segment (Yes or No)
racctnum TSO account number
rhclass TSO hold class
rjclass TSO job class
rmclass TSO MSGCLASS
rproc TSO procedure
rsize TSO size
rmsize TSO maxsize
rsclass TSO storage class
runit TSO unitname
rudata TSO userdata
groups a concatenation of group information
.................................................................*/
parse upper arg ruserid
/*trace i*/
x= Outtrap("lu.",'*',"noconcat") /* Trap the output */
/* Issue the lu command */
ADDRESS "TSO" "LU "ruserid" TSO"
max_num= (lu.0 + 1) /* Max number of lines */
x= 1 /* Starting position */
racfline= '' /* init */
Do While Substr(lu.x,2,10) ^= '----------'
racfline= racfline||' '||lu.x /* build the concatenation*/
x= x + 1 /* next entry */
End
/*.................................................................*/
/* Parse The Header Information */
/*.................................................................*/
ruser= '' /* init */
rname= '' /* init */
rowner= '' /* init */
rcrdate= '' /* init */
rdefgrp= '' /* init */
rpdate= '' /* init */
rpint= '' /* init */
rattr1= '' /* init */
rattr2= '' /* init */
rrevdate= '' /* init */
rresdate= '' /* init */
rlastacc= '' /* init */
rclasaut= '' /* init */
Parse Value racfline with 'USER=' ruser,
'NAME=' rname,
'OWNER=' rowner,
'CREATED=' rcrdate,
'DEFAULT-GROUP=' rdefgrp,
'PASSDATE=' rpdate,
'PASS-INTERVAL=' rpint,
'ATTRIBUTES=' rattr1,
'ATTRIBUTES=' rattr2,
'REVOKE DATE=' rrevdate,
'RESUME DATE=' rresdate,
'LAST-ACCESS=' rlastacc,
'CLASS AUTHORIZATIONS=' rclasaut .
If (rattr2 = '') Then
Parse Value racfline with 'USER=' ruser,
'NAME=' rname,
'OWNER=' rowner,
'CREATED=' rcrdate,
'DEFAULT-GROUP=' rdefgrp,
'PASSDATE=' rpdate,
'PASS-INTERVAL=' rpint,
'ATTRIBUTES=' rattr1,
'REVOKE DATE=' rrevdate,
'RESUME DATE=' rresdate,
'LAST-ACCESS=' rlastacc,
'CLASS AUTHORIZATIONS=' rclasaut .
rattr1= Strip(rattr1,T,' ') /* remove leading blanks */
If (Substr(rlastacc,1,3) = 'UNK') Then Do /* UNKNOWN? */
rlastdte= Substr(rlastacc,1,7) /* last access date */
rlasttme= 'UNKNOWN' /* last access time */
End
Else Do
rlastdte= Substr(rlastacc,1,6) /* last access date */
rlasttme= Substr(rlastacc,8,8) /* last access time */
End
rattr= rattr1||' '||rattr2 /* Attributes */
rmodnme= '' /* Init */
rinstdta= '' /* Init */
rclasaut= '' /* Init */
Parse Value racfline with 'MODEL-NAME=' rmodnme .
Parse Value racfline with 'INSTALLATION-DATA=' rinstdta .
If (rmodnme = '' & rinstdta = '' ) Then
Parse Value racfline with 'CLASS AUTHORIZATIONS=' rclasaut,
'NO-INSTALLATION-DATA' rinstdta,
'NO-MODEL-NAME' .
Else
If (rmodnme ^= '' & rinstdta ^= '' ) Then
Parse Value racfline with 'CLASS AUTHORIZATIONS=' rclasaut,
'INSTALLATION-DATA=' rinstdta,
'MODEL-NAME=' rmodnme .
Else
If (rmodnme = '') Then
Parse Value racfline with 'CLASS AUTHORIZATIONS=' rclasaut,
'INSTALLATION-DATA=' rinstdta,
'NO-MODEL-NAME' .
Else
Parse Value racfline with 'CLASS AUTHORIZATIONS=' rclasaut,
'NO-INSTALLATION-DATA' rinstdta,
'MODEL-NAME=' rmodnme .
If (rinstdta= '') Then /* Installation Data? */
rinstdta= 'NONE' /* No- */
If (rclasaut= '') Then /* Class authorities? */
rclasaut= 'NONE' /* No- */
If (rmodnme= '') Then /* Model Name? */
rmodnme= 'NONE' /* No- */
x= 1 /* Starting position */
Do While Substr(lu.x,2,7) ^= ' GROUP=' /* obtain starting pos */
x= x + 1 /* next entry */
End
tso_start= x /* store for a while */
y= 0 /* Init */
Do While Substr(lu.x,1,15) ^= 'SECURITY-LEVEL='
If Substr(lu.x,3,6) = 'GROUP=' Then Do /* Group Entry? */
y= (y + 1) /* Next entry */
racfline.y= lu.x /* build the concatenation*/
x= (x + 1) /* Next entry */
End
Else Do
racfline.y= racfline.y||' '||lu.x /* Build the concatenation*/
x= (x + 1) /* Next entry */
End
End
/*.................................................................*/
/* Parse The Group Information ``` */
/*.................................................................*/
Group_count= y /* group count */
groups = ""
Do i = 1 to y /* get the group info */
Parse Value racfline.i with 'GROUP=' group.i,
'AUTH=' auth.i,
'CONNECT-OWNER=' connown.i,
'CONNECT-DATE=' conndte.i,
'CONNECTS=' connects.i,
'UACC=' uacc.i,
'LAST-CONNECT=' lastconn.i,
'CONNECT ATTRIBUTES=' connattr.i,
'REVOKE DATE=' revdate.i,
'RESUME DATE=' resdate.i .
z = words(connattr.i) - 1
connattr = word(connattr.i,1)
do z
connattr = connattr||','||word(connattr.i,z+1)
end
groups = groups||group.i||auth.i||connown.i||uacc.i||connattr||' '
End
/*.................................................................*/
/* Parse The TSO Segment */
/*.................................................................*/
racfline= '' /* init */
racctnum= '' /* Init */
rhclass= '' /* Init */
rjclass= '' /* Init */
rmclass= '' /* Init */
rproc= '' /* Init */
rsize= '' /* Init */
rmsize= '' /* Init */
rsclass= '' /* Init */
runit= '' /* Init */
rudata= '' /* Init */
x= tso_start /* init */
Do While (Substr(lu.x,1,15) ^= 'TSO INFORMATION') &,
(Substr(lu.x,1,18) ^= 'NO TSO INFORMATION')
x= x + 1 /* next entry */
End
TSO= 'No' /* No TSO information */
If (Substr(lu.x,1,18) = 'NO TSO INFORMATION') Then
do
TSO= 'No'
end
else
do
TSO= 'Yes' /* TSO information */
racfline= '' /* init */
Do While Substr(lu.x,1,9) ^= 'USERDATA='
racfline= racfline||' '||lu.x /* build the concatenation*/
x= x + 1 /* next entry */
End
racfline= racfline||' '||lu.x /* build the concatenation*/
Keyword= 'ACCTNUM=' /* Keyword To Check */
Call Parse_It Keyword Racfline /* Let's Parse */
racctnum= Parsvar /* Keyword value */
Keyword= 'HOLDCLASS=' /* Keyword To Check */
Call Parse_It Keyword Racfline /* Let's Parse */
rhclass= Parsvar /* Keyword value */
Keyword= 'JOBCLASS=' /* Keyword To Check */
Call Parse_It Keyword Racfline /* Let's Parse */
rjclass= Parsvar /* Keyword value */
Keyword= 'MSGCLASS=' /* Keyword To Check */
Call Parse_It Keyword Racfline /* Let's Parse */
rmclass= Parsvar /* Keyword value */
Keyword= 'PROC=' /* Keyword To Check */
Call Parse_It Keyword Racfline /* Let's Parse */
rproc= Parsvar /* Keyword value */
Keyword= 'SIZE=' /* Keyword To Check */
Call Parse_It Keyword Racfline /* Let's Parse */
rsize= Parsvar /* Keyword value */
Keyword= 'MAXSIZE=' /* Keyword To Check */
Call Parse_It Keyword Racfline /* Let's Parse */
rmsize= Parsvar /* Keyword value */
Keyword= 'SYSOUTCLASS=' /* Keyword To Check */
Call Parse_It Keyword Racfline /* Let's Parse */
rsclass= Parsvar /* Keyword value */
Keyword= 'UNIT=' /* Keyword To Check */
Call Parse_It Keyword Racfline /* Let's Parse */
runit= Parsvar /* Keyword value */
Keyword= 'USERDATA=' /* Keyword To Check */
Call Parse_It Keyword Racfline /* Let's Parse */
rudata= Parsvar /* Keyword value */
end
"ispexec vput (
ruser rname rowner rcrdate rdefgrp rpdate rpint rattr1 rattr2
)"
"ispexec vput (
rrevdate rresdate rlastacc rclasaut rmodnme rinstdta rclasaut
)"
/*
"ispexec vput (
group. auth. connown. conndte. connects. uacc. lastconn.
)"
"ispexec vput (
connattr. revdate. resdate.
)"
*/
"ispexec vput (
racctnum rhclass rjclass rmclass TSO groups
)"
"ispexec vput (
rproc rsize rmsize rsclass runit rudata
)"
exit
Parse_It: Procedure Expose Keyword Racfline parsvar therest
parsvar= '' /* init */
Parse Var racfline (Keyword) parsvar therest
Return /* Return To Caller */
Using the REXX
/* rexx */
call tcslu g540pw1
"ispexec vget (
ruser rname rowner rcrdate rdefgrp rpdate rpint rattr1 rattr2
)"
"ispexec vget (
rrevdate rresdate rlastacc rclasaut rmodnme rinstdta
)"
"ispexec vget (
racctnum rhclass rjclass rmclass TSO
)"
"ispexec vget (
rproc rsize rmsize rsclass runit rudata groups
)"
say substr(ruser,1,30) " Userid "
say substr(rname,1,30) " User name "
say substr(rowner,1,30) " Owning group "
say substr(rcrdate,1,30) " Create date "
say substr(rdefgrp,1,30) " Default group "
say substr(rpdate,1,30) " Password date "
say substr(rpint,1,30) " Password interval "
say substr(rattr1,1,30) " Attributes "
say substr(rattr2,1,30) " Attributes "
say substr(rrevdate,1,30) " Revoke date "
say substr(rresdate,1,30) " Resume date "
say substr(rlastacc,1,30) " Last access "
say substr(rclasaut,1,30) " Class authorisations "
say substr(rmodnme,1,30) " Model name "
say substr(rinstdta,1,30) " Installation data "
x = words(groups)
y = x / 5
say groups
say 'number of groups =' y
x = 1
do y
say "Group " word(groups,x)
say "AUTH " word(groups,x+1)
say "OWNER " word(groups,x+2)
say "UACC " word(groups,x+3)
say "ATTR " word(groups,x+4)
x = x + 5
end
if TSO = 'Yes' then
do
say substr(racctnum,1,30) " TSO account number "
say substr(rhclass,1,30) " TSO hold class "
say substr(rjclass,1,30) " TSO job class "
say substr(rmclass,1,30) " TSO MSGCLASS "
say substr(rproc,1,30) " TSO procedure "
say substr(rsize,1,30) " TSO size "
say substr(rmsize,1,30) " TSO maxsize "
say substr(rsclass,1,30) " TSO SYSOUT class "
say substr(runit,1,30) " TSO unitname "
say substr(rudata,1,30) " TSO userdata "
end
0 comments on REXX to parse RACF LU