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 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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts ejck thru rexx to multiple jobs insid... Susanta All Other Mainframe Topics 5 Tue Sep 19, 2017 1:39 pm
No new posts PLI - printing from multiple programs Pedro PL/I & Assembler 8 Fri Sep 08, 2017 6:36 am

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