sponsored links

Collapse

Announcement

Collapse
No announcement yet.

Retreive multiple numerically named files into a DB file using FTP.

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

  • Retreive multiple numerically named files into a DB file using FTP.

    Hi Folks

    I have a problem. I am retrieving files from a server somewhere via FTP onto the iSeries. An example of the file name is 702277810.edi, so I'd want to retrieve 70227781*.edi into either the IFS or a FILE.MBR.

    If I try to use FILE.MBR the FTP returns the error "Character (7) not allowed at the beginning of object name." (I guess it's trying to create multiple members using the source file name as the member name.)

    This is the script:
    NAMEFMT 0
    LCD MYLIB
    CD /THEIR_DIR
    MGET 70227787*.edi TEMP
    CLOSE
    QUIT

    I can get the files into the IFS using this script:
    NAMEFMT 1
    LCD "/mydir/temp"
    CD /THEIR_DIR
    MGET 70227787*.edi TEMP
    CLOSE
    QUIT

    ...however how can I then merge them together in either one STMF or a DB file? CPYFRMSTMF does not support wild cards.

    Any help would be appreciated.

    Many thanks

    Andy.

  • #2
    Re: Retreive multiple numerically named files into a DB file using FTP.

    Can you try this :

    Code:
    find /home/ -name '70227781*.edi' -exec system "CPYFRMIMPF FROMSTMF('{}') TOFILE(MYLIB/MYFILE) RCDDLM(*ALL)" \;
    or

    Code:
    find '/home/' -name '/home/'           
        -exec sort -n {} >/home/new.txt \;
    Patrick

    Comment


    • #3
      Re: Retreive multiple numerically named files into a DB file using FTP.

      Doing a search on this site (Who knew we could do that!?!) one would find an entry like this. Try it and see if it helps.

      FTP Merging
      -Rick

      _____________________________

      Need a Managed File Transfer Solution -OR- iSeries Encryption?
      GoAnywhere and Crypto Complete by Linoma Software

      Comment


      • #4
        Re: Retreive multiple numerically named files into a DB file using FTP.

        Where would I execute this code from as FIND is not as OS/400 command?

        I need to put the FTP in a CLLE program.

        Thanks.

        Comment


        • #5
          Re: Retreive multiple numerically named files into a DB file using FTP.

          Find is a QSH command. You can run this from the QSH interface (STRQSH) or from a CLLE with a QSH CMD('Find....')
          -Rick

          _____________________________

          Need a Managed File Transfer Solution -OR- iSeries Encryption?
          GoAnywhere and Crypto Complete by Linoma Software

          Comment


          • #6
            Re: Retreive multiple numerically named files into a DB file using FTP.

            Thanks for your replies.

            The method I decided to go with is to receive all of the files into the IFS and then issue a CFGHTTPSCH command to output the list of file names. Once I have this list I will loop through and issue a CPYFRMIMPF to a DB file.

            Many thanks.

            Comment

            Working...
            X