Compare records with same key



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Compare records with same key

Postby cuautli » Tue Sep 12, 2017 10:54 pm

Hi,
I need an output file with only one registry per key with two values
pos 2: 1 - When the input register contains the values 101 or 103 or 104
pos 3: 1 - When the input register contains the values 109 or 108

Input File
A107
A108
A109
B103
B104
C109

Output file
A11
B10
C01

Can you help me?
Thanks
cuautli
 
Posts: 2
Joined: Tue Sep 12, 2017 10:38 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Compare records with same key

Postby enrico-sorichetti » Wed Sep 13, 2017 12:53 am

Can you help me?


NO :mrgreen:
Your terminology is confusing
the output is not consistent
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3003
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Compare records with same key

Postby Aki88 » Wed Sep 13, 2017 3:50 pm

Hello,

Mr. Sorichetti, the TS has worded the post poorly, but looks like below is the requirement:

For the below input data:
A107
A108
A109
B103
B104
C109


The first character, A/B/C - in this case - act as the primary group item; program needs to test whether the remaining 3 characters fall under: 101/103/104 OR 109/108.

If the input characters fall under 101/103/104, then the second byte in the output needs to be 1; if the characters fall under 108/109, then the third byte of the output record needs to be 1; hence the output form:


<Group-element><data-bit 1><data-bit 2>
A11
B10
C01
 
Aki88
 
Posts: 381
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 36 times

Re: Compare records with same key

Postby Robert Sample » Wed Sep 13, 2017 4:02 pm

Except why is the output A11? There is no 101, 103, or 104 for the A -- so why is the output not A01? As was said, the output is not consistent with the stated requirements.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Compare records with same key

Postby enrico-sorichetti » Wed Sep 13, 2017 5:42 pm

Mr Aki88 review the output and meditate please

the TS told nothing about what should be done with the other byte involved

when checking <byte one> of the result file the same decision will be taken for the A and B records
and the A and B record are in different sets in the original input
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3003
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Compare records with same key

Postby cuautli » Wed Sep 13, 2017 8:23 pm

Hi,

There are two groups of values G1={101,102,103} and G2={108,109}

When a same key has only values from group G1, the output record must be K10
When a same key has only values from group G2, the output record must be K01
When a same key has values of both groups G1 and G2, the output record must be K11

I have a long solution
1. Build a file with keys of group G1
2. Build a file with keys of group G2
3. Matching Records + Non Matching from both files

But perhaps there is a better solution.
cuautli
 
Posts: 2
Joined: Tue Sep 12, 2017 10:38 pm
Has thanked: 0 time
Been thanked: 0 time


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post