It's not clear what you're trying to do. I don't have time to try to figure out what you want from all of those operators and control statements.
Your TO ddname is OUT1 for all of the operators. Is OUT1 a MOD data set that will contain the different versions of the input file you're creating? Or are you just showing what you'd like to get in one output data set?
You really need to step back and explain what you're trying to do. Show a good example of your input records (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the RECFM and LRECL of the input file. Give the starting position, length and format of the relevant fields.
Parm 2 and 3 contains header and trailer respectively. I have to include the same header and trailer as my input file to the output file. OUT1 is the DD name for my output file. It will contain the following
records sorted based on SRT1(parm4)
records sorted based on SRT2(parm5)
records sorted based on SRT3(parm6)
records sorted based on SRT4(parm7)
records sorted based on SRT5(parm8)
Now i am getting the perfect result, but i want to reduce the number of parms. Is there any way to reduce the number of parms?
I think we can club all those control cards into 1 single pass. In order to help you with a single pass solution I need the following details.
1. What is the LRECL and RECFM of the input dataset
2. Show me an example of the UFF fields on each record type. ie. type 01 & 02 has 7 bytes of uff data and type 03 has 5 bytes of uff data and type 04 has 4 bytes of uff data. What do the values for these fields look like?
The uff fields you show have sign in them and you dont consider the sign when sorting? If that is what you want then here is a DFSORT JCL will give you the desired results. The basic idea is to add all the sort fields for all conditions at the end of every record with record identifier using IFTHEN and then sort them as a single field and later on remove that extra bytes using OUTREC.