SEQUENCE command
Concept Information
Determines if one or more fields in an Analytics table are in sequential order, and identifies out-of-sequence items.
Syntax
SEQUENCE <ON> {<FIELDS> key_field <D> <...n>|<FIELDS> ALL <EXCLUDE field_name <...n>>} <UNFORMATTED> <ERRORLIMIT n> <IF test> <WHILE test> <FIRST range|NEXT range> <TO {SCREEN|filename|PRINT}> <APPEND> <HEADER header_text> <FOOTER footer_text> <PRESORT> <ISOLOCALE locale_code>
Parameters
Name | Description |
---|---|
ON FIELDS key_field D <...n> | FIELDS ALL |
One or more character, numeric, or datetime fields to test for sequential order.
Note When you test by more than one field, you are testing for a nested sequential order in the source table. Valid use of SEQUENCE requires that you specify test fields in the same order as the existing nested sequential order in the source table. Multiple test fields are tested as a nested group. They are not tested independently of one another. |
EXCLUDE field_name optional |
Only valid when testing for sequential order using FIELDS ALL. The field or fields to exclude from the command. EXCLUDE allows you to fine-tune FIELDS ALL, by excluding the specified fields. EXCLUDE must immediately follow FIELDS ALL. For example: FIELDS ALL EXCLUDE field_1 field_2 |
UNFORMATTED optional |
Suppresses page headings and page breaks when the results are output to a file. |
ERRORLIMIT n optional |
The number of errors allowed before the command is terminated. The default value is 10. |
IF test optional |
A conditional expression that must be true in order to process each record. The command is executed on only those records that satisfy the condition. Note The IF parameter is evaluated against only the records remaining in a table after any scope parameters have been applied (WHILE, FIRST, NEXT). |
WHILE test optional |
A conditional expression that must be true in order to process each record. The command is executed until the condition evaluates as false, or the end of the table is reached. Note If you use WHILE in conjunction with FIRST or NEXT, record processing stops as soon as one limit is reached. |
FIRST range | NEXT range optional |
The number of records to process:
Use range to specify the number of records to process. If you omit FIRST and NEXT, all records are processed by default. |
TO SCREEN | filename | PRINT optional |
The location to send the results of the command to:
|
APPEND optional |
Appends the command output to the end of an existing file instead of overwriting it. Note You must ensure that the structure of the command output and the existing file are identical:
Analytics appends output to an existing file regardless of its structure. If the structure of the output and the existing file do not match, jumbled, missing, or inaccurate data can result. |
HEADER header_text optional |
The text to insert at the top of each page of a report. header_text must be specified as a quoted string. The value overrides the Analytics HEADER system variable. |
FOOTER footer_text optional |
The text to insert at the bottom of each page of a report. footer_text must be specified as a quoted string. The value overrides the Analytics FOOTER system variable. |
PRESORT optional |
Sorts the table on the key field before executing the command. Note You cannot use PRESORT inside the GROUP command. |
ISOLOCALE locale_code optional |
Note Applicable in the Unicode edition of Analytics only. The system locale in the format language_country. For example, to use Canadian French, enter fr_ca. Use the following codes:
If you do not use ISOLOCALE, the default system locale is used. |
Analytics output variables
Name | Contains |
---|---|
WRITEn |
The total number of sequence errors identified by the command. |
Examples
Testing for out-of-sequence employee IDs
You write any sequence errors identified in the EmployeeID field to a text file:
SEQUENCE ON EmployeeID ERRORLIMIT 10 TO "SequenceErrors.txt"
Remarks
For more information about how this command works, see Testing sequential order.
Using SEQUENCE inside a GROUP
If you use SEQUENCE inside a GROUP command, the command executes to avoid interfering with the processing of the group, but no further data sequence errors are reported.