using mget ftp command with iSeries

180 pts.
Tags:
AS/400 FTP
FTP
MGET
I'm trying to ftp some files to the as/400 using mget. The files I'm pulling have the same 1st 10 characters. The as/400's file name limit is 10 characters so after the 1st file is ftp'ed the mget ends stating that the file already exists and the mget ends. Does anyone know of a way around this issue? Even though the 1st 10 characters of the file name are the same, the remaining characters in the name differ as do the contents of the file. I need all of the files. Any help would be appreicated.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi TLloyd

I cannot see how MGET will work for you unless you rename the files on your server so they are unique in the first 10 char.

Otherwise you will need to get a directory listing and create a script of get’s with each to-file name being unique.

Phil

Discuss This Question: 6  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Splat
    I've got a program that generates the following FTP source:
    [login]                                         
    ascii                                                   
    get [source file]  [library]/[target file].[member] (replace
    delete [source file]                                
    quit
    The file(s) being retrieved have names much longer than 10 characters, but the [library]/[target file].[member] format allows you to rename it to whatever you like. We've agreed on a specific format for the source file name, incorporating the date created, so I can just use a program to build the FTP instructions. Our target file is a multi-member file, with one field per record (the length of the field/record is based on the maximum possible length of an incoming record). Hope this helps.
    7,405 pointsBadges:
    report
  • Cwc
    You can also put the files into a different file system in the IFS, so that you won't have the 10 character limit. For example, to retrieve all files having a .PRN extension and to put them into a directory named MYIFSDIR, use the following FTP commands after connecting to the server and logging on, etc.: Namefmt 1 LCD /MYIFSDIR MGet *.PRN Then, depending on what you ultimately want to do with them, you could get a list and copy them into the QSYS.LIB file system with the CPYFRMIMPF command. If you want to process each one, you could copy the first one, process it, and then copy the next one into the same file name and process it, and continue until all are done.
    4,290 pointsBadges:
    report
  • TLloyd
    I like the IFS idea. I did not know that file name lengths could be greater than 10. CWC........by chance to you have a sample of cpyfrmimpf? I am not familiar with this command. Thank.s for all the help.
    180 pointsBadges:
    report
  • Cwc
    Here's an example of CPYFRMIMPF (copy from import file). It has numerous parameters which make it quite flexible, so you may have to experiment with it to see which ones are applicable for your situation. This one will copy a text file named MYFILE.PRN to a database file named MYFILE (which is implicitly in the QSYS.LIB file system). CPYFRMIMPF FROMSTMF(/MYIFSDIR/MYFILE.PRN) TOFILE(MYFILE) MBROPT(*REPLACE) RCDDLM(*CRLF) RMVBLANK(*NONE) So my solution would be that once you have the a list of file names that were retrieved via the MGET command, you could create a CL loop that would read through that list and process each file with a command similar to the one above. As far as getting a list of files in the IFS that could be read in CL, there are at least two ways that I can think of: --the FTP Dir command can be redirected to write to a disk file instead of the screen --create an IFS utility that will use the Unix APIs [ opendir(), readdir(), and closedir() to get a list of the files (I have one that I downloaded from somewhere a while back). ----and I should also mention the DSPDLO command. Its advantage is that it's easy to use and already part of the operating system. But the disadvantage is that it only works on the /QDLS file system, which has the old DOS 8.3 naming convention limit which is what you're trying to avoid. So, I don't recommend this one so much unless the file names you're dealing with don't and won't ever exceed that limitation.
    4,290 pointsBadges:
    report
  • Cwc
    Sorry, I meant the DSPFLR command in my comments above, and not DSPDLO.
    4,290 pointsBadges:
    report
  • TLloyd
    Thanks CWC. It works well.
    180 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following