Process Help

RESTRI - copy records restricted by key field values in second input file

 

Process Name

Menu Path

Link to Command Table

RESTRI

Data ribbon | Data Tools | Relational | Restrict Records

Click here

 

Introduction

Performs a relational restriction operation.

How to use

Records from the first input file are copied to the output file only if there is a match between the keyfields of the first and second input files. The effect is to select records from the first input file if they are matched with the entries in the second input file, using the keyfields as the match criteria. Thus restriction is essentially a record selection mechanism.

At least one keyfield must be specified and must appear in both input files as an explicit field. The keyfield may be up to 5 words long, and may be composed of up to 5 fields. If a field is specified which does not exist in both input files, it is ignored, providing at least one field matches.

Both input files must be sorted in the order of the keyfields before they can be processed by RESTRI. If this is not the case, the process will exit with an error message.

A typical use of the RESTRI process is to select drillholes from a file by supplying a set of borehole identifiers as the second input file.


Files, Fields and Parameters

Input Files

Name

Description

I/O Status

Required

Type

IN1

File to have records selected (sorted on required keyfields).

Input

Yes

Table

IN2

File with required values of keyfields (sorted on required keyfields).

Input

Yes

Table

Output Files

Name

I/O Status

Required

Type

Description

OUT

Output

Yes

Table

Output file.

Fields

Name

Description

Source

Required

Type

Default

KEY1

Keyfield for matching.

IN1, IN2

Yes

Any

Undefined

KEY2

Keyfield 2.

IN1, IN2

No

Any

Undefined

KEY3

Keyfield 3.

IN1, IN2

No

Any

Undefined

KEY4

Keyfield 4.

IN1, IN2

No

Any

Undefined

KEY5

Keyfield 5.

IN1, IN2

No

Any

Undefined

KEY6

Keyfield 6.

IN1, IN2

No

Any

Undefined

KEY7

Keyfield 7.

IN1, IN2

No

Any

Undefined

KEY8

Keyfield 8.

IN1, IN2

No

Any

Undefined

KEY9

Keyfield 9.

IN1, IN2

No

Any

Undefined

KEY10

Keyfield 10.

IN1, IN2

No

Any

Undefined


Notes

No additional notes.


Example

!RESTRI     &IN1(FILE),&IN2(BHIDS),&OUT(FILE1),*KEY1(BHID)


Error and Warning Messages

Message

Description

Solution

>>> INPUT FILE NOT SORTED ON KEYFIELD <<<

One (or both) of the input files is not sorted on the designated keyfield(s). Fatal; the process is exited.

 

 

 

 

>>> ERR 47 <<< ( 0) IN FNDKEY

Warning; none of the specified key fields exist in the input files. An output file is produced consisting only of a Data Definition containing the fields of both input files.

 

 

 

 

>>> KEYFIELD aaaaaaaa MISSING FROM FILE ffffffff

A warning message that is produced if @PRINT >=1. The keyfield is ignored and processing continues.

 

 

 

 

>>> ERR 121 <<< ( fileno) IN RESTRI

One (or both) of the input files is empty. Fatal; the process is exited.