Selecting a Specific Instance by Defining a Current Instance

How to:

This section describes how to move through the database by defining a particular instance as the current instance. The current instance is always the top instance on the screen. Certain commands only operate on the current instance.


Top of page

x
Procedure: How to Define a Current Instance

To define an instance as the current instance, type a slash (/) in the prefix area corresponding to the instance.

You may also type a slash before or after the following prefix area commands:



Example: Defining a Current Instance: The "/" Prefix

For example, suppose you type a slash in the prefix area of John Banning's instance, as shown below:

FSCAN FILE EMPLOYEEFOCUS A1            CHANGES :0
 
   EMP_ID     LAST_NAME   FIRST_NAME  HIRE_DATE   DEPARTMENT
   ------     ---------   ----------  ----------  ---------
== 071382660  STEVENS     ALFRED      800602      PRODUCTION
== 112847612  SMITH       MARY        810701      MIS
== 117593129  JONES       DIANE       820501      MIS
== 119265415  SMITH       RICHARD     820104      PRODUCTION
/= 119329144  BANNING     JOHN        820801      PRODUCTION
== 123764317  IRVING      JOAN        820104      PRODUCTION
== 126724188  ROMANS      ANTHONY     820701      PRODUCTION
== 219984371  MCCOY       JOHN        810701      MIS
== 326179357  BLACKWOOD   ROSEMARIE   820401      MIS
== 451123478  MCKNIGHT    ROGER       820202      PRODUCTION
----------------------------------INPUT-------------------------------
==
==>
                                                          MORE=>

When you press Enter, the following screen appears:

FSCAN FILE EMPLOYEEFOCUS A1            CHANGES :0
 
   EMP_ID     LAST_NAME   FIRST_NAME  HIRE_DATE   DEPARTMENT
   ------     ---------   ----------  ---------   ----------
== 119329144  BANNING     JOHN        820801      PRODUCTION
== 123764317  IRVING      JOAN        820104      PRODUCTION
== 126724188  ROMANS      ANTHONY     820701      PRODUCTION
== 219984371  MCCOY       JOHN        810701      MIS
== 326179357  BLACKWOOD   ROSEMARIE   820401      MIS
== 451123478  MCKNIGHT    ROGER       820202      PRODUCTION
== 543729165  GREENSPAN   MARY        820401      MIS
== 818692173  CROSS       BARBARA     811102      MIS
-----------------------------------INPUT-------------------------------
==
==>
                                                            MORE=


x
Syntax: How to Define the First and Last Instances of a Segment on Display: The FIRST, LAST, and TOP Commands

FSCAN displays all instances in a segment that share a common parent instance. For the root segment, this means all the instances in the segment. To define the first instance in the group as the current instance, enter:

FIrst

If you are displaying instances in the root segment, FIRST will make the first instance in the database the current instance. If you are displaying instances in a child segment and use the FIRST command, the first child instance will become the current instance.

To define the last instance as the current instance, enter:

LAst

To select the first instance in the root segment of the database to be the current instance, enter:

Top

TOP displays the root segment, scrolled to the leftmost panel, with the first instance the current instance.



Example: Defining the Last Instance as the Current Instance With LAST

For example, if you enter LAST on the EMPLOYEE root segment display, the following screen appears:

FSCAN FILE EMPLOYEEFOCUS A1            CHANGES :0
 
   EMP_ID    LAST_NAME  FIRST_NAME  HIRE_DATE  DEPARTMENT
   ------    ---------  ----------  ---------  ----------
== 818692173 CROSS      BARBARA     811102     MIS
 
 
 
 
 
 
 
--------------------------------INPUT----------------------------------
==
==>
 
                                                           MORE=>


x
Syntax: How to Locate an Instance Based on Field Values: The LOCATE Command

LOCATE searches for instances containing field values that fulfill certain conditions. For example, it can search for an instance with a LAST_NAME value of BANNING or a CURR_SAL value less than 20,000. LOCATE searches starting with the current instance.

The syntax is (entered on one line)

LOcate field1 rel1 value1 [OR value1a OR value1b OR ...]
 
[{AND|,} field2 rel2 value2 {AND|,} ...]

where:

fieldn ...

Is a field to be tested.

reln ...

Is one of the following condition relations:

EQ or =

Equal to

NE 

Not equal to

GE

Greater than or equal to

GT

Greater than

LE

Less than or equal to

LT

Less than

CONTAINS or CO

Contains the character string

OMITS or OM

Omits the character string

valuen ...

Is a value for which FSCAN can test. The first instance with a field value that passes the test becomes the current segment.

If you supply more than one test condition in the command, FSCAN searches for the instance that fulfills all of the conditions. Separate the test conditions in the command with the word AND or with a comma (,).

OR

Enables you to test a field for multiple values. If the field contains one of the values, it meets the test. You can use AND and OR in a single LOCATE command.

The LOCATE command searches starting with the first instance following the current instance. If LOCATE cannot find the instance, it displays a message and the current instance does not change.



Example: Locating an Instance Based on Field Values

For example, suppose the first instance in the EMPLOYEE root segment is the current instance. If you issue the command

LOCATE LAST_NAME EQ SMITH

the following screen appears:

FSCAN FILE EMPLOYEEFOCUS A1        CHANGES :0
 
   EMP_ID      LAST_NAME      FIRST_NAME     HIRE_DATE      DEPARTMENT
   ------      ---------      ----------     ---------       ----------
== 112847612   SMITH          MARY           810701         MIS
== 117593129   JONES          DIANE          820501         MIS
== 119265415   SMITH          RICHARD        820104         PRODUCTION
== 119329144   BANNING        JOHN           820801         PRODUCTION
== 123764317   IRVING         JOAN           820104         PRODUCTION
== 126724188   ROMANS         ANTHONY        820701         PRODUCTION
== 219984371   MCCOY          JOHN           810701         MIS
== 326179357   BLACKWOOD      ROSEMARIE      820401         MIS
== 451123478   MCKNIGHT       ROGER          820202         PRODUCTION
== 543729165   GREENSPAN      MARY           820401         MIS
-------------------------------INPUT-----------------------------------
==
==>
                                                           MORE=>

These are other examples of the LOCATE command:

LOCATE JOBCODE EQ A07 OR A17

This LOCATE searches for the first segment instance that has a JOBCODE value of either A07 or A17.

LOCATE LAST_NAME CO WOOD

This LOCATE searches for the first segment instance with a LAST_NAME value that contains the character string WOOD.

LOCATE HIRE_DATE GT 820401 AND JOBCODE IS B02 OR B03

This LOCATE searches for the first segment instance with both a HIRE_DATE value greater than 820401 and a JOBCODE value that is either B02 or B03.



x
Syntax: How to Find an Instance in a Group: The FIND Command

The FIND command works within the group of instances being displayed. In the root segment, this is all instances in the segment; in descendant segments, this is all instances sharing a common parent instance. FIND searches for instances containing field values that fulfill certain conditions. For example, it can search for an instance with a LAST_NAME value of BANNING or a CURR_SAL value less than 20,000. FIND searches starting with the current instance.

The syntax is entered on one line.

FIND field1 rel1 value1 [OR value1a OR value1b OR ...]
[{AND|,} field2 rel2 value2 {AND|,} ...]
[{AND|,} field2 rel2 value2 {AND|,} ...]

where:

fieldn ...

Is a field in the segment.

reln ...

Is one of the following condition relations:

EQ 
or
=

Equal to

NE 

Not equal to

GE

Greater than or equal to

GT

Greater than

LE

Less than or equal to

LT

Less than

CONTAINS 
or
CO

Contains the character string

OMITS 
or
OM

Omits the character string

valuen ...

Is a value for which FSCAN can test. The first instance with a field value that passes the test becomes the current segment.

If you supply more than one test condition in the command, FSCAN searches for the instance that fulfills all of the conditions. Separate the test conditions in the command with the word AND or with a comma (,).

OR

Enables you to test a field for multiple values. If the field contains one of the values, it meets the test. You can use AND and OR in a single FIND command.

The FIND command searches the group starting with the first instance following the current instance. To search the entire group, issue the FIRST command before issuing FIND. If FIND cannot find the instance, it displays a message and the current instance does not change.



Example: Finding an Instance in a Group

For example, suppose the first instance in the EMPLOYEE root segment is the current instance. If you issue the command

FIND LAST_NAME EQ SMITH

the following screen appears:

FSCAN FILE EMPLOYEEFOCUS A1            CHANGES :0
 
    EMP_ID     LAST_NAME     FIRST_NAME  HIRE_DATE  DEPARTMENT
    ------     ---------     ----------  ---------  ----------
==  112847612  SMITH         MARY        810701     MIS
==  117593129  JONES         DIANE       820501     MIS
==  119265415  SMITH         RICHARD     820104     PRODUCTION
==  119329144  BANNING       JOHN        820801     PRODUCTION
==  123764317  IRVING        JOAN        820104     PRODUCTION
==  126724188  ROMANS        ANTHONY     820701     PRODUCTION
==  219984371  MCCOY         JOHN        810701     MIS
==  326179357  BLACKWOOD     ROSEMARIE   820401     MIS
==  451123478  MCKNIGHT      ROGER       820202     PRODUCTION
==  543729165  GREENSPAN     MARY        820401     MIS
----------------------------------INPUT--------------------------------
==
==>
 
                                                      MORE=>

These are other examples of the FIND command:

FIND DEPARTMENT EQ MIS OR SALES

This FIND searches for the first segment instance that has a DEPARTMENT value of either MIS or SALES.

FIND LAST_NAME CO WOOD

This FIND searches for the first segment instance with a LAST_NAME value that contains the character string WOOD.

FIND HIRE_DATE GT 820401 AND DEPARTMENT EQ MIS OR PRODUCTION

This FIND searches for the first segment instance with both a HIRE_DATE value greater than 820401 and a DEPARTMENT value that is either MIS or PRODUCTION.


Information Builders