ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Unzipping .tar.gz files on IFS

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

  • Unzipping .tar.gz files on IFS

    Hi,
    We get a .tar.gz file ftp'd to our IFS each week and I would like to know if I can unzip the file using standard system I functionality via a program so the whole process can be automated.
    Currently, I'm unzipping it manually, then copying the contents back to the same IFS directory and then calling required functions.

    Regards

  • #2
    Re: Unzipping .tar.gz files on IFS

    looks like u got the posting figured out...

    try here for starters


    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


    • #3
      Re: Unzipping .tar.gz files on IFS

      Hi Stewart,

      You may want to try the STRPCCCMD command to invoke whatever your flavour of unzipping program is from the 400. Would be a quick and dirty way of doing it if what Jamie suggested doesn't work out for you.

      Comment


      • #4
        Re: Unzipping .tar.gz files on IFS

        But how do you structure the command to perform the unzipping the tar.gz file. For example the tarfile on IFS is;
        /directory1/directory2/abc.tar.gz

        how do enter the command line to unzip files to the same directory. Findind it difficult to find that information.

        Thanks

        Comment


        • #5
          Re: Unzipping .tar.gz files on IFS

          adding zip/unzip to system i - all need files in zip file attached




          Here are the steps to add the Unzip and Zip functions to your System i server:
          1. Go to the following File Transfer Protocol (FTP) site and download the archives:


            In our case, we download these files:

            zip23x-aix43.zip To compress (zip) files
            unz550x-aix5L.tar.gz To uncompress (unzip) files
          2. Place these files somewhere on your System i server. In this example, we use /home/zip.
          3. You will also need the gunzip tool to uncompress the unz550x-aix5L.tar.gz file. Download the tool from the following Web site:


            Place the file in the same directory as the other two files.
            Review the license agreement for the downloaded tools.
          4. Sign on to your System i server and start an i5/OS PASE terminal with the command:

            Code:
            CALL QP2TERM
          5. Change to the /home/zip directory:

            Code:
            cd /home/zip
          6. The unzip file is a compressed file. Uncompress this file:

            Code:
            uncompress gzip.1.2.4a.tar.Z
          7. Untar? the gzip tar file:

            Code:
            tar -xvf gzip.1.2.4a.tar
            It installs the executable files under the /usr/local/bin directory.

          8. Update the PATH variable with the /usr/loca/bin directory by running this command:

            Code:
            export PATH=$PATH:/usr/local/bin
          9. Uncompress the unz550x-aix5L.tar.gz file using this command:

            Code:
            gunzip unz550x-aix5L.tar.gz
          10. ?Untar? the uncompressed file:

            Code:
            tar -xvf unz550x-aix5L.tar
            It creates the directory unzip-5.50.
          11. Change to this directory:

            Code:
            cd unzip-5.50
          12. Enter the following command:

            Code:
             unzip
            It shows you the command usage text.

          13. To run the command from any directory and any terminal window, you have to copy the unzip file into the /QOpenSys/usr/bin directory:

            Code:
            cp unzip /QOpenSys/usr/bin
          14. Switch back to the directory to which you have downloaded the files:

            Code:
            cd /home/zip
          15. Now check whether unzip is really working. The Zip program on our system is packed in the zip file - zip23x-aix43.zip, so we can try on that one. Verify that you are in the directory in which the zip23x-aix43.zip file is located. Enter the following command:

            Code:
            unzip -d ./zip zip23x-aix43.zip
          16. This creates a directory named zip and places all files into that directory. Change to this directory:

            Code:
            cd zip
          17. Issue the following command to see if the program is working:
            Code:
             zip
            This will show the usage notes.
          18. To make the command available in every i5/OS PASE terminal session, copy the program into the /QOpenSys/usr/bin directory.

            Code:
              cp zip /QOpenSys/usr/bin
          19. To use both commands (zip and unzip) in QShell, make another copy of the programs into the /usr/bin directory by running 2 commands:

            Code:
            cp /QOpenSys/usr/bin/zip /usr/bin 
            cp /QOpenSys/usr/bin/unzip /usr/bin
            Now zip and unzip are available for the next QShell terminal.

          Attached Files
          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


          • #6
            Re: Unzipping .tar.gz files on IFS

            Hi all,

            I have installed the zip/unzip utilities posted by Jamie. It is working only that i have found out that i cannot work on files larger than 2Gig.

            I am zipping large savefiles more than 2G in size. Is there some fix available?

            Thanks,
            Greg

            Comment


            • #7
              Re: Unzipping .tar.gz files on IFS

              Greg is this a limitation of the size of the folder on the IFS?
              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


              • #8
                Re: Unzipping .tar.gz files on IFS

                Hi Jamie,

                Sorry for the late response on this. It is not a limitation of the folder in the ifs. I think it is a limitation on the Zip program because I can able to zip files but for those files which are larger than 2Gig, all i get is a log which says something like :
                zip warning: name not matched: mybigfile.savf
                zip error: Nothing to do! (/bckup_dir/CLNUP05_06/mybigfile.zip)

                Comment


                • #9
                  Re: Unzipping .tar.gz files on IFS

                  Okay dont laugh this is actually this easy...

                  I have 4 .csv files created in QTEMP
                  I need to email these to the user that
                  just created them....

                  created folder on root called ZIP
                  (this works fine for me cause Im the only one doing this)
                  You will need to create subfolders by job to release this
                  to the hounds.
                  PHP Code:
                  MD DIR(zipDTAAUT(*RWXOBJAUT(*ALL

                  In my case I just ran 4 cpytoimpf commands

                  PHP Code:
                  CPYTOIMPF FROMFILE(QTEMP/WKR20WORK1TOSTMF('zip/wkr20work1.csv')
                  STMFCODPAG(*PCASCIIRCDDLM(*CRLF)      

                  CPYTOIMPF FROMFILE(QTEMP/WKR20WORK2TOSTMF('zip/wkr20work2.csv')
                  STMFCODPAG(*PCASCIIRCDDLM(*CRLF)      

                  CPYTOIMPF FROMFILE(QTEMP/WKR20WORK3TOSTMF('zip/wkr20work3.csv')
                  STMFCODPAG(*PCASCIIRCDDLM(*CRLF)      

                  CPYTOIMPF FROMFILE(QTEMP/WKR20WORK4TOSTMF('zip/wkr20work4.csv')
                  STMFCODPAG(*PCASCIIRCDDLM(*CRLF
                  Then to get them to the zip file......named profit.zip

                  PHP Code:
                  STRQSH CMD('jar cfM zip/profit.zip zip/*.*'
                  *** Note dont run this I think it would zip the entire IFS into a zip file
                  that can never turn out GOOD!
                  PHP Code:
                  STRQSH CMD('jar cfM zip/profit.zip *.*'
                  anyway then you have your files all zipped up and
                  can send them to anyone you wish with your favorite
                  email process. (there are a couple posted on the site)



                  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


                  • #10
                    Re: Unzipping .tar.gz files on IFS

                    Okay now I have this zip file that I can create at will...

                    What is the easiest way I can email this file from the IFS?


                    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


                    • #11
                      Re: Unzipping .tar.gz files on IFS

                      This'll do it ... it's really great software... it's for free - no configuration on the i required.
                      Only does (up to) 4 attachments though.

                      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


                      • #12
                        Re: Unzipping .tar.gz files on IFS

                        Thanks Kit...combined with my zipping code I only need one attachment
                        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

                        Working...
                        X