ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Moving Physical file from one As/400 to another.

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

  • Moving Physical file from one As/400 to another.

    Hi,

    I need to move some physical files from one as/400 to another. I cannot use savf, because I don't have privilege to use RSTOBJ command. In order to achieve this, i tried FTP'ing the physical file itself in Binary mode from AS/400 to Windows, and then to other AS/400.

    However data got corrupted, when I checked using, RUNQRY on the file. Can anyone explain what's going wrong here? Below is the list of commands I used to achieve this.

    Code:
    ftp myserver
    username
    password
    binary
    quote site namefmt 1
    cd qsys.lib/mylib.lib
    get myfile.pf myfile.pf
    quit
     
    ftp mynextserver
    username password
    binary
    quote site namefmt 1
    cd qsys.lib/mylib.lib
    put myfile.pf myfile.pf
    quit
    This is the only way I know to FTP files, since I am still learning this protocol. If there are other ways around please guide me with them. Also, I know you can directly transfer files from AS/400 to AS/400, but I don't know how to do that. I also want to know, why using the above procedure corrupted my data.

    In past I used FTP to move SAVF from my windows to AS/400 server, and at that time I had access to RSTOBJ command, but now, it's denied.

    Thanks in advance
    Proto
    *...1....+....2....+....3....+....4....+....5....+ ....6....+....7.......+....8.......+....9.......+. ...10.......+....11...
    C*There are only 10 type of people in this world, those who understand binary and those who don't.

  • #2
    Re: Moving Physical file from one As/400 to another.

    If the 2 AS/400's are connected via network... try doing a SAVRSTOBJ.

    Your FTP can work directly between AS/400's as well .. just as you have to the PC. As long as you do a BINARY transfer, it should work.

    Just use the 2nd group above and FTP Directly to the other AS/400.

    Comment


    • #3
      Re: Moving Physical file from one As/400 to another.

      Originally posted by FaStOnE View Post
      If the 2 AS/400's are connected via network... try doing a SAVRSTOBJ.

      Your FTP can work directly between AS/400's as well .. just as you have to the PC. As long as you do a BINARY transfer, it should work.

      Just use the 2nd group above and FTP Directly to the other AS/400.
      Hi FastOne,

      I did try that, however everytime I do FTP and then in the host name, when i enter host server name, it always return with "Cannot find Host myserver_name". I left all the rest options as *DFT.

      I am able to connect using windows FTP though. I tried ASCII as well as BINARY, both didn't work.

      And no, both servers are at different remote locations and not connected to a common network.

      Thanks,
      Proto
      *...1....+....2....+....3....+....4....+....5....+ ....6....+....7.......+....8.......+....9.......+. ...10.......+....11...
      C*There are only 10 type of people in this world, those who understand binary and those who don't.

      Comment


      • #4
        Re: Moving Physical file from one As/400 to another.

        have you tried using SNDNETF and RCVNETF?
        I'm not anti-social, I just don't like people -Tommy Holden

        Comment


        • #5
          Re: Moving Physical file from one As/400 to another.

          Originally posted by tomholden View Post
          have you tried using SNDNETF and RCVNETF?
          I don't think SDM/DDM is allowed either. It says user is not enrolled in SDM. Also I don't have experience whatsoever with SNDNETF and RCVNETF. One of the easiest way I could think of is, to transfer data in Excel sheet and then move it back to other server, but I don' want to do that because FILE size is too big, and I need to transfer a no. of files.

          Also my USER NAME and SERVER NAME is more than 8 chars, and SNDNETF only allows 8 chars. Again I am not sure if this point is valid, because I am a noob when it comes to SNDNETF and RCVNETF.

          Any idea why I can't use I-Series FTP but, able to use Windows FTP client to connect to both AS/400 servers?

          Thanks
          *...1....+....2....+....3....+....4....+....5....+ ....6....+....7.......+....8.......+....9.......+. ...10.......+....11...
          C*There are only 10 type of people in this world, those who understand binary and those who don't.

          Comment


          • #6
            Re: Moving Physical file from one As/400 to another.

            Your FTP to me looks fine....

            another option is to copy the file to IFS.
            cpytoimpf or cpytostmf.

            then just move using iseries navigator
            and on target system
            use
            cpyfrmimpf or cpyfrmstmf.

            jamie
            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


            • #7
              Re: Moving Physical file from one As/400 to another.

              ok another question...is it possible for them to allow you to create a program/command on the target machines that adopts the owner's authority to execute the RSTOBJ command? if so then you can simply add the FTP subcommand
              Code:
              quo rcmd [I]MYRSTCMD[/I]
              seems to be the easiest way. if auditing is a concern then you could have the RST program log the session info, etc to a log file. i use this method on my generic FTPs (minus the log file ) that way i don't have to worry about it. (but of course i'm basically a one man shop when it comes to the AS/400 <insert your favorite name for the frigging platform here> so i don't have to worry too much. plus i also have FTP exit programs in place to prevent users, etc. from accessing any production libraries, data, etc. via FTP. the programs are pretty easy to write, etc. and can actually be a better fit for the audit logging than putting it into the RST program. that way any FTP session gets logged.
              I'm not anti-social, I just don't like people -Tommy Holden

              Comment


              • #8
                Re: Moving Physical file from one As/400 to another.

                How are the files "corrupted"? You are not trying to use FTP to CREATE the files on the target machine are you? That will not work. FTP has no concept of a DDS or field descriptions. You will have to FTP the DDS source, create the file then FTP the data.
                Denny

                If authority was mass, stupidity would be gravity.

                Comment


                • #9
                  Re: Moving Physical file from one As/400 to another.

                  Originally posted by Denny View Post
                  How are the files "corrupted"? You are not trying to use FTP to CREATE the files on the target machine are you? That will not work. FTP has no concept of a DDS or field descriptions. You will have to FTP the DDS source, create the file then FTP the data.
                  Man this is exactly what I am doing. I don't have empty physical files with same structure on my destination machine. Is that what I am supposed to do? I thought you can simply move files using FTP, and structure information will be copied too...

                  Correct me if I am wrong. Looks like I have been shooting in the dark so far. At the moment I am at home, gonna try with empty files, first thing in the morning.

                  Thanks.
                  *...1....+....2....+....3....+....4....+....5....+ ....6....+....7.......+....8.......+....9.......+. ...10.......+....11...
                  C*There are only 10 type of people in this world, those who understand binary and those who don't.

                  Comment


                  • #10
                    Re: Moving Physical file from one As/400 to another.

                    Denny is correct. if the files exist then a straight FTP should work. FTP only transfer data and has no cares about the file structure. which is also why if a save file does not exist on the target machine you have to use either namefmt 1 or create the save file prior to the transfer. if not then you'll end up with a PF with the data from the savf (which is pretty much useless to you)
                    I'm not anti-social, I just don't like people -Tommy Holden

                    Comment


                    • #11
                      Re: Moving Physical file from one As/400 to another.

                      FTP is basically a simple file data transfer system. It knows little more that the record length and nothing at the field level. You must create the DB files on the target system with DDS or SQL DDL.

                      FTP cannot transfer anything but a data file. No programs, display files or any other object type (unless you put them into a save file). If you already have the data on the target system then you should be able the create the proper DB file then do a CPYF with no check to copy the raw data to the DB file.
                      Denny

                      If authority was mass, stupidity would be gravity.

                      Comment


                      • #12
                        Re: Moving Physical file from one As/400 to another.

                        It worked. I just compiled a new PF on destination with same DDS and then did the normal Binary transfer, and my data looks fine now.

                        Thanks a lot, all of you guys for your help.

                        @Tom: I will try see if my program can get owner's authority. I can surely compile stuff on my machine.
                        *...1....+....2....+....3....+....4....+....5....+ ....6....+....7.......+....8.......+....9.......+. ...10.......+....11...
                        C*There are only 10 type of people in this world, those who understand binary and those who don't.

                        Comment


                        • #13
                          Re: Moving Physical file from one As/400 to another.

                          Originally posted by Prototype View Post
                          It worked. I just compiled a new PF on destination with same DDS and then did the normal Binary transfer, and my data looks fine now.

                          Thanks a lot, all of you guys for your help.

                          @Tom: I will try see if my program can get owner's authority. I can surely compile stuff on my machine.
                          just be aware if the owning profile does not exist on the target machines the restored object will be owned by QDFTOWN...which i'm sure will not have the necessary authority since your systems appear to be locked down pretty well...
                          I'm not anti-social, I just don't like people -Tommy Holden

                          Comment

                          Working...
                          X