Focal Point
[SOLVED] How to join several files

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/9321079272

February 22, 2008, 03:13 PM
webmeister
[SOLVED] How to join several files
What is the format for joining several files at once? I know how to do a simple one file join to another file, but how would you join field A in File 1 to Field B in file 2 and to Field C in file 3 and to Field in file 4?

I looked in my FOCUS manuals, but could only find simple joins, plus I tried searching on the net.

Hopefully, someone will be able to help...thanks in advance!

This message has been edited. Last edited by: webmeister,


Mainframe FOCUS 7.0
VM/CMS and MVS/TSO
February 22, 2008, 03:40 PM
FrankDutch
How would you do that in SQL?

I think that can't be done either, if you can do it on the database side and create a view. Then create a master on the view and build your report directly on that master.

What you can do is a chained join or a join like field A in fileX to field B in fileY and field C in fileX to field D in fileZ.
But then you have a multipath join and these joins can only be used as descriptive fields (translation of the codes).




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

February 22, 2008, 03:44 PM
GinnyJakes
JOIN FIELD_A IN FILE1 TO [ALL] FIELD_B IN FILE2 AS J1
JOIN FIELD_A IN FILE1 TO [ALL] FIELD_C IN FILE3 AS J2
JOIN FIELD_A IN FILE1 TO [ALL] FIELD_D IN FILE4 AS J3
  



Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
February 22, 2008, 04:26 PM
webmeister
Frank and Ginny,

Thanks for your replies..... Frank, I wasn't quite clear on your reply...Ginny, I will use your suggestion. It's rough when you've been away from FOCUS since 1997, but a lot of it is coming back quickly.


Mainframe FOCUS 7.0
VM/CMS and MVS/TSO
February 23, 2008, 10:36 PM
Leah
As an addendum to Ginny's excellent simple example, if by some chance the files have fields with the same names.

JOIN FIELD_A IN FILE1 TO FIELD_A IN FILE2 AS J1
JOIN FILE2.FIELD_A IN FILE1 TO FIELD_A IN FILE3 AS J3
JOIN FILE3.FIELD_A IN FILE1 TO FIELD_D IN FILE4 AS J4


Leah
February 25, 2008, 11:32 AM
jgelona
Don't forget about the TAG attribute. Using Leah's example:
JOIN FIELD_A   IN FILE1 TAG A TO FIELD_A IN FILE2 TAG B AS J1
JOIN B.FIELD_A IN FILE1       TO FIELD_A IN FILE3 TAG C AS J3
JOIN C.FIELD_A IN FILE1       TO FIELD_D IN FILE4       AS J4



In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
February 25, 2008, 11:43 AM
Leah
Thanks for the addition, when you reply at 10:36 at night, some code just goes away from current memory.


Leah