ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Tool to extract all the files of library in my local PC.

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

  • Tool to extract all the files of library in my local PC.

    Hi,

    I want to create a tool for table extraction which will be useful in my project.

    I want to create a CL tool , where i will pass library name as a parameter , and in turn it will extract all the PF files present in that library to my local PC folder .

    File extracted should be in .CSV format and each sheet should have same name as the name of PF

    Can anyone help me in this.

    Thanks

  • #2
    Re: Tool to extract all the files of library in my local PC.

    You have left out some possibly critical requirements. In a different thread, you said you were running at V4R3. If that is a part of your request, you need to be sure to list all of your requirements. Include listing any compilers you have. It'd possibly be useful to know if you have QShell available. You should probably also describe your PC environment, as well as the network connection to your AS/400.

    I don't recall how well the CPYTOIMPF command ran at V4R3. If you are at V4R3 and have no HLL compilers, that might be your best choice.
    Tom

    There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

    Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

    Comment


    • #3
      Re: Tool to extract all the files of library in my local PC.

      In a nut, use the system tables to read what tables are in a library. Then for each one do the CPYTOIMPF as he said. Then FTP all the files to your PC. You can get the free filezilla ftp server to help.
      Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

      Comment


      • #4
        Re: Tool to extract all the files of library in my local PC.

        Originally posted by DeadManWalks View Post
        In a nut, use the system tables to read what tables are in a library. Then for each one do the CPYTOIMPF as he said. Then FTP all the files to your PC. You can get the free filezilla ftp server to help.
        I am using ftp for downloading data from IFS folder to my local PC. But here i am facing one more issue. I am calling windows FTP batch file which in turn calling ftp script.
        I am using below FTP script.

        OPEN 136.***.**.90
        user KU1231
        12345
        quote site namefmt 1
        CD /HOME
        LCD C:/PINTU
        ASCII
        PROMPT
        mget *.*
        Quit


        Here FTP command is running successfully but when it coming to Quit command , CMD window not getting closed automatically.It asking to press any key to close and i need to press any key to close it. what can be done so that CMD window get closed automatically once ftp script get completed .

        Comment


        • #5
          Re: Tool to extract all the files of library in my local PC.

          Why use the batch file at all. If your doing your build on the beast, run ftp from there.

          I would remove the PROMPT.
          Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

          Comment


          • #6
            Re: Tool to extract all the files of library in my local PC.

            If the the FTP is run "on the server" (apparently "on the AS/400"), then the PC needs to have FTP Server installed in order for the AS/400 to connect to it.

            Is this still a V4R3 AS/400 that's being used? Is a shared directory a possibility for you? The File Server host server was in V4R3, but I have no idea if any modern Windows networking can work well with it.
            Tom

            There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

            Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

            Comment


            • #7
              Re: Tool to extract all the files of library in my local PC.

              Click image for larger version

Name:	Untitled.png
Views:	2
Size:	12.1 KB
ID:	126722
              Originally posted by tomliotta View Post
              If the the FTP is run "on the server" (apparently "on the AS/400"), then the PC needs to have FTP Server installed in order for the AS/400 to connect to it.

              Is this still a V4R3 AS/400 that's being used? Is a shared directory a possibility for you? The File Server host server was in V4R3, but I have no idea if any modern Windows networking can work well with it.
              Hi,

              FTP is working fine and data is coming also to my local PC.I just have issue that CMD window is not getting closed automatically. i need to press any button to closed it.

              It giving msg like " Quit subcommand received ,press any key to return" Even though i used exit command after quit its not working
              Last edited by pintusrm2010; February 18, 2014, 09:30 AM. Reason: pic attached

              Comment


              • #8
                Re: Tool to extract all the files of library in my local PC.

                try using the -v switch on the ftp command(ftp -v <host> ). no guarantees but it might work...it suppresses all responses from the remote server so it may not be sufficient for your needs even if it does work.
                I'm not anti-social, I just don't like people -Tommy Holden

                Comment


                • #9
                  Re: Tool to extract all the files of library in my local PC.

                  I suppose it could make a difference what "windows" you're using to run your script, though I don't recall related differences. You should let us know what the script is running on.

                  Also, you show the result of the FTP script; but you don't show anything about how you run the script. How is the FTP window created in the frst place? If I run a simple .BAT file that executes a FTP script, there is no window left open.
                  Tom

                  There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

                  Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

                  Comment


                  • #10
                    Re: Tool to extract all the files of library in my local PC.

                    Originally posted by tomliotta View Post
                    I suppose it could make a difference what "windows" you're using to run your script, though I don't recall related differences. You should let us know what the script is running on.

                    Also, you show the result of the FTP script; but you don't show anything about how you run the script. How is the FTP window created in the frst place? If I run a simple .BAT file that executes a FTP script, there is no window left open.
                    I am using windows 7.

                    I am using this command in my cl program

                    strpco
                    monmsg cpf0000
                    strpccmd pccmd(ftpbat.bat)

                    Now ftpbat.bat contain below inf :

                    ftp -n -s:ftpscript.txt


                    Now ftpscript.txt contain below inf.

                    OPEN 136.***.**.90
                    user KU1231
                    12345
                    quote site namefmt 1
                    CD /HOME
                    LCD C:/PINTU
                    ASCII
                    PROMPT
                    mget *.*
                    Quit
                    Exit

                    When i call CL this script called and CMD windows open and all the script runs and data moved to my local folder sucessfully but CMD window not getting closed automatically.

                    Click image for larger version

Name:	Untitled.png
Views:	2
Size:	12.1 KB
ID:	126723


                    Any other suggestion by you? Actually i am new to CL programming. Can i write FTP script inside CL program itself. If possible can you please share one example.
                    Last edited by pintusrm2010; February 19, 2014, 12:33 AM. Reason: pic attachment

                    Comment


                    • #11
                      Re: Tool to extract all the files of library in my local PC.

                      For CMD window to get closed automatically once ftp script get completed, do NOT use ".bat" nor ".cmd" as your script extension call directly the "ftpscript.txt" instead ie strpccmd pccmd(ftpscript.txt).
                      The Exit command is useless.
                      Philippe

                      Comment


                      • #12
                        Re: Tool to extract all the files of library in my local PC.

                        Hi pintusrm2010:

                        I beleive your issue is with the strpccmd. It should be:
                        strpccmd pccmd(ftpbat.bat) pause(*no)

                        Help text for pause:
                        Specifies whether the computer should pause after running
                        a command.


                        Best of Luck
                        GLS
                        The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

                        Comment


                        • #13
                          Re: Tool to extract all the files of library in my local PC.

                          Hi pintusrm2010:

                          Can i write FTP script inside CL program itself. If possible can you please share one example
                          In the below example input is the script file that the ftp cmd uses. Output is the logfile that ftp creates.
                          The second code block is the contents of mylib/mysource mymbr.

                          Code:
                               CRTPF FILE(QTEMP/FTPOUT) RCDLEN(128)  
                               OVRDBF FILE(INPUT) TOFILE(MYLIB/MYSOURCE) MBR(MYMBR) 
                               OVRDBF OUTPUT TOFILE(FTPOUT) MBR(FTPOUT) 
                                FTP        RMTSYS('1.1.1.1')
                          Code:
                               myuserid mypassword                                                  
                               CD Transmittals                                                
                               MKDIR 14                                                       
                               CD 14                                                          
                               PUT QTEMP/SPLOUT.SPLOUT CON01_HL_030201_44_121702.PDF        
                               QUIT
                          Best of Luck
                          GLS
                          Last edited by GLS400; February 19, 2014, 08:43 AM.
                          The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

                          Comment


                          • #14
                            Re: Tool to extract all the files of library in my local PC.

                            Originally posted by GLS400 View Post
                            Hi pintusrm2010:

                            I beleive your issue is with the strpccmd. It should be:
                            strpccmd pccmd(ftpbat.bat) pause(*no)

                            Help text for pause:


                            Best of Luck
                            GLS
                            This one worked . Thanks . You are genious

                            Also one more query. Some of my file contain very large amount of data which may take more than 10 minutes to complete FTP transfer. But FTP session use to be available only for 5 min. Can we increase this time gap so that FTP session not get log out in between my FTP transfer going on.

                            Comment


                            • #15
                              Re: Tool to extract all the files of library in my local PC.

                              Originally posted by pintusrm2010 View Post
                              Some of my file contain very large amount of data which may take more than 10 minutes to complete FTP transfer. But FTP session use to be available only for 5 min. Can we increase this time gap so that FTP session not get log out in between my FTP transfer going on.
                              Did you try the timeout command?

                              I often do this from a command window on my PC.

                              Code:
                              ftp> quote timeout 3600
                              250 Inactivity time-out set to 3600 seconds.

                              Comment

                              Working...
                              X