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

Joinkeys to match both conditions


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Dec 17, 2012 7:30 pm
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
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

Moderator Emeritus


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

PostPosted: Mon Dec 17, 2012 7:53 pm
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
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

Global Moderator


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

PostPosted: Mon Dec 17, 2012 8:04 pm
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: 792
Location: Pennsylvania

PostPosted: Mon Dec 17, 2012 8:04 pm
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

Moderator Emeritus


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

PostPosted: Mon Dec 17, 2012 8:05 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Dec 17, 2012 8:09 pm
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: 792
Location: Pennsylvania

PostPosted: Mon Dec 17, 2012 11:05 pm
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

Moderator Emeritus


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

PostPosted: Tue Dec 18, 2012 4:09 am
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
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

Moderator Emeritus


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

PostPosted: Tue Dec 18, 2012 5:57 am
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Dec 18, 2012 12:14 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to load to DB2 with column level ... DB2 6
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
No new posts Db2 SQL - how to switch among differe... DB2 18
Search our Forums:

Back to Top