Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Merge records with data from first and last record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Merge records with data from first and last record
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 Moderator


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

PostPosted: Sat Jun 06, 2009 12:52 am    Post subject:
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    Post subject: Reply to: Merge records with data from first and last record
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to select record x+7 or x+2 based... JoAnn Kulcyk SYNCSORT 2 Tue Jan 16, 2018 10:49 pm
No new posts Data security erase on RAID device steve-myers All Other Mainframe Topics 0 Sat Jan 13, 2018 6:41 am
No new posts Skip records depends on count lakshmiibmmainframes DFSORT/ICETOOL 5 Sun Dec 24, 2017 9:51 pm
No new posts Compare two PS files using ICE TOOL f... SENTHIL MURUGAAN DFSORT/ICETOOL 5 Sun Dec 24, 2017 1:26 pm
No new posts Append the milliseconds to the data s... girishb2 DFSORT/ICETOOL 1 Thu Dec 21, 2017 9:07 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us