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
 

 

Matching keys at different locations with duplicates in one

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

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Thu May 02, 2013 9:01 pm    Post subject: Matching keys at different locations with duplicates in one
Reply with quote

I have two files of record lengths 9 and 4500, I want to check if the 9 character field in file1 is present in file2 at position 1600 of the second file
I want the unmatched value from file 2 only to be written to another file. The values in file 1 are unique whereas the values in file1 can be duplicates. It doesnt work. Please help

I used the sortcard as below:

Code:

JOINKEYS F1=IN1,FIELDS=(1600,9,A)
JOINKEYS F2=IN2,FIELDS=(1,9,A)   
JOIN UNPAIRED,F2,ONLY           
OPTION COPY                     
Back to top
View user's profile Send private message

Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Thu May 02, 2013 9:37 pm    Post subject: Re: Matching keys at different locations with duplicates in
Reply with quote

suraaj wrote:
It doesnt work.

How does it not work?
Back to top
View user's profile Send private message
suraaj

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Thu May 02, 2013 9:38 pm    Post subject: Reply to: Matching keys at different locations with duplicat
Reply with quote

A minor correction, the first file is 4500 characters long and the second file is 9 character long.
Back to top
View user's profile Send private message
suraaj

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Thu May 02, 2013 10:17 pm    Post subject: Reply to: Matching keys at different locations with duplicat
Reply with quote

It works after I added the SORTED,NOSEQCK to both the files which makes the sortcard as

Code:

JOINKEYS F1=IN1,FIELDS=(1600,9,A),SORTED,NOSEQCK
JOINKEYS F2=IN2,FIELDS=(1,9,A),SORTED,NOSEQCK
JOIN UNPAIRED,F2,ONLY
OPTION COPY
Back to top
View user's profile Send private message
suraaj

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Thu May 02, 2013 11:53 pm    Post subject: Reply to: Matching keys at different locations with duplicat
Reply with quote

Code:

JOINKEYS FILE=F1,FIELDS=(1600,9,A),SORTED,NOSEQCK
JOINKEYS FILE=F2,FIELDS=(1,9,A),SORTED,NOSEQCK   
JOIN UNPAIRED,F1,F2                             
REFORMAT FIELDS=(F1:1600,9,F2:1,9,?)             
OPTION COPY                                     
OUTFIL FNAMES=F1ONLY,INCLUDE=(19,1,CH,EQ,C'1'), 
  BUILD=(1,9)                                   
OUTFIL FNAMES=F2ONLY,INCLUDE=(35,1,CH,EQ,C'2'), 
  BUILD=(1,9)                                   
OUTFIL FNAMES=BOTH,INCLUDE=(35,1,CH,EQ,C'B'),   
  BUILD=(1,9,/,11,9)                             


I am trying to write values present in F1 alone to one file, F2 alone to another file and both files to another file. I am using the above sort card. I am getting the error as

ICE414A 0 SORTJNF1 (F1) KEY FIELD END AT 1608 IS BEYOND LENGTH OF 9

Please advise.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Fri May 03, 2013 12:54 am    Post subject:
Reply with quote

Although I am not a DFSORT maven, does not this message suggest to you that perhaps the wrong data sets are assigned to the SORTJNFn files?
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Fri May 03, 2013 12:12 pm    Post subject:
Reply with quote

First check if you are using correct DD-FIle name combination and then try with below sort card:
Code:

  JOINKEYS FILE=F1,FIELDS=(1600,9,A),SORTED,NOSEQCK                     
  JOINKEYS FILE=F2,FIELDS=(1,9,A),SORTED,NOSEQCK                     
  JOIN     UNPAIRED,F1,F2                                             
  REFORMAT FIELDS=(F1:1600,9,F2:1,9,?)                                   
  OPTION   COPY                                                       
  OUTFIL   FNAMES=F1ONLY,INCLUDE=(19,1,CH,EQ,C'1'),BUILD=(1,9)         
  OUTFIL   FNAMES=F2ONLY,INCLUDE=(19,1,CH,EQ,C'2'),BUILD=(10,9)         
  OUTFIL   FNAMES=BOTH,INCLUDE=(19,1,CH,EQ,C'B'),BUILD=(1,9,C'/',11,9)


If it does not work, post sample input and expected output data.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Fri May 03, 2013 2:19 pm    Post subject: Reply to: Matching keys at different locations with duplicat
Reply with quote

You really should be able to fix that yourself without asking. The message is explicit, and the 9 must mean something to you.

I've changed the third OUTFIL to use SAVE, which means "put on this OUTFIL all records which do not appear on another OUTFIL".

I've changed the 11,9 on that OUTFIL to 10,9, assuming that you want the full information, not the last eight bytes plus the match marker.

On that OUTFIL, other than looking at odd/even "line number", you have no clue as to which is from what input. However, since they should be the same, it shouldn't matter, and perhaps you only need to output one of them :-)

Code:
  JOINKEYS FILE=F1,FIELDS=(1600,9,A),SORTED,NOSEQCK                     
  JOINKEYS FILE=F2,FIELDS=(1,9,A),SORTED,NOSEQCK                     
  JOIN     UNPAIRED,F1,F2                                             
  REFORMAT FIELDS=(F1:1600,9,F2:1,9,?)                                   
  OPTION   COPY                                                       
  OUTFIL   FNAMES=F1ONLY,INCLUDE=(19,1,CH,EQ,C'1'),BUILD=(1,9)         
  OUTFIL   FNAMES=F2ONLY,INCLUDE=(19,1,CH,EQ,C'2'),BUILD=(10,9)         
  OUTFIL   FNAMES=BOTH,SAVE,BUILD=(1,9,C'/',10,9)
Back to top
View user's profile Send private message
suraaj

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Fri May 03, 2013 6:46 pm    Post subject: Reply to: Matching keys at different locations with duplicat
Reply with quote

My badf and apologies for not seeing at the issue myself. This works now.

Another question pertaining to the same, since there are duplicates present at the 4500 length file I am getting the duplicates in the "BOTH" file. Is there a way that I can get the duplicates removed and just get the count of how many times each are repeated.Kindly help
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Fri May 03, 2013 7:07 pm    Post subject: Reply to: Matching keys at different locations with duplicat
Reply with quote

Yes, if you look at OUTFIL in the manual, specifically SECTIONS, TRAILER3, COUNT. If you use REMOVECC and NODETAIL you should get what I think you want. If you don't, show the sample input, and expected output, and what you have tried.
Back to top
View user's profile Send private message
suraaj

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Fri May 03, 2013 11:12 pm    Post subject: Reply to: Matching keys at different locations with duplicat
Reply with quote

Thanx Bill. I got it.

Code:

JOINKEYS FILE=F1,FIELDS=(1600,9,A),SORTED,NOSEQCK                   
JOINKEYS FILE=F2,FIELDS=(1,9,A),SORTED,NOSEQCK                       
JOIN     UNPAIRED,F1,F2                                             
REFORMAT FIELDS=(F1:1600,9,F2:1,9,?)                                 
OPTION   COPY                                                       
OUTFIL   FNAMES=BOTH,INCLUDE=(19,1,CH,EQ,C'B'),BUILD=(1,9,C'/',10,9),
         REMOVECC,NODETAIL,                                         
SECTIONS=(1,2,                                                       
TRAILER3=(1,9,COUNT=(M10,LENGTH=8))),                               
HEADER1=('CODE          COUNT')                                               


This is the code that I used to get the result. Please advise if there is something more that can be done in the code to improve efficiency
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri May 03, 2013 11:15 pm    Post subject: Reply to: Matching keys at different locations with duplicat
Reply with quote

If you just need the keys why bother reading the entire 1600 byte F1 record? use JNF1 and JNF2 to read only the fields you interested.

As you mentioned that you have duplicates in BOTH file, I am assuming that you also might have duplicates on the non matching keys. Use the following control cards that will remove duplicates in ALL the files and give you the desired results.


Code:

//SYSIN    DD *                                                     
  OPTION COPY                                                       
  JOINKEYS F1=INA,FIELDS=(1,9,A),SORTED,NOSEQCK                     
  JOINKEYS F2=INB,FIELDS=(1,9,A),SORTED,NOSEQCK                     
  JOIN UNPAIRED                                                     
  REFORMAT FIELDS=(F1:1,9,?,F2:1,9)                                 
  INREC IFOUTLEN=10,IFTHEN=(WHEN=(10,1,CH,EQ,C'2'),BUILD=(11,9,10,1))

  OUTFIL FNAMES=F1ONLY,INCLUDE=(10,1,CH,EQ,C'1'),                   
  BUILD=(9X),REMOVECC,NODETAIL,SECTIONS=(1,9,TRAILER3=(1,9))         

  OUTFIL FNAMES=F2ONLY,INCLUDE=(10,1,CH,EQ,C'2'),                   
  BUILD=(9X),REMOVECC,NODETAIL,SECTIONS=(1,9,TRAILER3=(1,9))         

  OUTFIL FNAMES=BOTH,SAVE,                                           
  BUILD=(9X),REMOVECC,NODETAIL,SECTIONS=(1,9,TRAILER3=(1,9))         
//*                                                                 
//JNF1CNTL DD *                                                     
  INREC BUILD=(1600,9)                                               
//*                                                                 
//JNF2CNTL DD *                                                     
  INREC BUILD=(1,9)                                                 
//*
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri May 03, 2013 11:22 pm    Post subject: Re: Reply to: Matching keys at different locations with dupl
Reply with quote

suraaj wrote:
Thanx Bill. I got it.

Code:

JOINKEYS FILE=F1,FIELDS=(1600,9,A),SORTED,NOSEQCK                   
JOINKEYS FILE=F2,FIELDS=(1,9,A),SORTED,NOSEQCK                       
JOIN     UNPAIRED,F1,F2                                             
REFORMAT FIELDS=(F1:1600,9,F2:1,9,?)                                 
OPTION   COPY                                                       
OUTFIL   FNAMES=BOTH,INCLUDE=(19,1,CH,EQ,C'B'),BUILD=(1,9,C'/',10,9),
         REMOVECC,NODETAIL,                                         
SECTIONS=(1,2,                                                       
TRAILER3=(1,9,COUNT=(M10,LENGTH=8))),                               
HEADER1=('CODE          COUNT')                                               


This is the code that I used to get the result. Please advise if there is something more that can be done in the code to improve efficiency


huh?

Why are you using sections for 1,2? when your key has a length of 9 bytes? And the count you get is totally wrong.

Lets say you 10 duplicates for a key in file1 and the same key have 20 duplicates in file2, then join keys would have produced 10 X 20 = 200 records for that key. With your job you might get 200 as count which is totally wrong. You need to better understand what joinkeys does
Back to top
View user's profile Send private message
suraaj

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Sat May 04, 2013 1:42 am    Post subject: Reply to: Matching keys at different locations with duplicat
Reply with quote

Thats a typo... icon_sad.gif

Though I am in learning phase....
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 Updating the counters after eliminati... PANDU1 DFSORT/ICETOOL 12 Mon Nov 21, 2016 9:47 am
No new posts Matching with Key at different postions. rajatbagga DFSORT/ICETOOL 12 Wed Nov 09, 2016 10:58 am
No new posts Joinkeys with duplicated keys juares castro SYNCSORT 19 Fri Sep 23, 2016 5:58 am
No new posts TSO Logon Failing - Acount Not matching SLNewton TSO/ISPF 1 Thu Aug 25, 2016 9:37 pm
No new posts File matching with PD key on differen... hiravibk DFSORT/ICETOOL 2 Wed Feb 17, 2016 11:40 pm


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