## problem with splice (icetool)

IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

### problem with splice (icetool)

I would like to combine the records with the same key (1,5), so my out must be:
AAAAA123
BBBBB12
CCCCC21

This is my step:

//ICETOO   EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//SHOWDEF  DD SYSOUT=*
//IN       DD *
AAAAA1
AAAAA2
AAAAA3
BBBBB1
BBBBB2
CCCCC2
CCCCC1
//T1       DD DSN=DES.DESBCJ.ICETOO.TEMP,
//           DISP=(MOD,CATLG,DELETE),
//           SPACE=(TRK,(100,50),RLSE)
//OUT      DD DISP=(,CATLG),SPACE=(TRK,(100,50),RLSE),
//            DSN=DES.DESBCJ.ICETOO.FINAL
//TOOLIN   DD *
SORT FROM(IN) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,5,CH) WITHEACH -
WITH(6,1) WITH(7,1) WITH(8,1)
/*
//CTL2CNTL DD *
OPTION EQUALS
SORT FIELDS=(1,5,CH,A)
OUTREC IFOUTLEN=8,
IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,2,ZD,RESTART=(1,5))),
IFTHEN=(WHEN=(81,2,ZD,EQ,+1),BUILD=(1,5,6:6,1)),
IFTHEN=(WHEN=(81,2,ZD,EQ,+2),BUILD=(1,5,7:6,1)),
IFTHEN=(WHEN=(81,2,ZD,EQ,+3),BUILD=(1,5,8:6,1))
//

But this step doesn´t work for me, this is the out I get:
AAAAA
BBBBB
CCCCC

And this is the content of T1:
AAAAA1
AAAAA 2
AAAAA  3
BBBBB1
BBBBB 2
CCCCC2
CCCCC 1

T1 is ok for the splice, why splice doesn´t give me the out I need

sorry i m spanish and my english is poor...

thanks like always!!
ottoelflaco

Posts: 36
Joined: Fri Sep 21, 2012 2:33 pm
Has thanked: 1 time
Been thanked: 0 time

### Re: problem with splice (icetool)

From the DFSORT Application Programming Guide:

WITHEACH
Specifies that the first duplicate is spliced with one specified field from each subsequent duplicate. One WITH field (nonblank or blank) from each overlay
record is overlaid on to the base record. The first WITH field specifies the bytes to be overlaid from the second duplicate record on to the first duplicate record. The second WITH field specifies the bytes to be overlaid from the third duplicate record on to the first duplicate record, and so on.

Try removing the WITH(6,1), or look at using WITHANY.
BillyBoyo
Global moderator

Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

### Re: problem with splice (icetool)

BillyBoyo wrote:From the DFSORT Application Programming Guide:

WITHEACH
Specifies that the first duplicate is spliced with one specified field from each subsequent duplicate. One WITH field (nonblank or blank) from each overlay
record is overlaid on to the base record. The first WITH field specifies the bytes to be overlaid from the second duplicate record on to the first duplicate record. The second WITH field specifies the bytes to be overlaid from the third duplicate record on to the first duplicate record, and so on.

Try removing the WITH(6,1), or look at using WITHANY.

Thank you very much, BillyBoyo!
This!
ottoelflaco

Posts: 36
Joined: Fri Sep 21, 2012 2:33 pm
Has thanked: 1 time
Been thanked: 0 time

### Re: problem with splice (icetool)

now I have other problem is, if I have IN=
AAAAA1
AAAAA2
AAAAA3
BBBBB1
BBBBB2
CCCCC2
CCCCC1
DDDDD1

DDDDD1 is not printed in out file...
_---
EDIT. KEEPNODUPS was neccesary

SPLICE FROM(T1) TO(OUT) ON(1,5,CH) WITHEACH KEEPNODUPS -
WITH(7,1) WITH(8,1)

Thank you again!.
ottoelflaco

Posts: 36
Joined: Fri Sep 21, 2012 2:33 pm
Has thanked: 1 time
Been thanked: 0 time