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

Match records -


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
scdinesh

New User


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

PostPosted: Wed Feb 22, 2017 5:02 am
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: 42
Location: NY

PostPosted: Wed Feb 22, 2017 6:08 am
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

New User


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

PostPosted: Wed Feb 22, 2017 11:37 am
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: 42
Location: NY

PostPosted: Wed Feb 22, 2017 5:13 pm
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: 2481
Location: @my desk

PostPosted: Wed Feb 22, 2017 8:19 pm
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: 42
Location: NY

PostPosted: Wed Feb 22, 2017 8:19 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Feb 22, 2017 11:58 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
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 Join multiple records using splice DFSORT/ICETOOL 5
Search our Forums:

Back to Top