ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

FTP from PC to AS/400 using mput

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

  • FTP from PC to AS/400 using mput

    I have a vbscript (see below) where I am trying to use the "mput" to ftp multiple files to an AS/400. The "mput" does not seem to work, at least I am not getting records into the receiving file. If I use the "put" it works and one file is being transferred. Any ideas? Thank you.
    PHP Code:
    strLocalFolderName "e:\ftpdata\fromcustomer"
    strFTPServerName "vgsys400.mycompany.com"
    strLoginID "userid"
    strPassword "password"
    strFTPServerFolder "vgiprdhrp"

    'Set File name
    strFilePut = "*.txt"
    strFilePut1 = "f5508607i"

    '
    Generate FTP command
    strFTPScriptFileName 
    strLocalFolderName "Customer Inbound FTP Files to AS400"

    Set objFSO CreateObject("Scripting.FileSystemObject")

    If (
    objFSO.FileExists(strFTPScriptFileName)) Then
        objFSO
    .DeleteFile (strFTPScriptFileName)
    End If

    Set objMyFile objFSO.CreateTextFile(strFTPScriptFileNameTrue)

    objMyFile.WriteLine ("ftp -s: " strFTPServerName)
    objMyFile.WriteLine ("open " strFTPServerName)
    objMyFile.WriteLine (strLoginID)
    objMyFile.WriteLine (strPassword)
    objMyFile.WriteLine ("cd " strFTPServerFolder)
    objMyFile.WriteLine ("lcd " strLocalFolderName)
    objMyFile.WriteLine ("prompt off")
    objMyFile.WriteLine ("mput " strFilePut " " strFilePut1objMyFile.WriteLine ("disconnect")
    objMyFile.WriteLine ("bye")
    objMyFile.Close

    'Run ftp script
    Set objShell = WScript.CreateObject( "WScript.Shell" )
    objShell.Run ("ftp -s:" & chr(34) & strFTPScriptFileName & chr(34)) 

  • #2
    Re: FTP from PC to AS/400 using mput

    It looks like you're trying to rename the files you're "MPutting" onto the remote box. I don't think it works that way. MPUT allows you to push multiple files using a wildcard ... ex:

    MPut F*.txt

    -OR-

    MPut File1.txt File2.txt File3.dat

    "Put" will allow you to push a SINGLE file up and rename it which is probably why your PUT job works.

    Try pushing them up as named and see what happens.

    -R

    Comment


    • #3
      Re: FTP from PC to AS/400 using mput

      I think this is the way AS/400 interpets the put command:

      objMyFile.WriteLine ("put " & strFilePut & " " & strFilePut1)

      the "strFilePut1" in the target file/table on the AS/400 where you want to place the ftp file.

      If I do "put Filea.txt F0001" it works fine, the command will place the file FileA into file F0001 on the As/400. I've tested this.

      It is when I try the "mput" it does not seem to work.

      Comment


      • #4
        Re: FTP from PC to AS/400 using mput

        Exactly .. the MPUT does NOT allow you to "rename" the file as you put it like the "PUT" command. It only allows you to copy from the Local Dir to the Curr Dir on the Remote Box.

        Comment


        • #5
          Re: FTP from PC to AS/400 using mput

          I guess then I will have to read through the file collection and use the "put" command. Question: Does ftp allow me to append to the file on the remote box?

          Comment

          Working...
          X