SCA$MENU.HLB  —  SCA Topics, EXPAND
    The EXPAND function determines the symbol to which an occurrence
    belongs and returns the full set of occurrences for the symbol.

    For example, the following code fragments, written in a pseudo
    language, declare and use the variable i in three files.

      file 1          file 2          file 3
      ------          ------          ------

      GLOBAL i (d)    LOCAL i (d)     EXTERNAL i (d)

      i := 0 (wr)     i := 5 (wr)     IF i EQUALS 0 (rr)

      (d)  - declaration
      (wr) - write reference
      (rr) - read reference

    The pseudo language defines variables, such that the variable i
    in "file 1" and the variable i in "file 3" are the same variable.
    The variable i in "file 2", however, is a different variable. SCA
    treats these variables in the same manner by saying there are two
    unique symbols which happen to have the same name.

    The important point in the previous example is that what the
    programmer considers unique items SCA also considers unique items.
    In SCA terms, these items are symbols.

    Given the previous code fragments, consider the follwoing query:

      FIND SYMBOL_CLASS=VARIABLE AND OCCURRENCE=READ

    This query returns one occurrence, which is the read reference in
    "file 3." Now consider the next query:

      FIND EXPAND( symbol_class=variable and occurrence=read )

    This query returns two occurrences of "i" in "file 1" and the two
    occurrences of "i" in "file 3." The EXPAND function uses the read
    reference to determine the corresponding symbol and then returns
    all the occurrences for that symbol. In this case the symbol was
    the global variable "i".

    Note that the two occurrences in "file 2" are not returned because
    they belong to a different symbol. The programmer does not view
    the i in "file 2" to be the same as the i in "file 1" and "file 3"
    and SCA reflects that view.

    When given more than one occurrence, the EXPAND function performs
    this operation iteratively and removes any duplicate occurrences
    from the result.

    In the following example, you use the EXPAND function to find the
    declarations of routines defined in the system, but which are not
    used. To do this, specify the following query:

      FIND (SYMBOL=ROUTINE AND OCCURRENCE=PRIMARY) AND NOT
      EXPAND(SYMBOL=ROUTINE AND OCCURRENCE=REFERENCE)
Close Help