Aneesh
New User
Joined: 30 Sep 2006 Posts: 60
|
|
|
|
Hi,
I have a FB file of length 80. The Key value is a 20 byte alphanumeric key from 1-20 - there can be multiple records for the key value for different date ranges - the date ranges for a single key will never overlap.
The requirement is to create a single record with the lowest starting date and highest ending date.
Key Start date End date
Key1 20090101 20090215
Key1 20090216 20090315
Key1 20090316 20120315
Key2 20090130 20200101
Key3 20090304 20090808
Key3 20090809 20101010
Ouput
Key1 20090101 20120315
Key2 20090130 20200101
Key3 20090304 20101010
Thanks in advance,
Aneesh. |
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT job that will do what you asked for:
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
Key1 20090101 20090215
Key1 20090216 20090315
Key1 20090316 20120315
Key2 20090130 20200101
Key3 20090304 20090808
Key3 20090809 20101010
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(1,4,
TRAILER3=(1,4,X,MIN=(6,8,ZD,TO=ZD,LENGTH=8),X,
MAX=(15,8,ZD,TO=ZD,LENGTH=8)))
/*
|
|
|