×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Linear Join using three files; two files twice

Linear Join using three files; two files twice

Linear Join using three files; two files twice

(OP)
Referencing thread243-1197791

I have three files that I need to join. J0 and J1 work.  However, J2 and J3 (children of J0 and J1) do not... they retrieve the same data.

From Group:
FILEA.SM$FCOM/SM$FGP + FILEB.CWCO/CW$FL# + FILEC.IMLITM = ABC
To Group:
FILEA.SM$TCOM/SM$TGP + FILEB.CWCO/CW$FL# + FILEC.IMLITM = DEF

This is the join generated using the JOIN tool:

CODE

JOIN
 FILEA.FILEA.SM$FCOM AND FILEA.FILEA.SM$FGP IN FILEA TO MULTIPLE
 FILEB.FILEB.CWCO AND FILEB.FILEB.CW$FL# IN FILEB AS J0
 END
JOIN
 FILEA.FILEA.SM$TCO AND FILEA.FILEA.SM$TGP IN FILEA TO MULTIPLE
 FILEB.FILEB.CWCO AND FILEB.FILEB.CW$FL# IN FILEB AS J1
 END
JOIN
 FILEB.FILEB.CWLITM IN FILEA TO UNIQUE FILEC.FILEC.IMLITM IN FILEC AS J2
 END
JOIN
 FILEB.FILEB.CWLITM IN FILEA TO UNIQUE FILEC.FILEC.IMLITM IN FILEC AS J3
 END

RE: Linear Join using three files; two files twice

When you say that the JOINs don't work because you get the same data, it may be because you have the SAME file in the structure TWICE. Since both instances have the same filename, segment name and fieldname, unless you qualify the fields differently, you'll always get one of them. The safest way to qualify a JOIN is through the use of a TAG name. This allows you to EXPLICITLY name each of the repeated structures, effectively replacing the FILENAME with the TAG name.
Here's the JOIN syntax:

CODE

JOIN
[LEFT_OUTER|INNER] hfld1 [AND hfld2 ...] IN hostfile [TAG tag1]     
TO [UNIQUE|MULTIPLE] crfield [AND crfld2 ...] IN crfile [TAG tag2] [AS joinname]
END

Where TAG is defined as:

TAG tag1

Is a tag name of up to eight characters (usually the name of the Master File), which is used as a unique qualifier for fields and aliases in the host file.

TAG tag2

Is a tag name of up to eight characters (usually the name of the Master File), which is used as a unique qualifier for fields and aliases in cross-referenced files. In a recursive join structure, if no tag name is provided, all field names and aliases are prefixed with the first four characters of the join name.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close