Merge records using SPLICE



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

Merge records using SPLICE

Postby nikesh_rai » Mon Mar 11, 2013 8:11 pm

Hi,

I am trying to merge two recs from the same input file using SPLICE. My input is:

9 WXXX-BAA-ID                     GROUP          3      1      19      19
  12 WXXX-UAA-BAA-ID              GROUP          4      1      19      19
    15 WXXX-EAAAA-ID              GROUP          5      1      16      16
      18 WXXX-EAAAA-FAAA-IAAAAA                                             0001  0001
                                  X(8)           6      1       8       8   0001  0002
      18 WXXX-EAAAA-RAA-SAA-NAA                                             0002  0001
                                  9(8)           7      9      16       8   0002  0002
    15 WXXX-BAA-SAA-NAA           S9(4)          8     17      19       3


and my expected out put is:

9 WXXX-BAA-ID                     GROUP          3      1      19      19
  12 WXXX-UAA-BAA-ID              GROUP          4      1      19      19
    15 WXXX-EAAAA-ID              GROUP          5      1      16      16
      18 WXXX-EAAAA-FAAA-IAAAAA   X(8)           6      1       8       8
      18 WXXX-EAAAA-RAA-SAA-NAA   9(8)           7      9      16       8
    15 WXXX-BAA-SAA-NAA           S9(4)          8     17      19       3
 


but the output is coming as

9 WXXX-BAA-ID                     GROUP          3      1      19      19
  12 WXXX-UAA-BAA-ID              GROUP          4      1      19      19
    15 WXXX-EAAAA-ID              GROUP          5      1      16      16
                                  X(8)           6      1       8       8
                                  9(8)           7      9      16       8
 


My code is :

//STEP003  EXEC PGM=ICETOOL                                    
//INDD     DD DISP=SHR,DSN=&&TEMP02                            
//OUTDD    DD SYSOUT=*                                        
//TOOLMSG  DD SYSOUT=*                                        
//DFSMSG   DD SYSOUT=*                                        
//SYSPRINT DD SYSOUT=*                                        
//SYSOUT   DD SYSOUT=*                                        
//TOOLIN   DD *                                                
  SPLICE FROM(INDD) TO(OUTDD) ON(81,4,CH) WITHALL KEEPNODUPS -
         WITH(1,39) WITH(40,40) USING(CTL1)                    
//CTL1CNTL DD *                                                
  OPTION COPY                                                  
  INREC IFTHEN=(WHEN=(86,4,ZD,EQ,0001),OVERLAY=(01:01,39)),    
        IFTHEN=(WHEN=(86,4,ZD,EQ,0002),OVERLAY=(40:40,39))    
  OUTFIL BUILD=(1:1,39,40:40,40)
/*                              


I am using this ICETOOL first time.. so cannot identify where is the issue here in this code..

Billy.. I checked your link as well..

dfsort-icetool-icegener/topic7483.html#p34164

and got what needs to be done.. but still its not working..

Can you please suggest me on this..
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 205
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: Merge records using SPLICE

Postby BillyBoyo » Tue Mar 12, 2013 7:03 pm

First, can you confirm whether you are using DFSORT or SyncSort, please?

SPLICE is complex. With what you have shown, it takes me too much time to understand what you are trying to do. Can you include more explanation?

You can "pass" data from one record to the next with WHEN=GROUP and PUSH. Did you consider that approach?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Merge records using SPLICE

Postby nikesh_rai » Tue Mar 12, 2013 8:42 pm

Thanks Billy..

Its DFSORT, I have checked with When=Group.. and used SPLICE as well its working now..

Here is the code for ref:

//STEP004  EXEC PGM=ICETOOL                                           
//INDD     DD DISP=SHR,DSN=&&TEMP03                                   
//OUT01    DD DSN=&&TMP1,DISP=(NEW,PASS),SPACE=(TRK,(10,10),RLSE),     
//            UNIT=SYSDA,DCB=(*.INDD)                                 
//OUT02    DD DSN=&&TMP2,DISP=(NEW,PASS),SPACE=(TRK,(10,10),RLSE),     
//            UNIT=SYSDA,DCB=(*.INDD)                                 
//OUT03    DD DSN=&&TMP3,DISP=(NEW,PASS),SPACE=(TRK,(10,10),RLSE),     
//            UNIT=SYSDA,DCB=(*.INDD)                                 
//*OUTDD    DD DSN=DPFCB.D393990.LAYOUT.FMTD,                         
//*            DISP=(OLD,CATLG,DELETE),SPACE=(TRK,(10,10),RLSE),       
//*            UNIT=SYSDA,DCB=(*.INDD)                                 
//*OUT03    DD SYSOUT=*                                               
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//SYSPRINT DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//TOOLIN   DD *                                                       
  COPY FROM(INDD) TO(OUT01) USING(CTL1)                               
  COPY FROM(INDD) TO(OUT02) USING(CTL2)                               
  SPLICE FROM(OUT02) TO(OUT03) ON(81,4,ZD) WITH(40,40) KEEPNODUPS     
//CTL1CNTL DD *                                                       
  OPTION COPY                                                         
  INCLUDE COND=(86,4,CH,EQ,C' ')                                     
//CTL2CNTL DD *                                                       
  OPTION COPY                                                         
  INCLUDE COND=(86,4,CH,NE,C' ')


I have used when=group just before this step.. to identify the double line records as a single record for processing.. It is working as per expectation.. :)
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 205
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: Merge records using SPLICE

Postby skolusu » Wed Mar 13, 2013 5:34 am

nikesh_rai wrote:Thanks Billy..

Its DFSORT, I have checked with When=Group.. and used SPLICE as well its working now.. have used when=group just before this step.. to identify the double line records as a single record for processing.. It is working as per expectation.. :)


Can I please see the sysout from the above Job you just ran?

Thank you.
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Merge records using SPLICE

Postby nikesh_rai » Wed Mar 13, 2013 11:43 am

ya here it is:

9 WXXX-BAA-ID                     GROUP          3      1      19      19
  12 WXXX-UAA-BAA-ID              GROUP          4      1      19      19
    15 WXXX-EAAAA-ID              GROUP          5      1      16      16
      18 WXXX-EAAAA-FAAA-IAAAAA   X(8)           6      1       8       8
      18 WXXX-EAAAA-RAA-SAA-NAA   9(8)           7      9      16       8
    15 WXXX-BAA-SAA-NAA           S9(4)          8     17      19       3
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 205
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: Merge records using SPLICE

Postby NicC » Wed Mar 13, 2013 11:51 am

That is NOT sysout. Sysout contains the DFSort messages produced in the run.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Merge records using SPLICE

Postby nikesh_rai » Wed Mar 13, 2013 12:02 pm

oK..here is the DFSMSG and TOOLMSG:

TOOLMSG:

ICE600I 0 DFSORT ICETOOL UTILITY RUN STARTED                                   
                                                                               
ICE650I 0 VISIT http://www.ibm.com/storage/dfsort FOR ICETOOL PAPERS, EXAMPLES A
                                                                               
ICE632I 0 SOURCE FOR ICETOOL STATEMENTS:  TOOLIN                               
                                                                               
                                                                               
ICE630I 0 MODE IN EFFECT:  STOP                                                 
                                                                               
            COPY FROM(INDD) TO(OUT01) USING(CTL1)                               
ICE606I 0 DFSORT CALL 0001 FOR COPY  FROM INDD     TO OUT01    USING CTL1CNTL CO
ICE602I 0 OPERATION RETURN CODE:  00                                           
                                                                               
            COPY FROM(INDD) TO(OUT02) USING(CTL2)                               
ICE606I 0 DFSORT CALL 0002 FOR COPY  FROM INDD     TO OUT02    USING CTL2CNTL CO
ICE602I 0 OPERATION RETURN CODE:  00                                           
                                                                               
            SPLICE FROM(OUT02) TO(OUT03) ON(81,4,ZD) WITH(40,40) KEEPNODUPS     
ICE627I 0 DFSORT CALL 0003 FOR SORT FROM OUT02    TO OUT03    COMPLETED       
ICE628I 0 RECORD COUNT:  000000000000356                                     
ICE638I 0 NUMBER OF RECORDS RESULTING FROM CRITERIA:  000000000000178         
ICE602I 0 OPERATION RETURN CODE:  00                                         
                                                                             
                                                                             
ICE601I 0 DFSORT ICETOOL UTILITY RUN ENDED - RETURN CODE:  00


DFSMSG is too huge.. do you want DFSMSG as well.. ??
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 205
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: Merge records using SPLICE

Postby nikesh_rai » Wed Mar 13, 2013 12:22 pm

One more issue is there..

I have added one more step to format the record...

SORT FIELDS=(91,4,CH,A)   
INREC IFTHEN=(WHEN=INIT,OVERLAY=(1,39,SQZ=(SHIFT=LEFT)))
OUTREC PARSE=(%01=(ABSPOS=1,STARTAT=C'W',FIXLEN=35)),   
       BUILD=(1:%01,40,40)           


I am not getting what is the problem with STARTAT here. SYSOUT is coming as blank.. but when I used ENDBEFR=C' ', It was working. actaully I don't want these numbers here:

9 WXXX-BAA-ID                     GROUP          3      1      19      19
  12 WXXX-UAA-BAA-ID              GROUP          4      1      19      19
    15 WXXX-EAAAA-ID              GROUP          5      1      16      16
      18 WXXX-EAAAA-FAAA-IAAAAA   X(8)           6      1       8       8
      18 WXXX-EAAAA-RAA-SAA-NAA   9(8)           7      9      16       8
    15 WXXX-BAA-SAA-NAA           S9(4)          8     17      19       3         


and expecting output as:

WXXX-BAA-ID                     GROUP          3      1      19      19
WXXX-UAA-BAA-ID                 GROUP          4      1      19      19
WXXX-EAAAA-ID                   GROUP          5      1      16      16
WXXX-EAAAA-FAAA-IAAAAA          X(8)           6      1       8       8
WXXX-EAAAA-RAA-SAA-NAA          9(8)           7      9      16       8
WXXX-BAA-SAA-NAA                S9(4)          8     17      19       3


is there anything wrong with the STARTAT.. ??
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 205
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: Merge records using SPLICE

Postby nikesh_rai » Wed Mar 13, 2013 8:35 pm

I am not getting what is the problem with STARTAT here. SYSOUT is coming as blank.. but when I used ENDBEFR=C' ', It was working. actaully I don't want these numbers here:


its working now.. :x
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 205
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: Merge records using SPLICE

Postby BillyBoyo » Wed Mar 13, 2013 8:45 pm

Thanks for letting us know. What is the ABSPOS=1 doing for you?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Next

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post