I have a wired requirement. My input file is Below
I want to sort this file on Account with eliminating duplicates But in this case I want to have preference for TYPE= A, means the record which will be written after eliminating duplicates will have preference for Type A.
if there is no records for particular account with type as A then any type can be written but only one row.
So in this case my out put needs to be
I agree this can be done with cobol program but is there any way this can be achieved using DFSORT
Joined: 23 Nov 2006 Posts: 19270 Location: Inside the Matrix
Show a more complete set of input data and the output you want from this expanded input. Clearly explain what "For given example the type code is A so this solution will work but type code can be changed to 'B' or 'C' " means. It is not at all clear.
Possibly this will be easier to understand if you use more realistic values rather than alphabet soup. . .
When posting the data, use the Code tag and Preview your post to make sure it looks like you want.
Assuming your input is FB recfm and 80 byte LRECL. use the following DFSORT/ICETOOL JCL which will give you the desired results. Depending on your type code you want to come first, change the 2nd IFTHEN statement to reflect the type code you interested.
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,1,CH) FIRST USING(CTL1)
//CTL1CNTL DD *