Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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 Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts how to recover an uncataloged VSAM da... archanamuthukrishnan All Other Mainframe Topics 3 Wed Jan 11, 2017 6:18 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 0 Mon Jan 02, 2017 11:16 am
No new posts JES2 JEC: Use UNIX Pipes to Pass Data... Virendra Shambharkar JCL & VSAM 21 Tue Dec 20, 2016 6:55 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us