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
 

 

Merging consecutive records based on key

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
seahawk789

New User


Joined: 22 Feb 2010
Posts: 52
Location: Cochin

PostPosted: Thu Jul 15, 2010 11:06 pm    Post subject: Merging consecutive records based on key
Reply with quote

Please find the below requirement,

The input file as following data (Rec Len : 10)


11111 AAAA
11111 BBBB
11111 CCCC
11111 DDDD

22222 EEEE
22222 DDDD
22222 CCCC
22222 BBBB
22222 AAAA

33333 GGGG
33333 HHHH
33333 RRRR

44444 ABCD
44444 NNNN

55555 VVVV
55555 JJJJ

66666 ZZZZ



Output file should be as given below (Rec Len : 30)

11111 AAAA BBBB CCCC DDDD
22222 EEEE DDDD CCCC BBBB AAAA
33333 GGGG HHHH RRRR
44444 ABCD NNNN
55555 VVVV JJJJ
66666 ZZZZ



Shall we create this output file using ICETOOL/SORT ?

Thanks in advance.
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: Thu Jul 15, 2010 11:11 pm    Post subject:
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=...  input file (FB/10)
//OUT DD DSN=...  output file (FB/30)
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(1,5,CH) WITHEACH KEEPNODUPS -
  WITH(12,4) WITH(17,4) WITH(22,4) WITH(27,4) USING(CTL1)
/*
//CTL1CNTL DD *
  OPTION COPY
  INREC IFOUTLEN=30,
    IFTHEN=(WHEN=INIT,OVERLAY=(31:SEQNUM,1,ZD,RESTART=(1,5))),
    IFTHEN=(WHEN=(31,1,ZD,EQ,2),OVERLAY=(12:7,4)),
    IFTHEN=(WHEN=(31,1,ZD,EQ,3),OVERLAY=(17:7,4)),
    IFTHEN=(WHEN=(31,1,ZD,EQ,4),OVERLAY=(22:7,4)),
    IFTHEN=(WHEN=(31,1,ZD,EQ,5),OVERLAY=(27:7,4))
/*
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 Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am


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