Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Match records -

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
scdinesh
Warnings : 1

New User


Joined: 06 Sep 2006
Posts: 37
Location: United States

PostPosted: Wed Feb 22, 2017 5:02 am    Post subject: Match records -
Reply with quote

Hi,
I've 2 input files and after executing below Joinkeys to get 3 output files.

used below sort for execution:

Code:
JOINKEYS F1=CONCURNT,FIELDS=(1,4,A)                                           
JOINKEYS F2=ITERTN,FIELDS=(1,4,A)                                         
JOIN UNPAIRED                 
REFORMAT FIELDS=(F1:01,500,F2:01,500,?)                                         
OPTION COPY                             
OUTFIL FNAMES=SORTOF1,                 
 INCLUDE=(1001,1,CH,EQ,C'1'),           
 BUILD=(1:1,500)                                                     
OUTFIL FNAMES=SORTOF2,                 
 INCLUDE=(1001,1,CH,EQ,C'B'),           
 BUILD=(1:1,500,501:501,500)                                                   
OUTFIL FNAMES=SORTOF3,                 
 INCLUDE=(1001,1,CH,EQ,C'2'),           
 BUILD=(1:501,500)                     


Input File1:
1234david
1234fehan

Input File2:
1234mike
1234nindy



Output File2 ('B') is showing result as
1234david
1234fehan
1234mike
1234nindy

can I able to get only matching records from File1 and its equivalent(reformat fields) ?
In this particular scenario , am expecting only records from Input file1:
1234david
1234fehan

Appreciate your help
Back to top
View user's profile Send private message

John Del

New User


Joined: 27 Apr 2012
Posts: 25
Location: NY

PostPosted: Wed Feb 22, 2017 6:08 am    Post subject:
Reply with quote

Why do you expect to get only the records from input file 1 with your key definition? All records that have the same key will be matched. Those are your matched records, so just reformat the matched using F1 as your output.
Back to top
View user's profile Send private message
scdinesh
Warnings : 1

New User


Joined: 06 Sep 2006
Posts: 37
Location: United States

PostPosted: Wed Feb 22, 2017 11:37 am    Post subject:
Reply with quote

Thanks for the response John:

In my case i've used input file2: as reference file. I need to build the logic upon file1(core file). is there any way can i able to restrict the records from file2?
Back to top
View user's profile Send private message
John Del

New User


Joined: 27 Apr 2012
Posts: 25
Location: NY

PostPosted: Wed Feb 22, 2017 5:13 pm    Post subject:
Reply with quote

scdinesh -

You could append a unique constant to each input file with JNF1 and JNF2 operations and when querying for matches, also query the constant that you appended to output only records from input 1.

/*
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2253
Location: @my desk

PostPosted: Wed Feb 22, 2017 8:19 pm    Post subject:
Reply with quote

Am I missing something here?

scdinesh,

Your code should have given something like this:
Code:
1234david 1234mike
1234david 1234nindy
1234fehan 1234mike
1234fehan 1234nindy

and NOT what you claimed you got. You are writing fields from both the input files (F1 and F2). If you just need file-1 (F1) fields, just write only F1 fields in the REFORMAT.

Since you have keys duplicated within each input 'file', your 'file-1' matching records will be repeated. If you just remove duplicates on the first 500 bytes, you should get what you want.
Back to top
View user's profile Send private message
John Del

New User


Joined: 27 Apr 2012
Posts: 25
Location: NY

PostPosted: Wed Feb 22, 2017 8:19 pm    Post subject:
Reply with quote

scdinesh -

Scratch my last comment about using the unique constant for each input data set; that still won't give you the results that you are expecting.

Did you actually run your job? And was that really the output of your SORTOF2 DD?

Using your parameters as coded, your output should be:
Code:

1234DAVID                              1234MIKE
1234DAVID                              1234NINDY
1234FEHAN                              1234MIKE
1234FEHAN                              1234NINDY

Note: I modified your record length to make the two records easily fit on my screen

You'd need to have post processing of some type to select just the first occurrence of your output (ie: sum fields, icetool select) in order to get your expected outcome of
Code:

1234DAVID                           
1234FEHAN



/*
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed Feb 22, 2017 11:58 pm    Post subject: Reply to: Match records -
Reply with quote

Code:
F1
1111A
2222B
2222C
3333D
3333E
4444F
4444G

F2
0000M
2222N
3333O
3333P
4444Q
4444R
4444S



What would your expect output be?
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm
No new posts To Merge mutliple records into a sing... anandgbe DFSORT/ICETOOL 6 Wed Feb 22, 2017 8:49 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us