1. If I understood correctly, yes you can use SORT product. To name any other utility
, for one, FileAid can be your choice .
Suggest you show us a rather practical example of input records, expected output and the rules to get the output. Please tell us the LRECL and RECFM of the input/output files.
Which sort product do you use? If you're not sure to determine if you're using DFSORT (from IBM) or Syncsort (from Syncsort, Inc), run the PGM=ICEMAN JOB, actually any PGM=SORT or PGM=ICEMAN JOB. Look at the SYSOUT output. If it has ICExxxs messages, you're using DFSORT. If it has WERxxxs messages, you're using Syncsort.
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=* <--- look at messages
//SORTIN DD *
//SORTOUT DD DUMMY
//SYSIN DD *
2. Answer is... it depends. In "back-end" sort product at your shop will be invoked anyways.