Howard Brazee wrote:
>I'm wanting to sort a file that contains the following data:
>
> 212345678900000000{ *E033333
> 212345678900000000{ *E033333
> ----+----1----+----2----+---
> 212345678900000000{ *E033333
> 212345678900000000{ *E033333
> 212345678900000000{ *E033333
> 212345678900000000{ *N033333
> 212345678900000000{ *N033333
> 212345678900000000{ *Q033333
> 212345678900000000{ *Q033333
> 212345678900000000{ *Q033333
> 212345678900000000{ *Q033333
> 212345678900000000{ *Q033333
> 212345678900000000{ LN033333
> 212345678900000000{ LN033333
> 212345678900000000{ LN033333
> 212345678900000000{ LN033333
>
>Right now I have:
>
>SORT FIELDS=(1,10,CH,A
>             21,2,CH,A)
>
>I would like to change this to:
>
>SORT FIELDS=(1,10,CH,A
>             22,1,CH,A)
>SUM FIELDS=NONE
>
>But I absolutely need to pick up the "L" in column 21 instead of the "*"
in
>column 21 when there is a duplicate:
> 212345678900000000{ *E033333
> 212345678900000000{ *Q033333
> 212345678900000000{ LN033333
>
> How do I guarantee which of the duplicates I pick up?

I'm not sure I understand what you're trying to do, but if you want to pick
up the LAST duplicate,
you can use a DFSORT/ICETOOL job like this:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file
//OUT DD DSN=...  output file
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,10,CH) ON(22,1,CH) LASTDUP
/*

OUT would have:

212345678900000000{ *E033333
212345678900000000{ LN033333
212345678900000000{ *Q033333

If you need the LN record last, you could sort this output on 21,2,CH,A.

Frank Yaeger - DFSORT Team (IBM)
 Specialties: ICETOOL, IFTHEN, OVERLAY, Symbols, Migration
 => DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort/

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to