You are here: Commands > Gaps

Gaps

Menu: Found in the ANALYZE menu

The Gaps command is used to test key fields and detect gaps in the value of key fields for the current file.

If you run the Gaps command on a field that has characters mixed with numbers, for example “A12345”, the characters are ignored and only the numbers are tested for gaps. For example, if the field in the next record is “B12346”, then Analyzer would report no gaps as the “A” and “B” in the fields are ignored.

Note: If the presort option is used, the key field is sorted on its full alphanumeric value even though the subsequent Gap testing is only performed on the numbers within the field as described above. This may result in negative gaps being reported.

Parameters

In addition to the command parameters described below, the Gaps command has the following common command parameters: Append, First, If, Next, Presort, Screen, To and While. For a description, see Command Parameters. For a description of supported field modifiers see Field Modifiers.

On

Specifies the key field(s) to test for gaps. In the command dialog, use the “Fields to test for Gaps” pull-down list or click [Choose] to display the Selected Fields dialog. See Selection/Edit Dialog Boxes.

Gaps

Specifies that the output from the gaps testing is to report gap ranges, instead of listing each missing item. The key field values on either side of the gap are listed. In the command dialog, click the “List Gap Ranges” radio button.

Missing n

Specifies that the output from the gaps testing is to list each missing item. If the size of the gap is less than or equal to the maximum missing items (see below), each missing key is listed. If the gap is larger, only the first and last missing key are listed. In the command dialog, click the “List Missing Items” radio button and specify the maximum missing items in the “Maximum Consecutive Items” text box.

For example, you may have an invoice file for several branches, each with its own numbering sequence. When you reach the last number for one branch and start into the first number for the next branch, a missing range is almost always reported.

Skip

Excludes gap ranges and details from the output and only displays the number of duplicates identified. In the More tab of the command dialog, check the “Only show total gap count” checkbox.

Command Mode Syntax

GAPS <SKIP> <ON> key-field(s)...

<TO text-file-name|SCREEN>

<IF test> <WHILE test> <FIRST|NEXT range>

<PRESORT>

<GAPS|MISSING n>

<APPEND>

<OPEN>¿

Note: You cannot use the presort keyword within a Group command in a procedure.