VMS Help  —  SCA  SCA Topics, Getting Started, Using Pascal
    This section contains some basic examples that illustrate what
    SCA can do to help you with your programs. The examples have very
    little explanation. If you want a more detailed explanation of the
    underlying concepts, see the Basic_Query_Concepts help topic. The
    remainder of this section is written in terms that are specific to
    Pascal programs.

    If you want to follow along and try the examples, you will need to
    have an SCA library available. The SCA$EXAMPLE library provided
    with SCA is based on Pascal, so you could use it. If you want
    to use your own library, but do not know how to create an SCA
    library, read the Building_An_SCA_Library help topic. The examples
    in this section use variables from the SCA$EXAMPLE library. If you
    use your own library, you will have to substitute variable names
    that actually exist in your code when trying the examples.

    The first example is the easiest query: It lets you find all the
    items in your SCA library named i, and shows you all the places
    where they appear (all occurrences of i).

    FIND i

    You can search for any name in this manner, including using
    wildcard characters (for example, FIND i*).

    Now let's say you are looking for an occurrence, and you know
    that it occurs in a particular file. The following query finds all
    occurrences of items that are named i but will then limit them to
    those which happen to occur in the file named 'BUILDTABLE.PAS'.

    FIND i AND FILE_SPEC="BUILDTABLE.PAS"

    Another typical question one might ask is "Find all the places
    where this item is assigned to (or read from, called, declared,
    and so forth)." The next example finds all occurrences of items
    that are named c, but then limits them to only those occurrences
    where c is assigned a value.

    FIND c AND OCCURRENCE=WRITE

    (SCA understands many occurrence classes other then WRITE. See the
    help subtopics under Getting_Started for tables containing all the
    SCA attributes and their corresponding meanings in Pascal.)

    Often, you only want to know where (in what file or module) a
    particular procedure is, so that you can go to it and edit it. You
    could use a query similar to the first (where i would be replaced
    by the name of the procedure) and then look through the output.
    The output would include all occurrences of the procedure, one
    of which would be its declaration, which you could then select.
    Or, you could ask SCA to limit the search for you by typing the
    following query:

    FIND build_table AND OCCURRENCE=PRIMARY

    In SCA terms, a primary declaration is the most significant
    declaration of an item. For a Pascal procedure, this means the
    place where the procedure is actually implemented. This is in
    contrast to FORWARD or EXTERNAL declarations, which are associated
    declarations.

    Another problem you might have is that there are many different
    items in your system having a given name. Some may be variables;
    others may be functions, constants, labels, and so forth. Suppose
    you want to find only the procedures named 'build_table'. Again,
    the query FIND build_table would give you what you wanted, but
    it would also give you much more. It is preferable to issue the
    following query:

    FIND build_table AND SYMBOL_CLASS=PROCEDURE

    The last four examples have all selected information based on
    two attributes. The last example selected information based on a
    name attribute (in this case, 'build_table') and a symbol class
    attribute (in this case, PROCEDURE). Note how the attributes
    are combined using the boolean operator AND. In general, you
    can select items out of your library based on any combination
    of attributes, using AND as well as the other logical operators
    OR, XOR and NOT.

    The next example shows another primary feature of SCA - the
    ability to display relationships between items. The example
    given here shows the most common use of this feature. It finds
    the complete call tree (that is, all procedures called directly
    and indirectly), of the procedure named 'build_table'.

    FIND CALLED_BY (build_table, DEPTH=ALL)

    If you want to limit the depth of the call tree, you can replace
    the keyword ALL by any positive integer.

    The final part of this section describes how to go directly to the
    source code once you have issued a query. After issuing the query
    FIND c, for example, you can have an LSE query buffer containing
    something that looks like the following:

      C variable
          EXPAND_STRING\60     VAR (variable) declaration
          EXPAND_STRING\75     write reference
          EXPAND_STRING\79     read reference
          EXPAND_STRING\95     read reference
          EXPAND_STRING\122    read reference
          EXPAND_STRING\144    write reference
          EXPAND_STRING\146    read reference
          EXPAND_STRING\149    write reference
          EXPAND_STRING\149    read reference
          EXPAND_STRING\150    read reference
          EXPAND_STRING\166    read reference

    The first two lines of this display will be highlighted. The first
    line represents the item you looked for (c), and the rest of the
    lines represent the different places in the code where this item
    occurred (that is, the occurrences of c). By using the up and down
    arrows on your keyboard, or by clicking on an occurrence with your
    mouse, you can choose the occurrence you want to see. Then all
    you have to do is type CTRL/G (the keyboard equivalent of the GOTO
    SOURCE command), and LSE will bring the source file into a buffer
    and position you at the occurrence you chose.

    To obtain help on the following topics, request help as indicated.

    o  For help on query language, see the Basic_Query_Concepts help
       topic.

    o  For help on libraries, see the Building_An_SCA_Library help
       topic.
Close Help