Clearing Joined Structures

Topics:

How to:

You can clear specific join structures, or all existing structures. Clearing deactivates the designated joins. If you clear a conditional join, all joins issued subsequently to that join using the same host file are also cleared.

Tip: If you wish to list the current joins before clearing or see details about all active joined structures, issue the query command ? JOIN. For details and illustrations, see List Joined Structures.

Syntax: How to Clear a Join

To clear a joined structure, issue this command:

JOIN CLEAR {joinname|*}

where:

joinname
Is the AS name of the joined structure you want to clear.
*
Clears all joined structures.

Clearing a Conditional Join

You can clear a join by issuing the JOIN CLEAR command. The effect of the JOIN CLEAR command depends on whether any conditional join exists.

  • If conditional joins are found and were issued after the join you wish to clear, or if the join you wish to clear is a conditional join, then the JOIN CLEAR as_name command removes all joins issued after the specified join.
  • If no conditional joins were issued after the join you wish to clear, only the join you specify is cleared. Any virtual fields saved in the context of a join that is cleared are also cleared. Normal joins may or may not be cleared, depending on the position of the conditional join. The JOIN CLEAR * command clears every join issued, along with its associated virtual fields. However, all virtual fields in the null context remain untouched.

Note: The null context is the context of the data source prior to any joins being issued.

Example: Clearing Joins

The following request creates three joins using VIDEOTRK as the host data source. The first two are conditional (JW1, JW2), and the third join is unconditional (J1):

JOIN FILE VIDEOTRK AT PRODCODE TO ALL
     FILE GGSALES  AT PCD AS JW1
WHERE PRODCODE NE PCD;
END
JOIN  FILE VIDEOTRK AT TRANSDATE TO ALL
      FILE MOVIES   AT RELDATE   AS JW2
WHERE (TRANSDATE - RELDATE)/365 GT 10;
END
JOIN MOVIECODE IN VIDEOTRK TO MOVIECODE IN MOVIES AS J1

The next request creates a conditional join (JW3) using MOVIES as the host data source:

JOIN  FILE MOVIES   AT MOVIECODE TO ONE
      FILE VIDEOTRK AT TRANSDATE AS JW3
WHERE (TRANSDATE - RELDATE)/365 LT 2;
END

The last request creates a third conditional join (JW4) that uses VIDEOTRK as the host data source:

JOIN  FILE VIDEOTRK AT LASTNAME  TO ALL
      FILE EMPLOYEE AT LAST_NAME AS JW4
WHERE LASTNAME GE LAST_NAME;
END

Following is the output of the ? JOIN query after executing these joins:

? JOIN
 JOINS CURRENTLY ACTIVE
 
HOST                           CROSSREFERENCE
FIELD       FILE     TAG    FIELD       FILE      TAG   AS      ALL  WH
-----       ----     ---    -----       ----      ---   --      ---  --
PRODCODE    VIDEOTRK        PCD         GGSALES         JW1      Y    Y
TRANSDATE   VIDEOTRK        RELDATE     MOVIES          JW2      Y    Y
MOVIECODE   VIDEOTRK        MOVIECODE   MOVIES          J1       N    N
MOVIECODE   MOVIES          TRANSDATE   VIDEOTRK        JW3      N    Y
LASTNAME    VIDEOTRK        LAST_NAME   EMPLOYEE        JW4      Y    Y

Clearing JW2 clears all joins that were issued after JW2 and that use the same host data source. JW1 remains because it was issued prior to JW2, and JW3 remains because it uses a different host data source:

JOIN CLEAR JW2
? JOIN
 JOINS CURRENTLY ACTIVE
 
HOST                           CROSSREFERENCE
FIELD        FILE     TAG   FIELD        FILE     TAG      AS   ALL WH
-----        ----     ---   -----        ----     ---      --   --- --
PRODCODE     VIDEOTRK       PCD          GGSALES           JW1   Y   Y
MOVIECODE    MOVIES         TRANSDATE    VIDEOTRK          JW3   N   Y

WebFOCUS

Feedback