Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Sort with input/output procedures

If input and output procedures are specified, the following actions are taken:

  1. When a SORT statement is executed, it transfers control to the input procedure.

  2. The input procedure performs the following functions:

    1. Processes a record (for example, reads a record from a file or creates a new record).

    2. Releases the record to the sort-file.

    3. Repeats steps a) and b) until all records have been released.

  3. The SORT statement sorts the records on the sort-file.

  4. Control is then passed to the output procedure.

  5. The output procedure performs the following functions:

    1. Accepts a record from the sort-file.

    2. Processes the record (for example, writes the record to an output file).

    3. Repeats steps a) and b) until all records have been returned and processed.

  6. Control is returned to the statement following the SORT statement.

If options are mixed (e.g. if only an input procedure is specified), appropriate variants of the above procedures are performed.