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
 

 

combining multiple records into one using ICETOOL or DFSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: combining multiple records into one using ICETOOL or DFSORT
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 Moderator


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

PostPosted: Sat Aug 11, 2007 8:43 pm    Post subject:
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    Post subject:
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    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 Using ICETOOL, how we can seperate th... bshkris SYNCSORT 5 Tue May 09, 2017 8:33 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 Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. SDSF multiple spool datasets extracte... PJAlarcon CLIST & REXX 1 Fri Apr 21, 2017 10:50 pm
No new posts Group elements using ICETOOL Learncoholic DFSORT/ICETOOL 2 Fri Apr 14, 2017 11:01 am


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