View previous topic :: View next topic
|
Author |
Message |
mfchnuser
New User
Joined: 21 Sep 2012 Posts: 12 Location: India
|
|
|
|
I have a file A that either has a 10 digit inc number or 7 digit priority no.
FILA
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10889 Location: italy
|
|
|
|
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 |
|
|
mfchnuser
New User
Joined: 21 Sep 2012 Posts: 12 Location: India
|
|
|
|
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 |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
mfchnuser
New User
Joined: 21 Sep 2012 Posts: 12 Location: India
|
|
|
|
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
What is the key in file B?? |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
If you explain why there are 2 sort steps before this process, someone may be able to suggest an alternative. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10889 Location: italy
|
|
|
|
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 |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
saiprasadh
Active User
Joined: 20 Sep 2006 Posts: 154 Location: US
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10889 Location: italy
|
|
|
|
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 |
|
|
|