Problem with SPLICE to combine multiple records



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

Problem with SPLICE to combine multiple records

Postby coder7 » Tue Apr 12, 2011 7:12 pm

Have following input file 80 byte records. Any help appreciated thanks
0000000001
0000000002
0000000003
0000000004
0000000005
0000000006
0000000007
0000000008
0000000009
0000000010
0000000011

Want output file which is 80 bytes to look like the following:
Date 032211 ERROR REPORT PAGE 1
0000000001 0000000002 0000000003 0000000004 0000000005 0000000006 0000000007
0000000008 0000000009 0000000010 0000000011

Used following from posting example to assemble output rec but no success
//TOOLIN DD *                                             
  SPLICE FROM(IN) TO(OUT) ON(81,8,ZD) KEEPNODUPS WITHANY -
  WITH(12,11) WITH(23,11) WITH(34,11) WITH(45,11) -       
  WITH(56,11) WITH(67,11) -                               
  USING(CTL1)                                             
/*                                                       
//CTL1CNTL DD *                                           
   OPTION COPY                                           
   INREC IFOUTLEN=88,                                     
    IFTHEN=(WHEN=GROUP,RECORDS=7,PUSH=(81:ID=8,89:SEQ=1)),
    IFTHEN=(WHEN=(89,8,ZD,EQ,1),BUILD=(01:1,11,81:81,8)),
    IFTHEN=(WHEN=(89,8,ZD,EQ,2),BUILD=(12:1,11,81:81,8)),
    IFTHEN=(WHEN=(89,8,ZD,EQ,3),BUILD=(23:1,11,81:81,8)),
    IFTHEN=(WHEN=(89,8,ZD,EQ,4),BUILD=(34:1,11,81:81,8)),
    IFTHEN=(WHEN=(89,8,ZD,EQ,5),BUILD=(45:1,11,81:81,8)),
    IFTHEN=(WHEN=(89,8,ZD,EQ,6),BUILD=(56:1,11,81:81,8)),
    IFTHEN=(WHEN=(89,8,ZD,EQ,7),BUILD=(67:1,11,81:81,8)) 
    OUTFIL FNAMES=OUT,BUILD=(1,80)
coder7
 
Posts: 4
Joined: Tue Apr 12, 2011 2:15 am
Has thanked: 0 time
Been thanked: 0 time

Re: Problem with SPLICE to combine multiple records

Postby Frank Yaeger » Tue Apr 12, 2011 11:13 pm

The RESIZE operator of DFSORT's ICETOOL would be a better choice here than SPLICE. You can use a DFSORT/ICETOOL job like the following:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//IN DD *
0000000001
0000000002
0000000003
0000000004
0000000005
0000000006
0000000007
0000000008
0000000009
0000000010
0000000011
/*
//OUT DD SYSOUT=*
//TOOLIN DD *
RESIZE FROM(IN) TO(OUT) TOLEN(77) USING(CTL1)
//CTL1CNTL DD *
  INREC BUILD=(1,11)
  OUTFIL FNAMES=OUT,REMOVECC,
    HEADER2=('...'),
    OVERLAY=(80:X)
/*


For complete information on RESIZE, see:

http://www.ibm.com/support/docview.wss? ... g3T7000242
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: Problem with SPLICE to combine multiple records

Postby coder7 » Thu Apr 14, 2011 6:06 pm

Thanks you Sir, currently running 2008 DFSORT but support is upgrading to DFSORT V1R12 so resize will be available.
coder7
 
Posts: 4
Joined: Tue Apr 12, 2011 2:15 am
Has thanked: 0 time
Been thanked: 0 time

Re: Problem with SPLICE to combine multiple records

Postby coder7 » Thu Apr 21, 2011 2:08 am

Mr Yaeger can you provide a little insight with this problem. Resize not available as yet. I have come close to a solution making 5 passes using sort and icetool options of datasort, subset and splice.

Input file 80 byte fb can have from 2 to 1000 records with duplicates.
000000001
000000001
000000002
000000003
000000004
000000005
000000005
000000006
Want output file 80 byte fb no duplicates, to look like following to use as an insert for batch spufi
('000000001','000000002','000000003','000000004',
'000000005',000000006')

I get the data to this point but
('000000001',
('000000002',
('000000003',
('000000004',
('000000005,
('000000006',
then do the following to remove the leading ( on all but first record and replace last record trailing , with )
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT) LAST KEEP INPUT USING(CTL1)
SELECT FROM(IN) TO(OUT) ON(3,9,CH) LAST
/*
//CTL1CNTL DD *
INREC OVERLAY=(1,12,C')')
/*
however results are as follows: Next step is a splice which I have working. Any help is appreciated Thank you Sir
('000000001',
'000000002',
'000000002',
'000000004',
'000000005',
'000000006',
'000000006')
('000000001',
'000000002',
'000000003',
'000000004',
'000000005',
'000000006')
coder7
 
Posts: 4
Joined: Tue Apr 12, 2011 2:15 am
Has thanked: 0 time
Been thanked: 0 time

Re: Problem with SPLICE to combine multiple records

Postby Frank Yaeger » Thu Apr 21, 2011 3:36 am

Here's a 3-pass solution with DFSORT's ICETOOL:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/80)
//TOOLIN DD *
SELECT FROM(IN) TO(T1) ON(3,9,CH) FIRST USING(CTL1)
SPLICE FROM(T1) TO(T2) ON(81,8,ZD) KEEPNODUPS WITHEACH -
  WITH(14,12) WITH(26,12) WITH(38,12) USING(CTL2)
DATASORT FROM(T2) TO(OUT) TRAILER USING(CTL3)
/*
//CTL1CNTL DD *
  INREC BUILD=(C' ''',1,9,C''')',80:X)
  OUTFIL FNAMES=T1,
    IFTHEN=(WHEN=GROUP,RECORDS=4,PUSH=(81:ID=8,89:SEQ=1)),
    IFTHEN=(WHEN=(89,1,ZD,EQ,2),OVERLAY=(14:2,12)),
    IFTHEN=(WHEN=(89,1,ZD,EQ,3),OVERLAY=(26:2,12)),
    IFTHEN=(WHEN=(89,1,ZD,EQ,4),OVERLAY=(38:2,12))
/*
//CTL2CNTL DD *
  OPTION COPY
  OUTFIL FNAMES=T2,
   IFTHEN=(WHEN=INIT,
    FINDREP=(IN=C''')''',OUT=C''',''')),
   IFTHEN=(WHEN=(81,8,ZD,EQ,1),OVERLAY=(C'('))
/*
//CTL3CNTL DD *
  INREC FINDREP=(IN=C')',OUT=C',')
  SORT FIELDS=(81,8,ZD,A)
  OUTFIL FNAMES=OUT,BUILD=(1,80)
/*


It will produce your expected output for your input example.

For the following input with more records:

000000001     
000000001     
000000002     
000000003     
000000004     
000000005     
000000005     
000000006     
000000007     
000000008     
000000009     
000000010     
000000011     
000000012     
000000013     
000000014     
000000015


It will produce this output:

('000000001','000000002','000000003','000000004', 
 '000000005','000000006','000000007','000000008', 
 '000000009','000000010','000000011','000000012', 
 '000000013','000000014','000000015')             
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: Problem with SPLICE to combine multiple records

Postby coder7 » Thu Apr 21, 2011 8:44 pm

Mr Yaeger
Works as expected and I learned much from your expertise. Icetool is a fantastic utility and with your help I plan to become proficient in its use. Again, thanks for the solution and instruction.
Joe Coder7
coder7
 
Posts: 4
Joined: Tue Apr 12, 2011 2:15 am
Has thanked: 0 time
Been thanked: 0 time

Re: Problem with SPLICE to combine multiple records

Postby Frank Yaeger » Thu Apr 21, 2011 9:32 pm

I'm glad I could help and I'm happy to hear you like DFSORT's ICETOOL.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post