Portal | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Developer


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 Read 4MB message and split into multi... myselfsk15 COBOL Programming 8 Fri Sep 25, 2020 7:24 am
No new posts Group selective VB records - Trailer ... Premnath_TJ DFSORT/ICETOOL 12 Sun Sep 13, 2020 3:38 am
This topic is locked: you cannot edit posts or make replies. SORT the records based on the second ... Ramsee SYNCSORT 1 Wed Aug 19, 2020 3:01 pm
No new posts to Insert Rows from File1 to File 2 ... Arun_Tupili DFSORT/ICETOOL 1 Thu Aug 13, 2020 6:22 pm
No new posts Multiple Sums in one File Rick Ryan SYNCSORT 2 Wed Jul 29, 2020 1:30 am

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