Sort Variable Pipe Delimited Records

Input File 1 - PipeDelim.txt
James|Mockingbird Ln|Dallas|TX|75201
Frank|34th Ave|Washington|DC|20521
Lemon|77 Cliff Dr|Agawam|MA|01002
Service|Misty Marie Lane|Ketchikan|Alaska|99950
Service Manager||Holtsville|NY|00501
Smith|123 Main Street|Little Rock|AR|72201
Wilson|33 Arch St|Fort Campbell|KY|42223
Sort Control Cards - PipeDelimCtl.txt
 RECORD TYPE=T,LENGTH=1000
* Sort by ZIP Code, Delimited Field #1
* the FS parameter designates the Field Separator
* FS can also be coded in hex as FS=X'7C'
 SORT FIELDS=(#5,CH,A),FS='|'
 END
Command Line
> ahlsort PipeDelimCtl.txt PipeDelim.txt PipeDelimSorted.txt
Output File - PipeDelimSorted.txt
Service Manager||Holtsville|NY|00501
Lemon|77 Cliff Dr|Agawam|MA|01002
Frank|34th Ave|Washington|DC|20521
Wilson|33 Arch St|Fort Campbell|KY|42223
Smith|123 Main Street|Little Rock|AR|72201
James|Mockingbird Ln|Dallas|TX|75201
Service|Misty Marie Lane|Ketchikan|Alaska|99950
Back to Examples