Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
SORT—Sort Data z/OS ISPF Edit and Edit Macros SC19-3621-00 |
|
The SORT macro command puts data in a specified order. SyntaxMacro command syntax .-.ZFIRST--.ZLAST-. >>-ISREDIT--SORT--+-----------------+--+----+-------------------> '-labela--labelb--' +-X--+ '-NX-' >--+--------------------+-------------------------------------->< | .----------------. | | V | | '---| sort_field |-+-' sort_field .-A-. |--+---+--start_col--+---------+--------------------------------| '-D-' '-end_col-'
DescriptionThe SORT command operates in two different modes, based on the hexadecimal mode status. If hexadecimal mode is on, the data is ordered according to its hexadecimal representation. If hexadecimal mode is off, data is sorted in the collating sequence defined for the national language being used. Sorting data without operandsFor a SORT command with no operands, the editor compares the data within the current boundaries character by character, and then orders it line by line in the proper collating sequence. It ignores data outside the current boundaries during both operations. This means that only the data inside the current boundaries is changed. Labels, excluded lines, line numbers, and change, error, and special line flags are considered associated with the data, and therefore points to the same data fields after the sort as they did before the sort. For example, if you issue a CHANGE ALL command that changes the first, third, and sixth lines in a data set, these lines are flagged with the change flag, ==CHG>. If you then issue a SORT command that results in the former lines 1, 3 and 6 becoming the first, second and third lines of the sorted file, the changed line flags would now exist on the first, second and third lines of the sorted data set. It is important to properly set the boundaries before issuing the SORT command. SORT is a powerful tool for editing data that may be formatted in multiple columns. You can set the boundaries, for example, to the first half of a record and sort one column of data. Then you can set the boundaries to the last half of the record and sort a second column of data. Limiting the SORT commandYou can specify up to five sort fields by labeling starting and ending columns. You can identify each field as having data sorted in ascending or descending order. Optionally, you can limit sorting to a range of lines by specifying the labels of the first and last lines of the range. You can also limit sorting to either excluded or non-excluded lines. If you have labels or line ranges that are between the labels or
line ranges specified with the SORT command, you can keep SORT from
rearranging them by:
See the definition of the NX operand and EXCLUDE—Exclude Lines from the Display for more information. Sorting DBCS dataWhen sorting data that contains DBCS character strings, you must ensure that no DBCS string crosses the boundaries. Also, all records must have the same format at the boundaries, although the format of the left and right boundaries can differ. If a boundary divides a DBCS character, or if all records do not have the same format at the boundaries, the result is unpredictable. Return codes
ExamplesTo sort the data in descending order, using the sort key in columns 15
through 20:
To sort all excluded lines in ascending order:
|
Copyright IBM Corporation 1990, 2014
|