Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
One-One matching using SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
dearlux

New User


Joined: 10 Oct 2019
Posts: 2
Location: usa

PostPosted: Fri Oct 11, 2019 12:11 am    Post subject: One-One matching using SORT
Reply with quote

I have a file with the following 16 records

Field1 Field 2

A 1
B 1
C 1
D 1
A 2
B 2
C 2
D 2
A 3
B 3
C 3
D 3
A 4
B 4
C 4
D 4


Each record in field 1 should have one-one match in Field B. For eg if A is paired with 1 and it should not be paired with 2,3,4 . Similarly if 1 is paired with A already, it should NOT be paired against B,C or D

In short, I need to have output file with only 4 records -

A 1
B 2
C 3
D 4

Please help me achieve this using SORT
Back to top
View user's profile Send private message

Joerg.Findeisen

New User


Joined: 15 Aug 2015
Posts: 35
Location: Germany

PostPosted: Fri Oct 11, 2019 2:38 am    Post subject:
Reply with quote

Please use Code Tags when posting.

What have you tried so far and what error messages were seen? Remember, others might help but won't do YOUR job.
Back to top
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 552
Location: Maryland

PostPosted: Tue Oct 15, 2019 5:28 pm    Post subject: Re: One-One matching using SORT
Reply with quote

dearlux wrote:
I have a file with the following 16 records

Field1 Field 2

A 1
B 1
C 1
D 1
A 2
B 2
C 2
D 2
A 3
B 3
C 3
D 3
A 4
B 4
C 4
D 4


Each record in field 1 should have one-one match in Field B.

Please, clarify: what did you mean under "one-one match between field-1, and filed-2" - ?????????

There are ONLY LETTERS in field-1, and ONLY NUMBERS in field-2. How come one-one match between letters, and numbers? icon_rolleyes.gif
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 2262
Location: NY,USA

PostPosted: Tue Oct 15, 2019 8:26 pm    Post subject:
Reply with quote

My understanding is, there are two sub requirements associated with this requirement viz,

a. Get the Distinct on Col1 and pick the first value of col2
for e.g. A-1 (2,3,4 are eliminated)
b. From the Second records onwards compare the col2 value vs previous records col2 values and pick col2 next in seq which don't match any previous col2 values.
for e.g. B-2 (1 is not picked up because it was present for A) and same rule
till Record D.
Back to top
View user's profile Send private message
dearlux

New User


Joined: 10 Oct 2019
Posts: 2
Location: usa

PostPosted: Wed Oct 16, 2019 2:13 am    Post subject: Reply to: One-One matching using SORT
Reply with quote

My first field having A,B,C,D are deliver transactions and the second field with 1,2,3,4 signifies Receive transactions. A deliver transaction can only be paired with One and only receive. Similarly a Receive that is paired with a deliver cannot be paired again with another deliver. I don't want to write a batch program for this. Is there a way to accomplish this using sort.
Back to top
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 552
Location: Maryland

PostPosted: Wed Oct 16, 2019 3:12 am    Post subject: Re: Reply to: One-One matching using SORT
Reply with quote

dearlux wrote:
My first field having A,B,C,D are deliver transactions and the second field with 1,2,3,4 signifies Receive transactions. A deliver transaction can only be paired with One and only receive. Similarly a Receive that is paired with a deliver cannot be paired again with another deliver. I don't want to write a batch program for this. Is there a way to accomplish this using sort.

Why
Quote:
A 1
B 2
but not
Quote:
A 2
B 1

What the rule is, to combine deliver-receive into one line, or different lines???

icon_sad.gif
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1568
Location: Andromeda Galaxy

PostPosted: Wed Oct 16, 2019 3:44 am    Post subject:
Reply with quote

Dearlux your explanation is not very clear and please provide logical rules
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Create Dynamic Sort card with Omit co... balaji81_k DFSORT/ICETOOL 9 Thu Sep 26, 2019 10:06 pm
No new posts need assistance on a sort rajiv rengasamy SYNCSORT 11 Fri Jul 26, 2019 8:19 pm
No new posts need help with a tricky sort - Continued rajiv rengasamy SYNCSORT 8 Tue Jul 16, 2019 1:26 pm
No new posts Sort records within a data block rajiv rengasamy DFSORT/ICETOOL 0 Fri Jul 12, 2019 3:25 pm
This topic is locked: you cannot edit posts or make replies. need help with a tricky sort. rajiv rengasamy SYNCSORT 7 Fri Jul 12, 2019 12:36 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us