|
Re: .1 (and sorry for the omission)
as I understand it, the problem is that, given three files A, B,
and C, with a field AB common to A and B, and a field BC common
to files B and C:
JOIN AB in B to AB in A as JOIN_1
JOIN BC in C to BC in B as JOIN_2
Each of these joins "works" in that no error is generated, but when
we attempt to table file C to print fields from C, and corresponding
fields from A (which should be joined via B?), we get errors (the
fields in A are "unrecognised words").
Please note that A,B, and C are RMS files. Their concurrent use
in a live FORTRAN application precludes conversion to multi-segment
FOCUS DB file (*sigh*).
- Brian Beattie
|
|
When you perform a join on multi (ie more than 2) files, you must
build them as if you were putting together one large file from building
blocks. When you make the first join, it is advisable to start with
the file that you wish to TABLE later. After that join all the fields
from the second file in the join are now considered to be in the
first file when it is referenced. So to join another file in to
the list you must refer to the first file again.
A bit confusing so let me use your example.
You wish to table file C, so lets start there.
JOIN BC IN C TO ALL BC IN B AS JOIN_1
That will join all records in B that have a matching key in C to
C. ie.
---------
| C |
---------
|
/|\
---------
| B |
---------
FOCUS now considers that all the fields in B are now in file C and
can be refered to by Tabling C. So to add in file A you must join
it to file C. ie.
JOIN AB IN C TO ALL AB IN A AS JOIN_2
This now connects all records in A that have a matching record in
C to C (B)
_________
| C |
---------
|
/|\
_________
| B |
_________
|
/|\
_________
| A |
---------
Now Table file C and you will get all fields from A B C in you report.
An easy way to check you joins is to do a
CHECK FILE C PICTURE
command from the Focus prompt, after you have done the join, this
will draw a structure diag for the top file with all relations hanging
off it.
This works for RMS files and focus files.
Any problems with this explanation give me a ring on 7830-4972,
but remember I am in the UK so get the timing right!
All the best
Adam Linnell
|