/* REXX */ /********************************************************************* Licensed Materials - Property of IBM 5694-A01 Copyright IBM Corp. 2010 Name: XRACSEQ - RACSEQ in REXX Author: Mike Onghena Dec 2009 Purpose: This program replicates the functionality of the RACSEQ program written and published by Bruce Wells in 2006. The intent is to demonstrate the IRRXUTIL interface by re-implimenting the RACSEQ program using REXX. RACSEQ displays a USER or GROUP profile on the screen in an easily parsable form. To be honest, this defeats the purpose as RACSEQ was originally written to be a simpler way of getting RACF data into REXX progams, but it is useful as an exercise. The program demonstrates how the REXX variables generated by IRRXUTIL can be used to figure out which segments and fields exist for the returned profile. It also demonstrates how to process repeating fields such that the relationship between the fields within the repeat group are maintained. Input: RACF Class and profile name Example: ex 'pds(XRACSEQ)' 'class profile' Where: 'class' is either USER or GROUP 'profile' is the profile to display Authorization required: You must have the authority to use the R_ADMIN extract callable service (See RACF Callable services guide for more information) You must also be allowed to view the profiles being extracted. Notes: No parameter validation is attempted in this example. *********************************************************************/ /* Read parameters to get class and profile name. We only dump a single profile. */ arg class profile junk /* Call IRRXUTIL to extract the desired profile */ myrc=IRRXUTIL("EXTRACT",class,profile,"RACF","") /* Check return code and exit if problem is discovered */ if (word(myrc,1)<>0) then do say "Error calling IRRXUTIL: "myrc exit 8 end /* Print header */ say "Displaying profile "RACF.PROFILE" in class "class". Segments: "||, right(RACF.0,2,"0") /* Run through all segments */ do k=1 to RACF.0 segname=RACF.k /* Get next segment name */ say "Segment: "left(segname,8)||" Fields:"||, right(RACF.segname.0,2,"0") /* Run through the fields in this segment */ do l=1 to RACF.segname.0 fieldName=RACF.segname.l /* Get next field name */ /* If repeat header, handle the repeat group. */ /* This is the tricky part, to keep the repeat group together */ if (RACF.segname.fieldname.repeatcount>0) then do /* Get dimension (number of fields in a group) and cardinality (number of groups) */ dimension=RACF.segname.fieldname.subfield.0 repeats=RACF.segname.fieldname.repeatcount say " Repeat field:"||left(fieldname,8)||" Subfields:"||, right(dimension,2,"0")||, " Occurrences:"right(repeats,4,"0") /* For each repeat group */ do rpt=1 to repeats /* Run through each of the fields */ do dim=1 to dimension /* Get repeat group field name */ subfld=RACF.segname.fieldname.SUBFIELD.dim /* Get repeat group value */ say " "||left(subfld,8)":"||RACF.segname.subfld.rpt end /* dim */ say " ---------------------------------------------" end /* repeats */ end /* repeat header */ else if (RACF.segname.fieldname.REPEATING="TRUE") then do /* Skip repeating fields because they were already handled */ /* in the logic above when the repeatheader was processed */ end else do /* not repeating */ /* Display value for this field */ say " "left(fieldname,8)":"RACF.segname.fieldname.1 end /* not repeating */ end /* fields */ end /* segments */