i.e., the difference in the output is that the values in Field3 of Input File should be preceded with a + sign and those in Field2 should be preceded with a - sign and all of these values should appear in Field2's position in the output file. And, do note that the input file has no fixed pattern in the order of records, i.e., each record can have a value in either the Field2 or the Field3, but only in one of them.
Do let me know if the above can be solved using SYNCSORT?
I assumed that for records where field2 and field3 are present field2 is always alphabetic and field3 is numeric. Similarly for the other record assumed field2 is numeric and field3 is alphabetic/spaces. I have tested with the given data and it works.
For ex. for the first record AAAA bbbbb 11111
BBBBB is less than 111111 hence AAAA +11111 is written to the output
For second record BBBB 33333
333333 is greater than spaces hence BBBB -333333 is written to the output.