View previous topic :: View next topic
|
Author |
Message |
Aham
New User
Joined: 24 Oct 2007 Posts: 42 Location: chennai
|
|
|
|
Hi My Input file has a LRECL 80 and RECFM FB. I have to check whether records has a particular field as duplicate and if so I need to include all of them in a dataset.
Input
Code: |
____5____0____5____0
ANYTHING BLUE STREET
SMETHING RED CITY
DIFFTHNG BLUE COUNTRY
|
Here say my second field starting from position 10 is the deciding field. So Now Record 1 and record 3 should contiasn same value 'BLUE' hence the records containing them would be considered duplicate and I want both of these records in an output dataset. Is that possible with Synctool? |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Here is the SYNCTOOL solution
Code: |
//*******************************************************
//GETMATCH EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
ANYTHING BLUE STREET
SMETHING RED CITY
----+----1----+----2----+----3----+----4----+----5----+--
DIFFTHNG BLUE CUNTRY
/*
//ALLDUP DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(ALLDUP) ON(10,4,CH) ALLDUPS
/*
//*
|
|
|
Back to top |
|
|
Aham
New User
Joined: 24 Oct 2007 Posts: 42 Location: chennai
|
|
|
|
krisprems
Thanks a lot. Your code worked fine. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
What if there was one more record?
Code: |
____5____0____5____0
ANYTHING BLUE STREET
SMETHING RED CITY
DIFFTHNG BLUE CUNTRY
ANOTHER ORANGE AVENUE
|
|
|
Back to top |
|
|
raak
Active User
Joined: 23 May 2006 Posts: 166 Location: chennai
|
|
|
|
Quote: |
Hello,
What if there was one more record? |
dick,
What is it that you were planning to convey??
Even if there is another record like what u showed, according to Krisprem's sortcard, the output should come fine with the duplicates being shown correctly. i.e. only records with BLUE in poistion 10-14 will come in the output.
Is there something between the lines that I am missing?? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
What is it that you were planning to convey?? |
If the data in the "color" field is not exactly a length of 3 or 4, the code will not work. . .
Notice the "overlap" of ORANGE with the prior records. Notice what would happen if the "color" field data was only 2 bytes long. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Quote: |
If the data in the "color" field is not exactly a length of 3 or 4, the code will not work. . .
|
Yes, code wont work in that scenario. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Aham,
If you have access to DFSORT, you can use the PARSE function in a DFSORT/ICETOOL job like the following. However, note that this won't work with Syncsort/SYNCTOOL since it doesn't support the PARSE function.
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
ANYTHING BLUE STREET
SMETHING RED CITY
ANY PURPLE PLAZA
MY PURPLE PEOPLEEATER
DIFFTHNG BLUE COUNTRY
ANOTHER ORANGE AVENUE
/*
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(81,12,CH) ALLDUPS USING(CTL1)
/*
//CTL1CNTL DD *
INREC PARSE=(%=(ENDBEFR=BLANKS),
%01=(ENDBEFR=C' ',FIXLEN=12)),
OVERLAY=(81:%01)
OUTFIL FNAMES=OUT,BUILD=(1,80)
/*
|
For the example, OUT would have:
Code: |
ANYTHING BLUE STREET
DIFFTHNG BLUE COUNTRY
ANY PURPLE PLAZA
MY PURPLE PEOPLEEATER
|
|
|
Back to top |
|
|
Aham
New User
Joined: 24 Oct 2007 Posts: 42 Location: chennai
|
|
|
|
Thans a lot for the voluntary help by ll of you. My requirement is fixed and so I did nt have trouble using krisperms code . |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome
Thank you for letting us know.
d |
|
Back to top |
|
|
|