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
 
Combining of different records via a common key

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

Active User


Joined: 18 Jun 2007
Posts: 213
Location: Cochin/Kerala/India

PostPosted: Fri Feb 01, 2008 9:28 pm    Post subject: Combining of different records via a common key
Reply with quote

Hi All,
My input file has in thsi format

1001 M1
1001 M2
1001 M3
1002 M1
1002 M4

My output file should be in the below format
1001 M1 M2 M3
1002 M1 M4

Can we do this thru SORT?

Bipin Peter
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: Fri Feb 01, 2008 10:35 pm    Post subject:
Reply with quote

What is the maximum possible number of occurrences of the key (e.g. 1001 has 3 occurrences - is that the maximum you expect)?

What is the RECFM and LRECL of the input file?
Back to top
View user's profile Send private message
bipinpeter

Active User


Joined: 18 Jun 2007
Posts: 213
Location: Cochin/Kerala/India

PostPosted: Sat Feb 02, 2008 8:33 am    Post subject:
Reply with quote

i'm expecting maxumum 10 occurences
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Sat Feb 02, 2008 11:19 am    Post subject:
Reply with quote

Assuming the file is FB, try the below DFSORT/ICETOOL solution
Code:
//*******************************************************               
//STEP001  EXEC PGM=ICETOOL                                             
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN1      DD *                                                         
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
1001 M0                                                                 
1001 M1                                                                 
1001 M2                                                                 
1001 M3                                                                 
1001 M4                                                                 
1001 M5                                                                 
1001 M6                                                                 
1001 M7                                                                 
1001 M8                                                                 
1001 M9                                                                 
1002 M1                                                                 
1002 M4                                                                 
1003 M4
/*                                                                     
//OUT      DD SYSOUT=*                                                 
//TOOLIN   DD *                                                       
 SPLICE FROM(IN1) TO(OUT) ON(1,4,CH) WITHEACH -                       
 WITH(9,3) -                                                           
 WITH(12,3) -                                                         
 WITH(15,3) -                                                         
 WITH(18,3) -                                                         
 WITH(21,3) -                                                         
 WITH(24,3) -                                                         
 WITH(27,3) -                                                         
 WITH(30,3) -                                                         
 WITH(33,3) -                                                         
 USING(CP01) KEEPNODUPS                                               
/*                                                                     
//CP01CNTL DD   *                                                     
  INREC  IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,3,ZD,RESTART=(1,4))),   
         IFTHEN=(WHEN=(81,3,ZD,EQ,+2),BUILD=(1,5,9:6,3)),             
         IFTHEN=(WHEN=(81,3,ZD,EQ,+3),BUILD=(1,5,12:6,3)),             
         IFTHEN=(WHEN=(81,3,ZD,EQ,+4),BUILD=(1,5,15:6,3)),             
         IFTHEN=(WHEN=(81,3,ZD,EQ,+5),BUILD=(1,5,18:6,3)),             
         IFTHEN=(WHEN=(81,3,ZD,EQ,+6),BUILD=(1,5,21:6,3)),             
         IFTHEN=(WHEN=(81,3,ZD,EQ,+7),BUILD=(1,5,24:6,3)),             
         IFTHEN=(WHEN=(81,3,ZD,EQ,+8),BUILD=(1,5,27:6,3)),             
         IFTHEN=(WHEN=(81,3,ZD,EQ,+9),BUILD=(1,5,30:6,3)),             
         IFTHEN=(WHEN=(81,3,ZD,EQ,+10),BUILD=(1,5,33:6,3))             
  OUTFIL FNAMES=OUT,BUILD=(1,35)                                                   
/*                                                                     


OUT contains
Code:
1001 M0 M1 M2 M3 M4 M5 M6 M7 M8 M9
1002 M1 M4                       
1003 M4
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 Feb 02, 2008 9:41 pm    Post subject:
Reply with quote

Here's a slightly simpler version of the DFSORT/ICETOOL job:

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN1      DD *
1001 M0
1001 M1
1001 M2
1001 M3
1001 M4
1001 M5
1001 M6
1001 M7
1001 M8
1001 M9
1002 M1
1002 M4
1003 M4
/*
//OUT      DD SYSOUT=*
//TOOLIN   DD *
SPLICE FROM(IN1) TO(OUT) ON(1,4,CH) KEEPNODUPS -
 WITHEACH WITH(9,3) WITH(12,3) WITH(15,3) WITH(18,3) WITH(21,3) -
 WITH(24,3) WITH(27,3) WITH(30,3) WITH(33,3) USING(CTL1)
/*
//CTL1CNTL DD   *
  INREC IFTHEN=(WHEN=INIT,
          OVERLAY=(1,8,81:SEQNUM,3,ZD,RESTART=(1,4))),
    IFTHEN=(WHEN=(81,3,ZD,EQ,+2),OVERLAY=(9:6,3)),
    IFTHEN=(WHEN=(81,3,ZD,EQ,+3),OVERLAY=(12:6,3)),
    IFTHEN=(WHEN=(81,3,ZD,EQ,+4),OVERLAY=(15:6,3)),
    IFTHEN=(WHEN=(81,3,ZD,EQ,+5),OVERLAY=(18:6,3)),
    IFTHEN=(WHEN=(81,3,ZD,EQ,+6),OVERLAY=(21:6,3)),
    IFTHEN=(WHEN=(81,3,ZD,EQ,+7),OVERLAY=(24:6,3)),
    IFTHEN=(WHEN=(81,3,ZD,EQ,+8),OVERLAY=(27:6,3)),
    IFTHEN=(WHEN=(81,3,ZD,EQ,+9),OVERLAY=(30:6,3)),
    IFTHEN=(WHEN=(81,3,ZD,EQ,+10),OVERLAY=(33:6,3))
  OUTFIL FNAMES=OUT,BUILD=(1,35)
/*
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 Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm
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 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
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am

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