|
View previous topic :: View next topic
|
| Author |
Message |
rackshit
New User
Joined: 19 Dec 2009 Posts: 16 Location: Mumbai
|
|
|
|
Hi,
Using XSUM in Syncsort I'm able to remove records with one duplicate fileds of particular column but not able to put conditions for two fields of two corresponding columns.
for eg:
i/p
AAA 1234 456
AAA 1234 678
BBB 3237 343
AAA 4567 345
BBB 7890 456
BBB 7890 234
CCC 1234 123
currently getting output as
AAA 1234 456
AAA 1234 678
AAA 4567 345
BBB 7890 456
BBB 7890 234
BBB 3237 343
current sort card
| Code: |
SORT FIELDS=(1,3,CH,A)
SUM FIELDS=NONE,XSUM |
whereas the desired output is
AAA 1234 456
AAA 1234 678
BBB 7890 456
BBB 7890 234
what will be the sort cards for the above desired output.
im using fixed record format and lrecl = 40 |
|
| Back to top |
|
 |
karthi_ind
Active User
.jpg)
Joined: 24 Feb 2004 Posts: 131 Location: Chennai
|
|
|
|
Hi rackshit,
you can try this
SORT FIELDS=(1,8,CH,A)
SUM FIELDS=NONE,XSUM
Correct me If I am wrong...
Thanks
Karthik |
|
| Back to top |
|
 |
Anuj Dhawan
Superior Member

Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
rackshit,
There are enough loose ends in your post.
1. With the input and the sort card you show, you'll get the following output:
| Code: |
AAA 1234 456
BBB 3237 343
CCC 1234 123 |
2. Sort-card you show, masks the fields from position 1 to 3 then how did the shown output does not contain the record
? |
|
| Back to top |
|
 |
Anuj Dhawan
Superior Member

Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
Karthik,
With your suggestion output will be (ofcourse when given input is used)
| Code: |
AAA 1234 456
AAA 4567 345
BBB 3237 343
BBB 7890 456
CCC 1234 123 |
which is not what is expcted. This is a festive season and I don't want to sound harsh but you are wrong. |
|
| Back to top |
|
 |
karthi_ind
Active User
.jpg)
Joined: 24 Feb 2004 Posts: 131 Location: Chennai
|
|
|
|
Hi Anuj,
Thanks for correcting this, I clearly mentioned that correct me If I am wrong in my post.
I am wondering that for answering this you have mentioned that
"this is a festive season and you don't want to sound harsh"
What you mean this ? |
|
| Back to top |
|
 |
Anuj Dhawan
Superior Member

Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
Hi Karthik,
ah...was being little hyperbolic actually, nothing much. Just ignore that text...
I belive rackshit should tell us the rules to get the output; I, for one, is not really sure - how did he get the shown output from the given input? |
|
| Back to top |
|
 |
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
Rackshit,
If I understand you correctly, you are trying to produce only the records that have a duplicate for the first 8 bytes. Is that correct? |
|
| Back to top |
|
 |
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
Based on your input data, here is one solution that will produce your requested output:
| Code: |
//STEP1 EXEC PGM=SORT
//SORTIN DD DISP=SHR,DSN=input.data
//SORTXDUP DD DISP=(NEW,PASS),DSN=&&XDUP
//SORTOF01 DD DISP=(NEW,PASS),DSN=&&OUT1
//SYSOUT DD SYSOUT=*
//SYSIN DD *
INREC OVERLAY=(81:X'F1')
SORT FIELDS=(1,8,CH,A)
DUPKEYS SUM=(81,1,ZD),XDUP
OUTFIL FILES=01,INCLUDE=(81,1,ZD,GT,1)
/*
//STEP2 EXEC PGM=SORT
//SORTIN01 DD DSN=&&XDUP,DISP=SHR
//SORTIN02 DD DSN=&&OUT1,DISP=SHR
//SORTOUT DD DSN=FINAL.OUTPUT
//SYSOUT DD SYSOUT=*
//SYSIN DD *
INREC BUILD=(1,80)
MERGE FIELDS=(1,8,CH,A)
/* |
I may have another alternative for you shortly. |
|
| Back to top |
|
 |
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
Here is another possible solution:
| Code: |
//SORT1 EXEC PGM=SORT
//SORTIN DD DISP=SHR,DSN=ORIGINAL.INPUT
//SORTOUT DD DSN=&&OUT1,UNIT=SYSDA,SPACE=(TRK,1),DISP=(NEW,PASS)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
INREC FIELDS=(1,8,1C'0001')
SORT FIELDS=(1,8,CH,A)
DUPKEYS SUM=(9,4,ZD)
OUTFIL OMIT=(9,4,ZD,EQ,1),OUTREC=(1,8)
/*
//STEP2 EXEC PGM=SORT
//SORTJNF1 DD DISP=SHR,DSN=ORIGINAL.INPUT
//SORTJNF2 DD DSN=&&OUT1,DISP=SHR
//SORTOUT DD DSN=FINAL.OUTPUT
//SYSOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(1,8,A)
JOINKEYS FILE=F2,FIELDS=(1,8,A),SORTED
REFORMAT FIELDS=(F1:1,80)
SORT FIELDS=COPY
/* |
|
|
| Back to top |
|
 |
rackshit
New User
Joined: 19 Dec 2009 Posts: 16 Location: Mumbai
|
|
|
|
Hi friends,
Thanks for your inputs on this. And sorry for delayed response.
my following ouput which i said in my first post is wrong. i made a mistake over there.
| Quote: |
AAA 1234 456
AAA 1234 678
AAA 4567 345
BBB 7890 456
BBB 7890 234
BBB 3237 343 |
instead the output will be
| Quote: |
AAA 1234 678
AAA 4567 345
BBB 7890 456
BBB 7890 234 |
I modified my requirement a bit to get on with my implementations and finally i had made it. I used the following sort card
| Code: |
SORT FIELDS=(1,03,CH,A,5,4,CH,A)
SUM FIELDS=NONE,XSUM |
so with this sort card i get the following output
| Quote: |
AAA 1234 678
BBB 7890 234 |
i changed my program according to this output for my implementation. My basic aim was to get records which all have idnetical 1st and 2nd fields columnwise . And this gets implemented with the above sort card.
Alissa,
Since I'm not well aware of sort cards I got U0016 for the following sort card
| Code: |
INREC FIELDS=(1,8,1C'0001')
SORT FIELDS=(1,8,CH,A)
DUPKEYS SUM=(9,4,ZD)
OUTFIL OMIT=(9,4,ZD,EQ,1),OUTREC=(1,8) |
Could you let me know how should i modify the parameters to get desired output.
Thanks all. |
|
| Back to top |
|
 |
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
| U0016 does not tell me what the error is. Please identify your SyncSort release and show me the SyncSort critical error message (WERnnnA) that posted in SYSOUT. It may simply be that you are running an older version of SyncSort that does not support DUPKEYS. |
|
| Back to top |
|
 |
Anuj Dhawan
Superior Member

Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
On ther other hand, what you show as output here
| rackshit wrote: |
| Quote: |
AAA 1234 456
AAA 1234 678
AAA 4567 345
BBB 7890 456
BBB 7890 234
BBB 3237 343 |
instead the output will be
| Quote: |
AAA 1234 678
AAA 4567 345
BBB 7890 456
BBB 7890 234 |
I modified my requirement a bit to get on with my implementations and finally i had made it. I used the following sort card
| Code: |
SORT FIELDS=(1,03,CH,A,5,4,CH,A)
SUM FIELDS=NONE,XSUM |
so with this sort card i get the following output
| Quote: |
AAA 1234 678
BBB 7890 234 |
|
is actually the "duplicate records in DSN associated with DDName SORTXSUM" ... ...
In problems where you want to use some sort-product, usual perception is - when you say "output" you are actully talking about SORTOUT ddname and not any other ddname. And if it is some other ddname, one must mention it explicitly (at least this is my perception... )
..amen, will we survive in IT  |
|
| Back to top |
|
 |
rackshit
New User
Joined: 19 Dec 2009 Posts: 16 Location: Mumbai
|
|
|
|
| Anuj Dhawan wrote: |
On ther other hand, what you show as output here
| rackshit wrote: |
| Quote: |
AAA 1234 456
AAA 1234 678
AAA 4567 345
BBB 7890 456
BBB 7890 234
BBB 3237 343 |
instead the output will be
| Quote: |
AAA 1234 678
AAA 4567 345
BBB 7890 456
BBB 7890 234 |
I modified my requirement a bit to get on with my implementations and finally i had made it. I used the following sort card
| Code: |
SORT FIELDS=(1,03,CH,A,5,4,CH,A)
SUM FIELDS=NONE,XSUM |
so with this sort card i get the following output
| Quote: |
AAA 1234 678
BBB 7890 234 |
|
is actually the "duplicate records in DSN associated with DDName SORTXSUM" ... ...
In problems where you want to use some sort-product, usual perception is - when you say "output" you are actully talking about SORTOUT ddname and not any other ddname. And if it is some other ddname, one must mention it explicitly (at least this is my perception... )
..amen, will we survive in IT  |
ohhh .. i meant desired output of SORTXSUM as output... thnx for pointing it out. |
|
| Back to top |
|
 |
Anuj Dhawan
Superior Member

Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
| Well, did you get the solution to your problem? |
|
| Back to top |
|
 |
rackshit
New User
Joined: 19 Dec 2009 Posts: 16 Location: Mumbai
|
|
|
|
| Anuj Dhawan wrote: |
| Well, did you get the solution to your problem? |
Hey Anuj,
I have already mentioned it above.
| Quote: |
I modified my requirement a bit to get on with my implementations and finally i had made it. |
|
|
| Back to top |
|
 |
Anuj Dhawan
Superior Member

Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
| Fine...have a nice day ahead... |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|