Copying Distinct Records



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

Copying Distinct Records

Postby shiitiizz » Mon Dec 17, 2012 6:55 pm

Hi All,

I need help with below Sort:
Input data will be of this format:

"1234"||"567"||"gtyhjgdgh"||" " ||" " ||"y"||
"4"||"5"||"hj8bjh"||" "||" " ||"y"||
"4"||"6"||"hj8bjh"||" "||" " ||"y"||
"1"||"7"||"98bjh"||" "||" " ||"y"||
"9"||"6"||"gtyhh"||" " ||"Y " ||"y"||
"4"||"4"||"hj8bjh"||" "||" " ||"y"||


and o/p should be
1234
4
1
9


i.e. it should eliminate the " and || and should also stop copying when it hits | in the first line and move to next line.

With FINDREP option I am able to remove " and || but how to stop copying once it has encountered | and move copy to next line.

//STEP0001 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=FILE1,DISP=SHR
//SORTOUT DD DSN=FILE2,DISP=SHR
//SYSIN DD *
OPTION COPY
INREC FINDREP=(INOUT=(C'"',C'',C'|',C''))

is giving me

1234567GTYHJGDGH    Y 
45HJ8BJH   Y           
46HJ8BJH   Y           
1798BJH   Y           
96GTYHH  Y  Y         
44HJ8BJH   Y         


which is working as FINDREP is coded.

Regards..
shiitiizz
 
Posts: 15
Joined: Thu Dec 06, 2012 2:30 pm
Has thanked: 3 times
Been thanked: 0 time

Re: Copying Distinct Records

 

Re: Copying Distinct Records

Postby Pandora-Box » Mon Dec 17, 2012 9:09 pm

Why nor use PARSE ? If it supports your level
User avatar
Pandora-Box
 
Posts: 65
Joined: Fri Feb 10, 2012 8:30 pm
Location: Mars
Has thanked: 3 times
Been thanked: 6 times

Re: Copying Distinct Records

Postby shiitiizz » Mon Dec 17, 2012 9:12 pm

Hi All,

A small update:

I used PARSE to edit the data required, ( have removed quotes from i/p file using FINDREP in STEP001)...this is
working fine...
//STEP0002 EXEC  PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD DSN=FILE1,DISP=SHR                         
//SORTOUT  DD DSN=FILE2,DISP=SHR                         
//SYSIN    DD *                                         
        INREC PARSE=(%01=(ENDBEFR=C'|',FIXLEN=16)),     
        BUILD=(1:%01)                                   
        SORT FIELDS=(1,16,FI,A)                           
        SUM FIELDS=NONE                                 
//*                                                     


Where File1 looks like
----+----1----+----2----+----3----+----4-
1234||567||GTYHJGDGH||  ||  ||Y||       
4||5||HJ8BJH|| ||  ||Y||                 
4||6||HJ8BJH|| ||  ||Y||                 
1||7||98BJH|| ||  ||Y||                 
9||6||GTYHH||  ||Y  ||Y||               
4||4||HJ8BJH|| ||  ||Y||                 


and File 2 as
----+----1---
1           
1234         
4           
9           


However, the SORT FIELDS=(1,16,FI,A) is not working as I expected..
The result I was expecting was
1
4
9
1234

and am getting is
1
1234
4
9

Kindly correct me where I am going wrong.
shiitiizz
 
Posts: 15
Joined: Thu Dec 06, 2012 2:30 pm
Has thanked: 3 times
Been thanked: 0 time

Re: Copying Distinct Records

Postby dick scherrer » Mon Dec 17, 2012 11:25 pm

Hello,

Suggest you use UFF.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Copying Distinct Records

Postby skolusu » Tue Dec 18, 2012 4:19 am

use the following DFSORT JCL which will give you the desired results

//STEP0100 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD *                                                       
"1234"||"567"||"GTYHJGDGH"||" " ||" " ||"Y"||                         
"4"||"5"||"HJ8BJH"||" "||" " ||"Y"||                                 
"4"||"6"||"HJ8BJH"||" "||" " ||"Y"||                                 
"1"||"7"||"98BJH"||" "||" " ||"Y"||                                   
"9"||"6"||"GTYHH"||" " ||"Y " ||"Y"||                                 
"4"||"4"||"HJ8BJH"||" "||" " ||"Y"||                                 
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                       
  INREC PARSE=(%01=(STARTAFT=C'"',ENDBEFR=C'"',FIXLEN=16)),BUILD=(%01)
  SORT FIELDS=(1,16,UFF,A)                                           
  SUM FIELDS=NONE                                                     
//*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

These users thanked the author skolusu for the post:
shiitiizz (Tue Dec 18, 2012 12:45 pm)
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Copying Distinct Records

Postby shiitiizz » Tue Dec 18, 2012 12:46 pm

Thanks Kolusu .. It worked ! I got my mistake :-/
Cheers :)
shiitiizz
 
Posts: 15
Joined: Thu Dec 06, 2012 2:30 pm
Has thanked: 3 times
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post