IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Merge records with data from first and last record


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Aneesh

New User


Joined: 30 Sep 2006
Posts: 60

PostPosted: Fri Jun 05, 2009 11:58 pm
Reply with quote

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.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Jun 06, 2009 12:52 am
Reply with quote

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)))
/*
Back to top
View user's profile Send private message
Aneesh

New User


Joined: 30 Sep 2006
Posts: 60

PostPosted: Sat Jun 06, 2009 1:14 am
Reply with quote

Thanks a lot, Frank.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top