IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

combining multiple records into one using ICETOOL or DFSORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ykishor
Currently Banned

New User


Joined: 11 Aug 2007
Posts: 24
Location: my pc

PostPosted: Sat Aug 11, 2007 12:21 pm
Reply with quote

Hi!

I have a file which has 2 fields in each record. Lets say FIELD1 and FIELD2. Now FIELD1 can have multiple occurances in the file but for each occurance of FIELD1, FIELD2 has a different value.
Now my requirement is to have an o/p file having only one occurance of FIELD1 and all the values of FIELD2 concataneted into one record.It can be easily learnt that o/p file will be of variable length. e.g.

Code:

FIELD1  FIELD2
abc       a12
abc       b34
pqr       x56
pqr       z78
pqr       h23


o/p as

Code:

abc    a12 b34
pqr    x56 z78 h23


Can this be done using ICETOOL or DFSORT?

Thanks
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Sat Aug 11, 2007 8:43 pm
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed the maximum number of occurrences for FIELD1 is 5 but you can change the job appropriately for a different maximum. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=...  input file (FB/80)
//OUT DD DSN=...  output file (FB/80)
//TOOLIN   DD    *
SPLICE FROM(IN) TO(OUT) ON(1,3,CH) KEEPNODUPS -
 WITHEACH WITH(12,3) WITH(16,3) WITH(20,3) WITH(24,3) USING(CTL1)
/*
//CTL1CNTL DD *
  INREC IFOUTLEN=80,
    IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,3))),
    IFTHEN=(WHEN=(81,8,ZD,EQ,1),BUILD=(1,3,8:11,3)),
    IFTHEN=(WHEN=(81,8,ZD,EQ,2),BUILD=(1,3,12:11,3)),
    IFTHEN=(WHEN=(81,8,ZD,EQ,3),BUILD=(1,3,16:11,3)),
    IFTHEN=(WHEN=(81,8,ZD,EQ,4),BUILD=(1,3,20:11,3)),
    IFTHEN=(WHEN=(81,8,ZD,EQ,5),BUILD=(1,3,24:11,3))
/*
Back to top
View user's profile Send private message
ykishor
Currently Banned

New User


Joined: 11 Aug 2007
Posts: 24
Location: my pc

PostPosted: Sun Aug 12, 2007 12:14 am
Reply with quote

Thanks a lot icon_biggrin.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top