You need to post some sample input data and the output you want from that input.
Your title mentions Syncsort, but you posted in the cobol part of the forum. . . This is being moved to the Syncsort part of the forum. If this is not what you want, please clarify.