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
 

 

Joinkeys to match both conditions

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
mfchnuser

New User


Joined: 21 Sep 2012
Posts: 12
Location: India

PostPosted: Mon Dec 17, 2012 7:22 pm    Post subject: Joinkeys to match both conditions
Reply with quote

I have a file A that either has a 10 digit inc number or 7 digit priority no.

FILA
Code:

0004055381 
3101071     


I have FILE B that has many records,having the 10 digit inc no. at 11 pos and priority no. at 21 pos.Consider this data in FILE B

Code:

AAAAAAAAAA0004055381BBBBBBBBBBBBBBB
AAAAAAAAAA00065202143101071FFFFFFFF
AAAAAAAAAA0006520214350107RFFFFFFFF


I need Joinkeys to match both conditions and find the unpaired records in FILEC. Is it possible to have this using a single sort statement joinkeys.

your help is much appreciated
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Mon Dec 17, 2012 7:30 pm    Post subject: Reply to: Need some help on Joinkeys
Reply with quote

how many records in file A ?
if only two records a two step approach using symnames might be the most economical way out of it

from the description noo way with joinkeys
to understand why just look at the syntax of it ...

one key for the first file one key for the second one ==> ONE CONDITION
and You ask for TWO
Back to top
View user's profile Send private message
mfchnuser

New User


Joined: 21 Sep 2012
Posts: 12
Location: India

PostPosted: Mon Dec 17, 2012 7:50 pm    Post subject: reply
Reply with quote

Thanks for your reply

The data given was just a sample

The number of records in FILEA are not fixed. they can vary from 0 to 100.

but the record can be either 10 digit inc number or 7 digit priority no in FILEA.

this needs to match with the same in FILE B , having the 10 digit inc no. at 11 pos and priority no. at 21 pos. B

file B has more than 20k records, i need the unpaired records from FILE B

and i cannot use rexx icon_sad.gif
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Dec 17, 2012 7:53 pm    Post subject:
Reply with quote

Hello,

Then use 2 steps.

Besides rexx is Not a good tool for matching "many records". It would use exponentially more system resources than the 2 sort steps.
Back to top
View user's profile Send private message
mfchnuser

New User


Joined: 21 Sep 2012
Posts: 12
Location: India

PostPosted: Mon Dec 17, 2012 7:56 pm    Post subject: reply
Reply with quote

thanks for your respnse!!

so you mean to say that JOIN KEYS does not work for multiple conditions?

i wanted 1 sort step since already the current data is a result of 2 sort steps, wanted to reduce the steps
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Mon Dec 17, 2012 8:04 pm    Post subject:
Reply with quote

What is the key in file B??
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Mon Dec 17, 2012 8:04 pm    Post subject:
Reply with quote

Quote:
so you mean to say that JOIN KEYS does not work for multiple conditions?


Which part of Enrico's response was not clear?

Quote:
one key for the first file one key for the second one ==> ONE CONDITION


Quote:
wanted 1 sort step since already the current data is a result of 2 sort steps, wanted to reduce the steps


Why? How long does it take to run a join keys with 100 keys matching 20k keys? Five seconds maybe? What is the big deal if you need to code two, three, six steps to accomplish the task?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Dec 17, 2012 8:05 pm    Post subject:
Reply with quote

Hello,

If you explain why there are 2 sort steps before this process, someone may be able to suggest an alternative.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Mon Dec 17, 2012 8:09 pm    Post subject: Reply to: Need some help on Joinkeys
Reply with quote

it would be wiser to review the whole requirement and/or the file layout and content

from the data posted You have NOO way to understand how to join,
You would need anyway to carry on some additional processing ( checking for blanks )


in order to understand how to use the file a <keys> for the join

and even if feasible it adds complexity because of a poor design
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Mon Dec 17, 2012 11:05 pm    Post subject:
Reply with quote

This seems like a slightly different flavor of this thread:

Quote:
http://ibmmainframes.com/viewtopic.php?t=60060&highlight=


A thread that has 26 posts and is no where close to a useable solution.

Just an observation.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Dec 18, 2012 4:09 am    Post subject: Reply to: Need some help on Joinkeys
Reply with quote

We know you have SyncSort, but we don't know if the SyncSort you have supports JNFnCNTL files. If it does, you can probably do it in one step.

Doing another Sort step on the 0-100 record file should be a simple solution. JOINKEYS supports multiple keys, but the keys have to be on the same record. So you have to take the pairs of records and make them into one record.
Back to top
View user's profile Send private message
saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Tue Dec 18, 2012 4:23 am    Post subject:
Reply with quote

I Used DFSORT for your requirement.


Code:
//STEP01  EXEC PGM=SORT                                                 
//SYSPRINT  DD SYSOUT=*                                                 
//SYSOUT    DD SYSOUT=*                                                 
//IN1       DD *                                                       
0004055381                                                             
3101071                                                                 
0004055382                                                             
3101072                                                                 
/*                                                                     
//IN2       DD *                                                       
AAAAAAAAAA0004055381BBBBBBBBBBBBBBB                                     
AAAAAAAAAA00040553813101071FFFFFFFF                                     
AAAAAAAAAA00040553810004055FFFFFFFF                                     
AAAAAAAAAA0006520214350107RFFFFFFFF                                     
/*                                                                     
//SORTOUT   DD SYSOUT=*                                                 
//SYSIN  DD  *                                                         
 SORT FIELDS=COPY                                                       
 JOINKEYS F1=IN1,FIELDS=(81,10,A,1,7,A,8,1,A)                           
 JOINKEYS F2=IN2,FIELDS=(11,10,A,21,7,A,36,1,A)                         
 JOIN UNPAIRED,F2,ONLY                                                 
/*                                                                     
//JNF1CNTL DD *                                           
  INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(81:1,10))     
/*                                                       
//JNF2CNTL DD *                                           
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(36:C' '))             
/*                                                       


Output:

Code:
AAAAAAAAAA0004055381BBBBBBBBBBBBBBB
AAAAAAAAAA00040553810004055FFFFFFFF
AAAAAAAAAA0006520214350107RFFFFFFFF
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Dec 18, 2012 5:57 am    Post subject: Reply to: Need some help on Joinkeys
Reply with quote

I've slightly amended Sai's. The F1 is now just a key, and the "other one" of the paired records contains blanks. The GROUP is only established for the records with an "odd number" from the SEQNUM.

Code:
//STEP01  EXEC PGM=SORT
//SYSPRINT  DD SYSOUT=*
//SYSOUT    DD SYSOUT=*
//SORTOUT   DD SYSOUT=*
//SYSIN  DD  *
  SORT FIELDS=COPY
  JOINKEYS F1=IN1,FIELDS=(1,17,A)
  JOINKEYS F2=IN2,FIELDS=(11,17,A)
  JOIN UNPAIRED,F2,ONLY
/*
//JNF1CNTL DD *
  INREC IFOUTLEN=17,
        IFTHEN=(WHEN=INIT,OVERLAY=(29:SEQNUM,1,ZD)),
        IFTHEN=(WHEN=GROUP,BEGIN=(29,1,BI,EQ,B'.......1'),
                PUSH=(11:1,10,28:SEQ=1)),
        IFTHEN=(WHEN=(28,1,CH,EQ,C'2'),
                 BUILD=(11,10,1,7)),
        IFTHEN=(WHEN=NONE,OVERLAY=(1:17X))
//IN1       DD *
0004055381
3101071
0004055382
3101072
/*
//IN2       DD *
AAAAAAAAAA0004055381BBBBBBBBBBBBBBB
AAAAAAAAAA00040553813101071FFFFFFFF
AAAAAAAAAA00040553810004055FFFFFFFF
AAAAAAAAAA0006520214350107RFFFFFFFF
/*
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Tue Dec 18, 2012 12:14 pm    Post subject: Reply to: Need some help on Joinkeys
Reply with quote

My replies were based on an arbitrary sequence of the FILE A records

I agree that a sequence LONG/SHORT LONG/SHORT ... makes things workable !
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts Joinkeys operation when key1 and key2... Susanta DFSORT/ICETOOL 5 Wed Nov 02, 2016 5:35 pm
No new posts Joinkeys operation betwen VB and FB file Susanta SYNCSORT 4 Sun Sep 25, 2016 9:49 pm
No new posts Joinkeys with duplicated keys juares castro SYNCSORT 19 Fri Sep 23, 2016 5:58 am
No new posts Icetool or Joinkeys example to compar... ishant chauhan DFSORT/ICETOOL 21 Sat Aug 20, 2016 2:40 am


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