Searching for record in FILE-B with key values in FILE-A?



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

Searching for record in FILE-B with key values in FILE-A?

Postby saiko » Fri Mar 20, 2015 2:49 pm

Hi guys,

I have a little experience using sort cards, and need help on the below as am unable to get an idea as to which approach should be good.
But feel sort can help me(we only have Syncsort with us)
If you dint understand below please let me know.


File A

Col_A   B   C   D   XYZ(some other column)
AAAA   BBBB   1111   3333   ********
DDDD   BBBB   1111   2222   ##**#*#*#
EEEE   BBBB   2222   5555   @@##$$$$
QQQQ   PQRS   0999   2100   &*^%&%**
ZZZZ   BBBB   0000   4444   *($*#)#


File B

COL_A   B   C   D   E
AAAA   BBBB   2222   4444   cap
AAAA   BAAB   2222   4444   cap
DDDD   BBBB   3333   1111   rat
EEEE   BBBB   2222   4444   mat
ZZZZ   BYYB   2222   4444   pit
ZZZZ   BBBB   0000   4444   nit
QQQQ   PQRS   1000   2000   kit



I need to find a matching row from B where
Columns

A[file_A] ==A[file_B]
AND
B[file_A] ==B[file_B]
AND
C[file_A] <=C[file_B]
AND
D[file_A] >=D[file_B]


(Note:The file_B will not have multiple records satisfying the above condition)


Resultant File C will look like
Col_A   B   C   D   XYZ(some other column)   E
AAAA   BBBB   1111   3333   ********
DDDD   BBBB   1111   2222   ##**#*#*#      rat
EEEE   BBBB   3333   2222   @@##$$$$      mat
QQQQ   PQRS   0999   2100   &*^%&%**      kit
ZZZZ   BBBB   0000   4444   *($*#)#         nit



(note: A dint have any matching column; so E is blank)

Many thank for looking!
Please direct me to any link/idea/example, will be very helpful.
saiko
 
Posts: 2
Joined: Fri Mar 20, 2015 2:37 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Searching for record in FILE-B with key values in FILE-A

Postby BillyBoyo » Fri Mar 20, 2015 5:10 pm

I can't see how your matching works, can you clarify? You want to match on a chunk of data which is four fields on one file to a chunk of data which is four fileds on another file, then add some data from the second file? If so, I can't understand your example output.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Searching for record in FILE-B with key values in FILE-A

Postby saiko » Fri Mar 20, 2015 7:03 pm

Ok so its like
on both are 4 continous fields in records of both files. Starting at position 1.
AAAA BBBB 1111 3333
And I need the matching record in B which has same first two fields and 3rd field to be less than or equal to one in B and 4th to be greater than or equal to one in B.

So result has same file as A (but extra data append on condition)

DDDD(match in B) BBBB(match in B) 1111(less than one in B) 2222(greater than one in B) ##**#*#*#(some other fields ignore for now) rat(so to this record of A concatenate from B only if match)


But


AAAA BBBB 1111(no match in B) 3333 ******** (hence as one condition not met, no concatenation like above)


Sorry if am still confusing, will try simplifying further if you need me to.
saiko
 
Posts: 2
Joined: Fri Mar 20, 2015 2:37 pm
Has thanked: 0 time
Been thanked: 0 time


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post