Specifying the sorting field
The SORT statement is the first argument to PLISRTx. The syntax of the SORT statement must be a character string expression that takes the form:
- b
- One or more blanks. Blanks shown are mandatory. No other blanks are allowed.
- start,length,form,seq
- Sorting fields. You can specify any number of such fields, but
there is a limit on the total length of the fields. If more than one
field is to be sorted on, the records are sorted first according to
the first field, and then those that are of equal value are sorted
according to the second field, and so on. If all the sorting values
are equal, the order of equal records is preserved. The overlaying
of sort fields is not supported.
- start
- The starting position within the record. Give the value in bytes. The first byte in a string is considered to be byte 1.
- length
- The length of the sorting field. Give the value in bytes. The length of sorting fields is restricted according to their data type.
- form
- The format of the data. This is the format assumed for the purpose
of sorting. All data passed between PL/I routines and sort must be
in the form of character strings. The main data types and the restrictions
on their length are shown below.
- Code
- Data Type and Length
- CH
- character 1-65535
- ZD
- zoned decimal signed 1-255
- PD
- packed decimal signed 1-255
- BI
- binary, unsigned 1 bit to 4095 bytes
Note: If the file is EBCDIC, the PL/I library changes the sort argument from CH to BI to use the binary collating sequence for the field specified. The binary field limit is 4095. - seq
- The sequence in which the data is sorted:
- A - ascending (that is, 1,2,3,...)
- D - descending (that is, ...,3,2,1).
Note: You cannot specify E, because PL/I does not provide a method of passing a user-supplied sequence.
- other options
- The only option supported under workstation PL/I is the default, EQUALS. Source code downloaded from the mainframe, however, does not need to be altered.
