IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

XSUM, remove records with two fields as same in subsequent


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rackshit

New User


Joined: 19 Dec 2009
Posts: 16
Location: Mumbai

PostPosted: Fri Dec 25, 2009 12:19 pm
Reply with quote

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
View user's profile Send private message
karthi_ind

Active User


Joined: 24 Feb 2004
Posts: 131
Location: Chennai

PostPosted: Mon Dec 28, 2009 2:02 pm
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Dec 28, 2009 2:38 pm
Reply with quote

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
Code:
CCC 1234 123
?
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Dec 28, 2009 2:43 pm
Reply with quote

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
View user's profile Send private message
karthi_ind

Active User


Joined: 24 Feb 2004
Posts: 131
Location: Chennai

PostPosted: Mon Dec 28, 2009 4:48 pm
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Dec 28, 2009 5:20 pm
Reply with quote

Hi Karthik,

ah...was being little hyperbolic actually, nothing much. Just ignore that text... icon_smile.gif

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
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Tue Dec 29, 2009 12:39 am
Reply with quote

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
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Tue Dec 29, 2009 1:20 am
Reply with quote

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
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Tue Dec 29, 2009 1:44 am
Reply with quote

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
View user's profile Send private message
rackshit

New User


Joined: 19 Dec 2009
Posts: 16
Location: Mumbai

PostPosted: Fri Jan 01, 2010 4:47 pm
Reply with quote

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
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Mon Jan 04, 2010 9:18 pm
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Jan 05, 2010 1:59 pm
Reply with quote

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" ... icon_eek.gif ...

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 icon_neutral.gif
Back to top
View user's profile Send private message
rackshit

New User


Joined: 19 Dec 2009
Posts: 16
Location: Mumbai

PostPosted: Tue Jan 12, 2010 2:03 am
Reply with quote

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" ... icon_eek.gif ...

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 icon_neutral.gif


ohhh .. i meant desired output of SORTXSUM as output... thnx for pointing it out.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Jan 12, 2010 2:33 pm
Reply with quote

Well, did you get the solution to your problem?
Back to top
View user's profile Send private message
rackshit

New User


Joined: 19 Dec 2009
Posts: 16
Location: Mumbai

PostPosted: Tue Jan 12, 2010 2:37 pm
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Jan 12, 2010 2:38 pm
Reply with quote

Fine...have a nice day ahead...
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Remove leading zeroes SYNCSORT 4
No new posts Join multiple records using splice DFSORT/ICETOOL 5
Search our Forums:

Back to Top