Subcommand Summary

In this section:

SCAN subcommands can be entered as unique truncations or in full. In the summary below, the capital letters represent the shortest unique truncations.

A list of descriptions of these subcommands, with additional information and examples, begins with AGAIN Command.

Subcommand

Function

Again

Repeat the last subcommand.

BAck

Go back to a previously marked logical record (see MArk, below).

CHAnge

Change a character string.

CRTform

Display a list of fields on a CRTFORM.

DElete

Delete one or more instances of the segment containing the named field (and all descendant segments).

DIsplay

Display the data values for the fields specified.

End

Terminate the SCAN session and write the changes to the database.

File

Terminate the SCAN session and write the changes to the database.

Input

Enter a new record.

Jump

Jump to the next or nth occurrence of field.

Locate

Search for records that match the selection criteria.

MArk

Mark a record so that you can return to it later in the SCAN session.

MOve

Relink the segment to another parent.

Next

Move n records ahead.

Quit

End the session and drop the pending changes.

Replace

Replace a field value in one or more instances.

SAve

Save all pending changes and continue.

SHow

Select a subset of the fields in the database (a logical view—Show List).

TLocate

Go to top of database, then locate record(s) meeting the selection criteria.

TOp

Reset current position at first logical record in the database.

TYpe

Type record(s).

UP

Move current position to parent segment's first descendant.

X

Used for command substitution.

Y

Same as X above.

?

Print the previous subcommand.

AGAIN Command

How to:

Reference:

The AGAIN command tells the system to repeat the previous valid command.

This is particularly useful after LOCATE, as it continues the search for the next instance of the target value.

Syntax: How to Use the AGAIN Command

Again

Example: Using the AGAIN Command

show emp_id last_name salary dpt
locate dpt=mis
 EID=112847612 LN=SMITH  DPT=MIS   SAL= 13200.00
again
 EID=117593129 LN=JONES  DPT=MIS   SAL= 18480.00

LOCATE retrieves the first record following the current position that matches the test condition. AGAIN repeats the process, as if the LOCATE statement had been retyped, and the next record that meets the test condition is displayed.

The fields displayed above are those named in the previous SHOW subcommand. The DPT (Department) field is available in the Show List because it resides in the same segment as the EMP_ID and LAST_NAME fields.

Reference: Commands Similar to Again

Within SCAN, entering a question mark (?) causes a display of the last subcommand to be executed. If you wish to execute it again, reenter the command or use AGAIN.

BACK Command

How to:

Reference:

The BACK subcommand works in conjunction with the previous MARK subcommand (only one MARK is in effect at a time). When BACK is issued, control returns to the previous marked record (see MARK subcommand).

Syntax: How to Use the BACK Command

BAck

Example: Using the BACK Command

show emp_id last_name first_name salary
next
 EID=071382660 LN=STEVENS FN=ALFRED  SAL= 11000.00
jump emp_id 2
 EID=117593129 LN=JONES   FN=DIANE   SAL= 18480.00
mark
next 2
 EID=119265415 LN=SMITH   FN=RICHARD SAL= 9500.00
back
 EID=117593129 LN=JONES   FN=DIANE   SAL= 18480.00

Reference: Commands Similar to BACK

None.

CHANGE Command

How to:

CHANGE is used to replace specified alphanumeric character strings with new strings in data fields. Changes may be made sequentially to every record in the database, or to all records that match a LOCATE criteria.

Note: CHANGE cannot be used on numeric fields with formats I, P, F, and D.

Syntax: How to Use the CHANGE Command

CHAnge field=/oldstring/newstring/,$ [*|n]

A period (.), colon (:), or slash (/) may be used as the string delimiter and must be the first character after the equal sign (=). The same character must then be used to terminate the old and new strings.

The replication factor n (where n is number of strings to be replaced) has a default value of 1. When more than one string is to be changed, indicate the replication factor as a single digit following the line terminator characters ,$. To replace all instances of the string in the remainder of the database, use the asterisk (*). To replace all instances of the string in the database, issue TOP before the CHANGE. This resets the current position at the first logical record.

Using the CHANGE Command

Reference:

This section will show how to use the CHANGE command.

Example: Single-Field Change With the CHANGE Command

To change a single field, first locate it then make the change.

 
show emp_id last_name first_name
tlocate ln=stevens 
 EID=071382660 LN=STEVENS  FN=ALFRED 
change ln=/stevens/stephens/,$
 EID=071382660 LN=STEPHENS FN=ALFRED

Example: Sequential Changes With the CHANGE Command

To change all occurrences of the old string to the new string throughout the database starting at the current position, use the replication factor, *.

 
show last_name department salary
locate dpt=mis 
 LN=SMITH     DPT=MIS  SAL= 13200.00
change dpt=/mis/mis dept/,$ *
 LN=SMITH     DPT=MIS DEPT  SAL= 13200.00
 LN=JONES     DPT=MIS DEPT  SAL= 18480.00
 LN=JONES     DPT=MIS DEPT  SAL= 17750.00
 LN=MCCOY     DPT=MIS DEPT  SAL= 18480.00
 LN=BLACKWOOD DPT=MIS DEPT  SAL= 21780.00
 LN=GREENSPAN DPT=MIS DEPT  SAL= 9000.00
 LN=GREENSPAN DPT=MIS DEPT  SAL= 8650.00
 LN=CROSS     DPT=MIS DEPT  SAL= 27062.00
 LN=CROSS     DPT=MIS DEPT  SAL= 25775.00
 VALUES REPLACED= 6
 EOF:
 

The VALUE REPLACED parameter displayed at the bottom of the report shows how many segment instances were changed, not how many lines SCAN displays after the change.

Example: Match Logic Changes With the CHANGE Command

The current position is reached through a LOCATE (or TLOCATE) subcommand, and the conditions of the LOCATE are retained and applied in selecting records to be changed.

 
tlocate dpt=mis dept, sal lt 15000
 LN=SMITH      DPT=MIS DEPT  SAL=13200.00
change dpt=/mis dept/mis/ ,$ *
 LN=SMITH      DPT=MIS       SAL= 13200.00
 LN=GREENSPAN  DPT=MIS       SAL= 9000.00
 LN=GREENSPAN  DPT=MIS       SAL= 8650.00
 VALUES REPLACED= 2
 EOF:

Here SCAN changes only two segment instances rather than the six instances in the previous example, but three are shown because there are two child segments for the GREENSPAN record.

Note:
  • If CHANGE is immediately preceded by LOCATE or TLOCATE, only the instances that satisfy the LOCATE conditions are changed.
  • If no record selection criteria is included, the CHANGE action will change subsequent instances. Changed field instances may include descendant instances not represented in the Show List.

Reference: Commands Similar to CHANGE

REPLACE is used to replace the entire contents of numeric or alphanumeric fields.

CRTFORM Command

How to:

The CRTFORM subcommand formats the display of selected data fields. Enter the field names separated by blanks. (The selection begins at the current position.) The display aligns two fields per line where possible.

Use the TYPE subcommand to display the results of a CRTFORM subcommand.

Syntax: How to Use the CRTFORM Command

CRTform *  {*|fieldname [*]...fieldname}

You can enter the full field names, aliases, or the shortest unique truncations of either. To display all fields between two named fields, place an asterisk in the list of field names. To simply display all fields, use an asterisk in place of the field names.

Using the CRTFORM Command

Reference:

This section shows how to use the CRTFORM command.

Example: Specifying Individual Fields With CRTFORM

crtform eid ln fn sal
type
 
EMP_ID        =071382660      LAST_NAME    =STEVENS
FIRST_NAME    =ALFRED         SALARY       = 11000.00

Example: Specifying All Fields Between Two Named Fields With CRTFORM

crtform eid * salary
type
 
EMP_ID         =071382660     LAST_NAME    = STEVENS
FIRST_NAME     =ALFRED        HIRE_DATE    = 800602
DEPARTMENT     =PRODUCTION    CURR_SAL     = 11000.00
CURR_JOBCODE   =A07           ED_HRS       = 25.00
BANK_NAME      =              BANK_CODE    =
BANK_ACCT      =              EFFECT_DATE  = 0
DAT_INC        =820101        PCT_INC      = .10
SALARY         =11000.00

Reference: Commands Similar to CRTFORM

None.

DELETE Command

How to:

Reference:

The segment containing the field name is deleted and all of its descendant segments are deleted. Any references to indexed fields are removed from their associated indexes.

Note:
  • If DELETE is immediately preceded by a LOCATE subcommand, then only instances that satisfy the LOCATE conditions are deleted.
  • If no record selection criteria is included, the delete action will remove subsequent instances. Deleted field instances may include descendant segments that are not represented in the Show List.

None of the changes made during a SCAN session take effect until you save them. When you do write them to the database using SAVE or FILE (see descriptions of these subcommands on the following pages), they become permanent; thus you should closely monitor the effect of your changes as you work in SCAN. If you make a mistake, it is important to QUIT immediately to avoid any permanent damage.

Syntax: How to Use the DELETE Command

DElete fieldname [factor]

where:

factor

Is one of the following:

1 is the default value.

* deletes all instances of the field.

n is the number of data instances to be deleted. When more than one instance is to be deleted, indicate the replication factor as a numeric value following the line terminator characters ,$.

Example: Using DELETE

show emp_id last_name salary jobcode
next
 EID=071382660 LN=STEVENS  SAL=  11000.00 JBC=A07
delete jobcode 6
 SEGMENTS DELETED=  6

The next six instances of JOBCODE are removed.

Reference: Commands Similar to DELETE

None.

DISPLAY Command

How to:

Reference:

This subcommand displays the values of the named fields in a neat vertical list, whether the field is in the SHOW list or not. It is useful to view the values of fields not specified in a SHOW list. (TYPE presents only the fields named in the SHOW command.) It is convenient, for example, to move through databases looking at only the values of a few key fields. Then, when you find the record you want, use DISPLAY to display all of the fields in the segment(s) contained in the Show List.

The DISPLAY subcommand does not remain in effect. It simply lists the specified values. If you need to issue it repeatedly, store it with the X or Y subcommand for subsequent execution.

Syntax: How to Use the DISPLAY Command

DIsplay fieldname [fieldname...fieldname]

The field identifier may be the full field name, alternate alias, or shortest unique truncation of either. Separate field names from each other with spaces.

Example: Using DISPLAY

show last_name dat_inc
locate ln =smith
 LN=SMITH    DI=820101
display last_name first_name salary department
LAST_NAME   =SMITH
FIRST_NAME  =MARY
SALARY      = 13200.00
DEPARTMENT  =MIS

If the DISPLAY subcommand does not produce a list, it indicates that the fields requested must lie outside the currently retrieved segment(s) by displaying the message:

NO CURRENT VALUE FOR: field.

Reference: Commands Similar to DISPLAY

  • The TYPE subcommand is also used for showing the contents of the currently active data fields. TYPE presents the data horizontally, using the shortest name or alias available in the Master File. DISPLAY presents the information vertically, showing the full field names.
  • CRTFORM is used to format a screen, showing the full field names and the field contents, blocked two to a line. Use TYPE to show the contents of the CRTFORM.

END Command

How to:

Reference:

Terminates the SCAN session and writes all pending modifications to the FOCUS database.

Syntax: How to Use the END Command

End

Example: Using the END Command

END

Reference: Commands Similar to END

  • The FILE subcommand is a synonym for END. This also results in normal termination of the session.
  • The SAVE subcommand also writes the modifications to the database, but does not terminate the SCAN session. You retain your position in the database.

FILE Command

How to:

Reference:

Terminates the SCAN session and writes all pending modifications to the FOCUS database.

Syntax: How to Use the FILE Command

File

Example: Using the FILE Command

FILE

Reference: Commands Similar to FILE

  • The END subcommand is a synonym for FILE. This also results in normal termination of the session.
  • The SAVE subcommand writes the modifications to the database, but does not terminate the SCAN session. You retain your position in the database.

INPUT Command

How to:

Reference:

The subcommand opens the database to accept one or more new segments of data. It creates a segment instance in each segment for which a field value is specified.

The new records are inserted after the record currently displayed; that is, they break the chain. However, if the segment is being maintained in some sort sequence, a check is subsequently performed and the new records inserted in their proper positions.

Syntax: How to Use the INPUT Command

Input [field=value,...[,$]]

The input records are defined as free-format, or comma-delimited. They are entered in one of two ways:

  • The data may be typed on the same line as the command. It must be typed on one line. In this case, it does not have to be terminated by a comma and dollar sign (,$).
  • Or if the subcommand is issued on a line by itself, then the new record may be typed on several lines, but it must be terminated by a comma and dollar sign (,$).

Example: Using the INPUT Command

show emp_id last_name salary jobcode
tlocate ln=jones
 EID=117593129 LN=JONES SAL= 18480.00 JBC=B03
input salary=19000.00, jobcode=b04
 SCAN:
type
 EID=117593129 LN=JONES SAL= 19000.00 JBC=B04

Caution: SCAN rejects records that have key field values that already exist in the database (duplicate keys). In this example, if you type the following, you get a warning.

input eid=117593129, salary=19000.00, jobcode=604
 DATA KEYS ARE ALREADY IN FILE
 SCAN:

Such warnings are only provided for key fields, however, and inadvertently creating a duplicate instance of a segment can have unexpected consequences, particularly if one of the records is a short-path record. Subsequently, you may see different versions depending on the fields you name in your SHOW command.

Reference: Commands Similar to INPUT

None.

JUMP Command

How to:

Reference:

Starting from the field in the current record, JUMP moves immediately to the next occurrence of the same field. This skips over any intervening records and is a quick way to traverse a database. Specify n to jump n occurrences.

If JUMP encounters no additional field occurrences for the same parent record, it stops at the last record in the current chain and displays the END-OF-CHAIN message. It does not move to the start of the next chain.

Syntax: How to Use the JUMP Command

Jump fieldname [n]

Example: Using the JUMP Command

show emp_id last_name first_name salary
type 7
 EID=071382660 LN=STEVENS FN=ALFRED  SAL= 11000.00
 EID=071382660 LN=STEVENS FN=ALFRED  SAL= 10000.00
 EID=112847612 LN=SMITH   FN=MARY    SAL= 13200.00
 EID=117593129 LN=JONES   FN=DIANE   SAL= 18480.00
 EID=117593129 LN=JONES   FN=DIANE   SAL= 17750.00
 EID=119265415 LN=SMITH   FN=RICHARD SAL= 9500.00
 EID=818692173 LN=CROSS   FN=BARBARA SAL= 25775.00
 EID=119265415 LN=SMITH   FN=RICHARD SAL= 9050.00
 
top
 TOF:
next
 EID=071382660 LN=STEVENS FN=ALFRED  SAL= 11000.00
jump emp_id 2
 EID=117593129 LN=JONES   FN=DIANE   SAL= 18480.00

Reference: Commands Similar to JUMP

The NEXT subcommand is used to advance to the next logical record.

LOCATE Command

How to:

Reference:

Starting at the current position, initiates a search for record(s) meeting the test condition(s). When an acceptable record is found, it is displayed. If the end of the database is encountered during the search, the message EOF: is displayed.

Syntax: How to Use the LOCATE Command

Locate field rel value [[AND|,]field rel value [,$] [*|n]]

where:

field

Is the field name of the target(s).

rel

Is one of the following test relations:

Relation

Meaning

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

Contains

OMITS

Omits

value

Is the object of the comparison.

n

Is the number of occurrences which may exist.

The comma-dollar sign (,$) terminator symbol is not required if only one record is sought (the default). It is required if you provide a replication factor (n) larger than 1. If the replication factor is set to *, then all records meeting the test conditions are displayed (from the current position to the end of the database).

When using more than one test relation, separate them by either commas or the word AND, as

locate field rel value, field rel value

or:

locate field rel value AND field rel value

If you supply a list of values with an EQ test, separate the values with the word OR:

locate field EQ value OR value OR value

Example: Using the LOCATE Command

show emp_id last_name first_name salary
locate dpt=mis
 EID=112847612 LN=SMITH  SAL=  13200.00 JBC=B14

Reference: Commands Similar to LOCATE

TLOCATE has exactly the same function, but effectively adds the TOP function and begins the search at the top of the database.

MARK Command

How to:

Reference:

The MARK subcommand identifies a logical record so that you can return to it when you issue the MOVE or BACK subcommand. Only one record can be marked at a time. MARK is used to identify data to be moved to a new location in the database, and to return to a record with the BACK command.

Syntax: How to Use the MARK Command

MArk

Example: Using the MARK Command

show emp_id last_name first_name salary
next
 EID=071382660 LN=STEVENS  FN=ALFRED  SAL= 11000.00
jump emp_id 2
 EID=117593129 LN=JONES    FN=DIANE   SAL= 18480.00
mark
next 2
 EID=119265415 LN=SMITH    FN=RICHARD SAL= 9500.00
back
 EID=117593129 LN=JONES    FN=DIANE   SAL= 18480.00

Reference: Commands Similar to MARK

None.

MOVE Command

How to:

Reference:

The MOVE subcommand moves segment instances and all of their descendant segments from one parent segment to another.

Identify the record instance of the segment to be moved with the MARK subcommand. Then locate the new position for the marked segment instance in any manner (LOCATE, NEXT, etc.). Follow with the MOVE subcommand naming the instance of the segment being moved. The moved instance and all of its descendants are made descendants of the parent at the current position. If the SEGTYPE is not S or SH, then the segment will be inserted after the record currently shown. If the SEGTYPE is S or SH (sorted, sorted high-to-low), the segments will be located in the proper sort sequence.

Syntax: How to Use the MOVE Command

MOve fieldname

Example: Using the MOVE Command

show emp_id last_name salary dat_inc
next
 EID=071382660 LN=STEVENS    DI=820101 SAL= 11000.00
mark
locate ln=greenspan
 EID=543729165 LN=GREENSPAN  DI=820611 SAL= 9000.00
move dat_inc
 EID=543729165 LN=GREENSPAN  DI=820101 SAL=11000.00

In the example, the date of increase (DAT_INC or DI) and salary (SAL) are taken from the marked record of Alfred Stevens and moved to Mary Greenspan's record.

Reference: Commands Similar to MOVE

None.

NEXT Command

How to:

Reference:

The current position is advanced nn records and the new position is displayed (where nn is the number of records from 1 to 99). If the end of the database is reached during the movement to the new current position, the message EOF: is displayed.

Syntax: How to Use the NEXT Command

Next [nn]

The default is one record.

Example: Using the NEXT Command

show emp_id last_name first_name salary
type 8
 EID=071382660 LN=STEVENS  FN=ALFRED  SAL= 11000.00
 EID=071382660 LN=STEVENS  FN=ALFRED  SAL= 10000.00
 EID=112847612 LN=SMITH    FN=MARY    SAL= 13200.00
 EID=117593129 LN=JONES    FN=DIANE   SAL= 18480.00
 EID=117593129 LN=JONES    FN=DIANE   SAL= 17750.00
 EID=119265415 LN=SMITH    FN=RICHARD SAL= 9500.00
 EID=119265415 LN=SMITH    FN=RICHARD SAL= 9050.00
 EID=119329144 LN=BANNING  FN=JOHN    SAL= 29700.00
 
top
 TOF:
next 4
 EID=117593129 LN=JONES    FN=DIANE   SAL= 18480.00
next 2
 EID=119265415 LN=SMITH    FN=RICHARD SAL= 9500.00

NEXT 4 advances the current position to the fourth logical record and displays the field values at that position. The subsequent NEXT 2 moves the current position forward two more logical records.

Reference: Commands Similar to NEXT

None.

QUIT Command

How to:

Reference:

Ends the SCAN session. All pending modifications to the database (those not yet written permanently to the disk) are suppressed.

The use of this subcommand does not guarantee that all changes to the database will be ignored. During SCAN execution, large buffer areas hold the pending changes. Depending on the operating system and buffer sizes, a large SCAN file could threaten the buffer capacity. This forces the operating system to write your pending changes to the database to clear the buffer. This would update your database, even though you had not issued a SAVE, END or FILE subcommand.

The FOCUS Absolute File Integrity facility reduces the risk of making changes you do not want. Also, keeping your own copy of the database before you start the session gives you a recovery capability in the event you lose your way in SCAN and create a database you subsequently decide to discard.

The QUIT subcommand acts only to prevent transfer of those records in the buffer to the disk.

When a change is made to a database immediately prior to issuing QUIT, the change is usually suppressed. If SCAN activity is high between modifications to the database, however, the chance of suppressing all changes is less likely, because the buffer work areas may, of necessity, have been written to the disk to make way for more pages of database records.

Syntax: How to Use the QUIT Command

Quit

Example: Using the QUIT Command

QUIT

Reference: Commands Similar to QUIT

END and FILE both terminate the session but both write any pending changes to the database. SAVE also writes the changes to the database, but leaves you in the SCAN session.

REPLACE Command

In this section:

How to:

The REPLACE command replaces the data values for the record at the current position with the data values provided. The fields replaced may reside on the same segment or different segments, but must be on the path defined by the Show List if one is in effect.

Two types of global REPLACE operations can be specified:

Syntax: How to Use the REPLACE Command

Replace [KEY] field=value, field=value, $ [factor]

where:

factor

Is one of the following:

1 is the default.

* represents all fields.

nn is the number of field values that can be replaced at one time. If the replication factor nn is greater than 1, then all of the replaced fields must reside on the same segment.

If the field whose value is being replaced is used to keep the segment in the proper sort sequence (that is, it is a key field), then the word KEY must be placed after the command. Without this word, a message is displayed indicating that the key field cannot be replaced.

Note: The replication factor cannot be used with REPLACE KEY.

Using the REPLACE Command

Reference:

This section will show how to use the REPLACE command.

Example: Replacing a Field Value With REPLACE

show emp_id last_name salary
tlocate eid=112847612
 EID=112847612 LN=SMITH  SAL= 13200.00
replace salary=16000.00
 EID=112847612 LN=SMITH  SAL= 16000.00

Example: Replacing Multiple Field Values With REPLACE

show emp_id last_name jobcode
next
 EID=071382660 LN=STEVENS JBC=A07
replace jobcode=B02,$ *
 EID=071382660 LN=STEVENS JBC=B02
 EID=071382660 LN=STEVENS JBC=B02
 EID=112847612 LN=SMITH   JBC=B02
 .
 .
 .
 VALUES REPLACED= 19
 EOF:

Example: Replacing a Key Field Value With REPLACE

show emp_id last_name first_name
tlocate ln=stevens
 EID=071382660  LN=STEVENS  FN=ALFRED
 replace key eid=971382660
  EID=971382660 LN=STEVENS  FN=ALFRED
  KEY VALUE RESEQUENCED...
 type *
  EID=971382660 LN=STEVENS  FN=ALFRED
 EOF:

Notes on replacing key fields:

  • The segment is re-sequenced to preserve the correct sort order. In this case, we gave Stevens the highest employee number in the database, so the TYPE * command types one record and reaches end-of-file.
  • Only one key field can be replaced at a time.
  • This may result in duplicate keys in the database (you need to keep track of this).

Reference: Commands Similar to REPLACE

CHANGE command.

SAVE Command

How to:

Reference:

Writes out all modifications to the FOCUS database. The SCAN session continues at the current position held before the SAVE. If the FOCUS Absolute File Integrity feature is active, this is the point at which a new checkpoint is taken.

To activate the Absolute File Integrity feature, issue the following command at the FOCUS command level before you create the database:

SET SHADOW=ON

If the SET SHADOW command is issued after the database is created, the command has no effect. See the Describing Data manual for information about the FOCUS Absolute File Integrity feature. See the Developing Applications manual for more information about the SET parameters.

Periodic use of SAVE during SCAN sessions is recommended. Otherwise, if communication lines are lost or other processing interruptions occur, the modifications made since the previous SAVE must be repeated.

Syntax: How to Use the SAVE Command

SAve

Example: Using the SAVE Command

SAVE

All modifications to the database are written to the disk, and the SCAN session continues.

Reference: Commands Similar to SAVE

Both END and FILE write your changes to the database and terminate the SCAN session. QUIT is used to delete any pending changes to the database and terminate the SCAN session.

SHOW Command

In this section:

How to:

SHOW is used to create a subset of the database (called a Show List, subtree, or a logical view) for editing. It always moves the current position to the top of the database, and the logical records are only as deep as the Show List (that is, they consist of only the segments named in the SHOW subcommand, which had data in all of the specified fields plus any intermediate segments needed to connect the segments containing the named fields).

Syntax: How to Use the SHOW Command

SHow [fieldlist]

where:

fieldlist

Can be one of the following:

fieldname [*] fieldname * fieldnamefieldname *

Separate field names with blanks. Field names can be full field names, aliases, or unique truncations of either.

On entry into the SCAN environment, all of the data fields in the first physical top-to-bottom path are displayed as the default Show List. When SHOW is issued with no list of field names, the names of all of the fields in the current path are displayed.

Use an asterisk (*) between two field names to select all fields between and including them. Use an asterisk and one field name to select all field names up to and including the named field. Use one field name and an asterisk to select all field names from that field on.

Using the SHOW Command

Reference:

This sections shows how to use the SHOW command.

Example: Selecting a Logical View (a Show List)

show eid last_name salary
type *
 EID=071382660 LN=STEVENS SAL= 11000.00
 EID=071382660 LN=STEVENS SAL= 10000.00
 EID=112847612 LN=SMITH   SAL= 13200.00
 EID=117593129 LN=JONES   SAL= 18480.00
 .
 .
 .
 EID=818692173 LN=CROSS   SAL= 25775.00
 EOF:

The Show List, or subtree, consists of all segment instances that have data for all of the fields specified (Employee Identification Number, Last Name and Salary). Records lacking instances of any of these fields (for example, short-path records) are not included in the list.

Example: Selecting All Fields Between Two Named Fields

show emp_id * bank_name
type 2
 EID=071382660 LN=STEVENS  FN=ALFRED HDT=800602
 DPT=PRODUCTION  CSAL=11000.00 CJC=A07 OJT= 25.00 BN=
 EID=112847612 LN=SMITH    FN=MARY   HDT=810701
 DPT=MIS         CSAL=13200.00 CJC=B14 OJT= 36.00 BN=

All fields between (and including) EMP_ID and BANK_NAME are included in the Show List. (Stevens and Smith do not have a bank for electronic transfer and, therefore, the value for BN is blank.)

Example: Selecting All Fields

To select all fields, use an asterisk instead of field names.

SHOW *

Note: To examine the contents of the current position in the Show List, you can use TYPE to print just the fields named in the SHOW subcommand. Use DISPLAY or CRTFORM if you wish to see the contents of other fields in the selected segments. (Use TYPE with CRTFORM to see the display.)

Subsequent navigation keywords will show the field values for the current position for each of the fields named in the SHOW subcommand.

Reference: Commands Similar to SHOW

None.

TLOCATE Command

How to:

Reference:

TLOCATE is a convenience feature that combines the capabilities of the LOCATE subcommand with those of TOP. When issued, the search begins at the top of the database. This combined functionality allows you to automate processes more easily using the X and Y subcommands.

If the subcommand AGAIN is used following TLOCATE, it locates the same record rather than moving ahead to the next instance as it would with LOCATE.

Syntax: How to Use the TLOCATE Command

TLocate field rel value [[AND|,]field rel value [,$][*|nn]]

where:

field

Is the field name of the target(s).

rel

Is one of the following test relations:

Relation

Meaning

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

Contains

OMITS

Omits

value

Is the object of the comparison.

The comma-dollar sign (,$) terminator character is not required if only one record is sought. However, it is required if you provide a replication factor larger than one. If the replication factor is set to *, then all records meeting the test conditions are displayed from the current position to the end of the database.

When using more than one test relation, separate them either with commas or the word AND, as follows

locate field rel value, field rel value

or:

locate field rel value AND field rel value

If you supply a list of values with an EQ test, separate the values with the word OR:

locate field EQ value OR value OR value

Example: Using the TLOCATE Command

show last_name first_name department
tlocate dpt=production
 LN=STEVENS  FN=ALFRED DPT=PRODUCTION
next 5
 LN=IRVING   FN=JOAN   DPT=PRODUCTION
tlocate dpt=production
 LN=STEVENS  FN=ALFRED DPT=PRODUCTION

Reference: Commands Similar to TLOCATE

LOCATE is the same command, but without the TOP function.

TOP Command

How to:

Reference:

The current position is set at the first logical record in the database. If the next subcommand is TYPE or NEXT, the first record is retrieved and displayed.

When the message EOF: appears after any subcommand, use TOP to reset the current position.

Syntax: How to Use the TOP Command

TOp

Example: Using the TOP Command

show emp_id last_name salary
next 30
 EOF:
top
 TOF:
next
 EID=071382660 LN=STEVENS SAL=  11000.00

The current position is reset to the top of the database.

Reference: Commands Similar to TOP

  • SHOW also takes you to the top of the database, but its primary purpose is the selection of the logical database view that you wish to use.
  • TLOCATE goes to the top of the database before starting its search for the field(s) you have specified.

TYPE Command

How to:

Reference:

The TYPE command displays the values of the named fields or displays the contents of a CRTFORM.

Syntax: How to Use the TYPE Command

TYpe [factor]

where:

factor

Is one of the following: 1 is the default.

n displays the record at the current position plus the next n-1 records, if the replication factor is greater than 1.

* displays the message EOF: after the last record in the database is displayed. Use TOP to reset the current position to the top of the database.

Example: Using the TYPE Command

show emp_id last_name salary
type 6
 EID=071382660 LN=STEVENS  SAL= 11000.00
 EID=071382660 LN=STEVENS  SAL= 10000.00
 EID=112847612 LN=SMITH    SAL= 13200.00
 EID=117593129 LN=JONES    SAL= 18480.00
 EID=117593129 LN=JONES    SAL= 17750.00
 EID=119265415 LN=SMITH    SAL= 9500.00

The record at the current position and the next five records are displayed.

Reference: Commands Similar to TYPE

  • The DISPLAY command also shows the contents of the currently active data fields, but DISPLAY shows all the named fields in a neat vertical list, whether they are in the SHOW command or not.
  • CRTFORM is used to format a screen, showing the full field names and the field comments, blocked two to a line. Use TYPE to show the contents of the CRTFORM.

UP Command

How to:

Reference:

The UP subcommand resets the current position to the first descendant instance under a parent instance. Hence, it moves the position to the start of the current chain.

Syntax: How to Use the UP Command

UP fieldname

where:

fieldname

Is the name of a field in a descendant segment.

Example: Using the UP Command

show emp_id last_name salary pay_date
next 5
 EID=071382660 LN=STEVENS  SAL= 10000.00 PD=820630
up pay_date
 EID=071382660 LN=STEVENS  SAL= 10000.00 PD=820528

The current position is reset to the first instance of PAY_DATE information for Stevens.

Reference: Commands Similar to UP

None.

X and Y Commands

How to:

Reference:

The X and Y subcommands are used to store a complete SCAN subcommand for later execution by simply typing in the appropriate letter (X or Y).

To set, but not execute, a value for X or Y, type it as a first letter in front of any other subcommand. Any print suppression control, and the replication factors, are picked up from the stored subcommand.

Syntax: How to Use the X and Y Commands

[x|y] subcommand

Example: Using the X and Y Commands

y display emp_id last_name curr_sal pay_date gross
show emp_id pay_date
next
 EID=071382660		 PD=820831
y
 EMP_ID    =071382660
 LAST_NAME =STEVENS
 CURR_SAL  =  11000.00
 PAY_DATE  =820831
 GROSS     =   916.67

A series of operations can be performed by repeatedly entering X and Y subcommands.

Reference: Commands Similar to X and Y

None.

? Command

How to:

Reference:

The ? subcommand recalls and displays the last recognized subcommand issued in the SCAN mode.

Syntax: How to Use the ? Command

?

Example: Using the ? Command

Show emp_id last_name salary jobcode
locate dpt=mis
 EID=112847612 LN=SMITH  SAL= 13200.00 JBC=B14
?
 LOCATE DPT=MIS
again
 EID=117593129 LN=JONES  SAL= 18480.00 JBC=B03

Here the LOCATE operation returns a record. AGAIN locates the next record that meets the stated criteria.

Reference: Commands Similar to ?

None.


Information Builders