SEQUENCE command

Used to determine if one or more fields in the active table are in sequential order, and identify out-of-sequence items.


SEQUENCE <ON> <FIELDS> {field <D>} <...n>  <UNFORMATTED>
<ERRORLIMIT n> <IF test> <WHILE test> <FIRST|NEXT range>
<TO SCREEN|filename|PRINT> <APPEND> <HEADER header_text>
<FOOTER footer_text> <PRESORT> <LOCAL> <ISOLOCALE locale_code>



Specifies the fields or expressions to check for sequential order. The ON and FIELDS keywords can be omitted.


Optional. Specifies that key fields are sorted in descending order. The default sort order is ascending.


Optional. Specifies that page headings and page breaks should be suppressed for results that are output to a report or a file.


Optional. Specifies the number of errors allowed before the command is terminated. The default value is 10.

IF test

Optional. Specifies a condition that must be met. The command is executed on only those records that meet the condition.

WHILE test

Optional. Specifies that the command is executed only while a condition is true. The command processing terminates as soon as the specified condition evaluates as false, or the end of the table is reached.

FIRST | NEXT range

Optional. Specify FIRST to start processing at the first record or NEXT to start processing at the currently selected record. Use the range value to specify the number of records to process.

TO SCREEN | filename | PRINT
  • Specify TO SCREEN to display the results in the ACL display area. This is the default output if the TO parameter is not specified.

  • Specify TO filename to save the results to a file. You must specify the filename value as a quoted string with the appropriate file extension. For example, specify the .TXT file extension to create a text file.

    For example: TO "Output.TXT"

    You can also specify an absolute or relative file path to save the file to an existing folder.

    For example: TO "C:\Output.TXT" or TO "Results\Output.TXT"

  • Specify TO PRINT to send the results to the default printer.


Optional. Specifies that command output is appended to the end of an existing file instead of overwriting it. When using this parameter, you must ensure that the structure of the command output and the existing file is identical, if maintaining a consistent file structure is important (for example, when you are appending data to an existing ACL table), because ACL appends output to an existing file regardless of its structure.

HEADER header_text

Optional. Specifies the text to insert at the top of each page of a report. The header_text value must be specified as a quoted string. The value overrides any value set for the ACL HEADER system variable.

FOOTER footer_text

Optional. Specifies the text to insert at the bottom of each page of a report. The footer_text value must be specified as a quoted string. The value overrides any value set for the ACL FOOTER system variable.


Optional. Sorts the primary table on the primary key before executing the command. You cannot use PRESORT inside the GROUP command.


Optional. Specifies that the output file is saved in the same location as the ACL project. This parameter only applies when the command is run on an ACL Server table and the output file is an ACL table.

ISOLOCALE locale_code

Optional. This parameter is only available in the Unicode edition of ACL. Specifies the locale. If you do not specify a locale, ACL uses the default locale. Locale codes are based on the ISO 639 standard language codes and the ISO 3166 standard country codes. Enter locale_code in the format language code_country code. For example, enter the code fr_ca for Canadian French. If you do not specify a country, ACL uses the default country for the language.

ACL output variables


Stores the total number of sequence errors identified by the command.


If the SEQUENCE command is used inside a GROUP command, ACL completes the command execution to avoid interfering with the processing of the group, but no further data sequence errors are reported.


The following example writes any sequence errors identified in the EmployeeID and HireDate fields to a text file.

SEQUENCE ON EmployeeID HireDate ERRORLIMIT 10 TO "SequenceErrors.txt"

(C) 2015 ACL Services Ltd. All Rights Reserved.