There are many times when you need to determine where in the hierarchy a member is used. The more complicated the project, the more difficult this can be. Where a member is used can be retrieved either from the WhereUsed function of the SCLM Library Utility (option 10.3.1) or through the GETXDEP service.
How to Set up for WhereUsed
Define a cross-dependency VSAM database in the SCLM project definition.
Update the project definition to include XDEP keywords. Add the XDEP and XDEPDYN keywords to the FLMCNTRL macro, like this:
If you will only be using the XDEP function to resolve a particular problem, you can use XDEPDYN=N, since you won't need to update the database dynamically. If you want the database to be updated whenever a change is made to the hierarchy, set XDPEDYN=Y.
Assemble and link the project definition.
Next, create the XDEP data set. Modify the sample JCL for allocating and initializing the cross-dependency data set, found in member FLM02XDP of the ISPF samples data set, ISP.SISPSAMP.
Populate the XDEP database
You now need to run the XDEPUPDT service to populate the XDEP database. You can use JCL to submit the service in batch, or you can execute the service in foreground. The XDEPUPDT service can be time-consuming, so for large projects, batch is your best option. Sample JCL for the XDEPUPDT service is in member FLM02XDU of the ISPF samples data set. To run the service in foreground, you can create a simple rexx exec or you can go to the SCLM Command Shell (option 10.6) and enter this command:
where grp is either a group name or an asterisk (*) for all groups. In most cases, you will use * for the group name.
If you set XDEPDYN=N, you will need to run the XDEPUPDT command every time you need to refresh the data set. One possibility would be to set an XDEPUPDT job to run every night. If you set XDEPDYN=Y, the data is refreshed dynamically.
Finding Where a Member is Used
Once the cross-dependency data set contains the information from the hierarchy, you can find out which members include another member.
SCLM Library Utility W Command
Use the W (WhereUsed) line command in the SCLM Library Utility (option 10.3.1). For example, if you select member FLM01EQU with the W command, the resulting display shows that member FLM01EQU is used in the following members:
Symbols appearing to the left of the member name indicate the following:
+ The row can be expanded to show nested rows.
- The nested rows can be collapsed.
* The object has a circular reference and will not be expanded.
< The nesting level was exceeded. The row will not be expanded.
blank The row has no parents and will not be expanded.
The keywords are taken from the build map. They might be SINC, PROM, I*, PINCL*, INCL, DYNI*, or INCLD. The SINC keyword indicates that the Include List in the parent object's account record has an entry for the child object.
Use the X line command to expand any of the members with a + in front of the member name. Expanding each member level yields a complete list of all of the members, groups, and types that include the requested member. To expand all members, use the SHOW ALL X primary command.
To collapse all members, use the SHOW ALL primary command.
If you prefer to get the information through a program or command procedure, you can use the GETXDEP service. The GETXDEP service returns the cross dependency information in an ISPF table. There are dozens of variables that you can choose from. See the SCLM Guide and Reference for a complete list.
Here is an example of how to use the GETXDEP service in a REXX exec.
/* REXX */ /* Use the SCLM GETXDEP service to determine who uses */ /* member FLM01EQU */ trace off /* update the following lines to set the parameters */ /* project, alternate, group, type */ /* name of the member to search for */ /* table library */ /* panel library */ srcapp = 'shelly2,shelly2,dev1,source' srcmem = 'FLM01EQU' tablib = "'shelly2.private.tables'" panlib = "'shelly2.private.panels'" /* update the preceding lines to set the parameters */ tabname = 'DEPTABL ' address 'ISPEXEC' "LIBDEF ISPTABL DATASET ID("tablib")" NAMEL = 'ZSFCNAME ZSFCTYPE ZSFCGRP ZSFPNAME ZSFPTYPE ZSFPGRP' "TBCREATE "TABNAME" NAMES("NAMEL") NOWRITE" if rc = 0 then do address "TSO", "FLMCMD GETXDEP,"srcapp","srcmem","tabname",next " if rc = 0 then do zcmd = "" "LIBDEF ISPPLIB DATASET ID("panlib")" "TBTOP " tabname cont = 'yes' Do Until cont = 'no' "TBDISPL " tabname "panel(gdeppan)" display_rc = rc if display_rc > 4 then cont = 'no' end "LIBDEF ISPPLIB " end else /* getxdep failed */ do say 'getxdep rc =' rc end end else /* tbcreate failed */ say 'tbcreate or tbopen rc = 'rc "TBCLOSE " TABNAME "LIBDEF ISPTABL "
In this example, the following variables are returned for each member:
ZSFCNAME - Child object - name
ZSFCTYPE - Child object - type
ZSFCGRP - Child object -group
ZSFPNAME - Parent object - name
ZSFPTYPE - Parent object - account type
ZSFPGRP - Parent object - account group
In order for the GETXDEP service to return these values, the first thing this rexx exec does it to make sure that there is a table that contains these variables. The table is created using the TBCREATE service. The exec then uses the GETXDEP service to populate the table with the cross dependency information. In this case, the exec used the "next" parameter to just get the immediate parents. Then the exec displays this information using the TBDISPL service.
The panel, GDEPPAN, is a simple table display panel, defined like this:
)ATTR DEFAULT(%+_) @ TYPE(OUTPUT) INTENS(LOW) CAPS(ON) JUST(LEFT) ! TYPE(OUTPUT) INTENS(HIGH) CAPS(ON) JUST(LEFT) )BODY EXPAND(||) +--|-|- Where Used Member: !srcmem +--|-|- + %OPTION ===>_ZCMD | |+SCROLL ===>_AMT + +Press the%END+key to exit. + %Child Child Child Parent Parent Parent+ %Name Type Group Name Type Group + %-------- -------- -------- -------- -------- --------+ )MODEL @ZSFCNAME+@ZSFCTYPE+@ZSFCGRP +@ZSFPNAME+@ZSFPTYPE+@ZSFPGRP + )INIT .CURSOR = ZCMD &AMT = 'PAGE' )END
The resulting display looks like this:
This shows that there are 6 source members and 2 archdef members that are immediate parents of FLM01EQU.
You can use the output from the GETXDEP service in a variety of ways. For example, if a member has been deleted, you can write a dialog to loop through the table and rebuild every archdef that has the dependency remaining in a build map.
Finding Where a Member is Used
There are several steps you have to take to set up the WhereUsed function in SCLM. Once the setup is complete, the WhereUsed function can quickly and accurately determine where a member is used. Whether a programmer needs to find dependency information to update a feature, or whether the library administrator needs a tool to clean up the hierarchy, the WhereUsed function provides the information.