ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

how do I combine two physical files or two logical files?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • how do I combine two physical files or two logical files?

    hello all, how do I combine two physical files or two logical files?
    Could give a little example code

  • #2
    Re: how do I combine two physical files or two logical files?

    CPYF MBROPT(*ADD) would work, read the 2 frigging files, create a join logical or multi-format logical, etc. (too many variables) what is the end goal? we need more (and better) information.
    I'm not anti-social, I just don't like people -Tommy Holden

    Comment


    • #3
      Re: how do I combine two physical files or two logical files?

      do the files have the same fields and sizes?
      All my answers were extracted from the "Big Dummy's Guide to the As400"
      and I take no responsibility for any of them.

      www.code400.com

      Comment


      • #4
        Re: how do I combine two physical files or two logical files?

        Duct Tape... and/or Baling wire!

        Comment


        • #5
          Re: how do I combine two physical files or two logical files?

          What do you mean by "combine".
          "Time passes, but sometimes it beats the <crap> out of you as it goes."

          Comment


          • #6
            Re: how do I combine two physical files or two logical files?

            Search for CPYMLTF on this site
            or here's another link
            Regards

            Kit
            http://www.ecofitonline.com
            DeskfIT - ChangefIT - XrefIT
            ___________________________________
            There are only 3 kinds of people -
            Those that can count and those that can't.

            Comment


            • #7
              Re: how do I combine two physical files or two logical files?

              sorry all, I mean, how do join two physical files ...

              Comment


              • #8
                Re: how do I combine two physical files or two logical files?

                Select * from file1 join file2 on file1.key = file2.key
                Patrick

                Comment


                • #9
                  Re: how do I combine two physical files or two logical files?

                  Originally posted by K2r400 View Post
                  Select * from file1 join file2 on file1.key = file2.key
                  [Alternate Syntax]
                  Select a.fld1, a.fld2, b.fld1, b.fld2, {etc...} from file1 a, file2 b where file1.key = file2.key
                  "Time passes, but sometimes it beats the <crap> out of you as it goes."

                  Comment


                  • #10
                    Re: how do I combine two physical files or two logical files?

                    Surely that depends on what sort of join you want? Outer, inner, left, right etc.

                    The W3 schools site has a little tutorial that runs through the different types of join.
                    W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.


                    N.b.
                    You can't do the FULL JOIN on the AS400.
                    Instead you have to do a left join and union it with a right exception join. It is effectively the same thing but the SQL becomes much more complicated. There is a brief explanation of this here:
                    Ben

                    Comment

                    Working...
                    X