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 3270 Data stream error Benchwarmer CICS 6 Tue Apr 17, 2018 12:06 am
No new posts How to list data set names with diffe... murali.andaluri CLIST & REXX 8 Thu Apr 12, 2018 11:33 pm
No new posts VSAM - Accessing beyond record size Benchwarmer JCL & VSAM 6 Wed Apr 11, 2018 9:20 pm
No new posts Extract the records with a PD field's... sudhakar84 DFSORT/ICETOOL 11 Mon Apr 02, 2018 7:26 pm
No new posts Merge 2 records sancraig16 SYNCSORT 19 Tue Mar 27, 2018 8:17 pm

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