|
View previous topic :: View next topic
|
| Author |
Message |
anatol
Active User
Joined: 20 May 2010 Posts: 121 Location: canada
|
|
|
|
Hi,
For files FB 80 I can compare 2 files and split for in both, in first, in second by:
| Code: |
JOINKEYS FILE=F1,FIELDS=(1,10,A)
JOINKEYS FILE=F2,FIELDS=(1,10,A)
JOIN UNPAIRED,F1,F2
REFORMAT FIELDS=(F1:1,80,F2:1,80,?)
OPTION COPY
OUTFIL FNAMES=BOTH,INCLUDE=(161,1,CH,EQ,C'B'),
BUILD=(1,80)
OUTFIL FNAMES=FIRST,INCLUDE=(161,1,CH,EQ,C'1'),
BUILD=(1,80)
OUTFIL FNAMES=SECOND,INCLUDE=(161,1,CH,EQ,C'2'),
BUILD=(81,80)
|
but how I can do it for files VB 80? |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| Quote: |
| z/OS DFSORT >> z/OS DFSORT Application Programming Guide >> Using a JOINKEYS application for joining two files >> JOINKEYS statements |
mentions what needs to be considered while handling variable length records in a JOIN application. Please read through, try it out and get back if you come across something unexpected. Or search the forum for working examples. |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10903 Location: italy
|
|
|
|
BTW also searching the forum would have been a good start
search word ==> JOINKEYS
forum ==> dfsort
author Frank Yaeger
and You would have landed here ( one of the many replies )
ibmmainframes.com/viewtopic.php?t=53484&highlight=joinkeys
the general rule is to take into account the RDW and add 4 to all field positions
but I am not a sort expert |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
As long as at least one of your JOINKEYS files is of variable-length records, then you can create a variable-length REFORMAT record.
On the other hand, even if both your files are variable-length records you don't have to create a variable-length REFORMAT records.
You create a variable-length REFORMAT record by including the RDW from one input file which contains variable-length records.
| Code: |
| REFORMAT FIELDS=(F2:1,4,F1:5,80,F2:5) |
You have to consider short records (they will be padded, you have control over with what) and may need a VLTRIM on some of the OUTFILs. |
|
| Back to top |
|
 |
anatol
Active User
Joined: 20 May 2010 Posts: 121 Location: canada
|
|
|
|
Thank you, Bill ... unfortunately both files are VB .. with
REFORMAT FIELDS=(F2:1,4,F1:5,80,F2:5) I can get VB records from F2 , but not from F1 ... so I think I have to use 3 steps to get in both, in first, in second |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| Quote: |
| so I think I have to use 3 steps to get in both, in first, in second |
I don't think you need 3 steps to do this. Did you try using the "?". Can you show what have you tried. |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| Quote: |
I cannot create VB for file 1 and VB from file 2
|
This statement is not true. So far you have posted only what you tried with FB data sets nothing with VB. So no point in referring to your initial post which is regarding your FB test.
hmmm... I think we are on the verge of getting locked.  |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| I just ran a test with VB input, and all the 3 outputs - VB again. I don't see a problem here. |
|
| Back to top |
|
 |
anatol
Active User
Joined: 20 May 2010 Posts: 121 Location: canada
|
|
|
|
| wow Arun, could you please show what you use for test? |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Did anyone read my post?
Try this:
| Code: |
| REFORMAT FIELDS=(F1:1,4,F1:5,F2:5) |
Use that for a JOINKEYS with F1,F2,ONLY and see what you get.
Otherwise, I've already shown a REFORMAT which will get you variable-length records, some of which you'll have to later VLTRIM. |
|
| Back to top |
|
 |
anatol
Active User
Joined: 20 May 2010 Posts: 121 Location: canada
|
|
|
|
ok, actual file is 1000 , not as I ask before .I've used
| Code: |
JOINKEYS FILE=F1,FIELDS=(9,71,A)
JOINKEYS FILE=F2,FIELDS=(9,71,A)
JOIN UNPAIRED,F1,F2,ONLY
REFORMAT FIELDS=(F1:1,4,?,F1:5,F2:5)
SORT FIELDS=COPY
OUTFIL FNAMES=INBOTHF,INCLUDE=(5,1,CH,EQ,C'B')
OUTFIL FNAMES=INF1ONLY,INCLUDE=(5,1,CH,EQ,C'1')
OUTFIL FNAMES=INF2ONLY,INCLUDE=(5,1,CH,EQ,C'2')
|
in first and in second file are good, but nothing in file both |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| Code: |
| JOIN UNPAIRED,F1,F2,ONLY |
You have included ONLY NON MATCHING records.
You need
OR
| Code: |
| JOIN UNPAIRED,F1,F2 |
to be able to output matched records too.
The other problem here is you will not know where exactly the file2 record begins, depends on how long is the "current" file1 record which is also of variable length. So BUILDing each output would be tricky. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
I'm going to take a heavy axe to this topic shortly. Anyone want to complain, don't bother.
Anatol,
I wasn't suggesting that code for you to use, because you want matches. F1,F2,ONLY will only get you mismatches. If you take off the ,ONLY you'll get REFORMAT records for B, but they would need some work because the F2 data would start immediately after the end of the F1 data.
Your best option is RDW,"fixed" data from one file,"variable" data from the other. Then, on any OUTFIL where the fixed data is used for output, you VLTRIM (be careful not to trim a vital value, so know what data can be in the last position). |
|
| Back to top |
|
 |
anatol
Active User
Joined: 20 May 2010 Posts: 121 Location: canada
|
|
|
|
Thank you all ... I think we all tired of this topic ... it was good learning .. I like sort  |
|
| Back to top |
|
 |
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
| Quote: |
Your best option is RDW,"fixed" data from one file,"variable" data from the other. Then, on any OUTFIL where the fixed data is used for output, you VLTRIM (be careful not to trim a vital value, so know what data can be in the last position).
|
I was going to say that is what I said anatol should do several posts back.
But wait, my posts are gone.
It kinda hurts when you spend time responding, and it gets deleted.
Yea, I know, there were some 'off topic' bantering going on, but most of my posts were on point.
Guess we will never know. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|