Subject: Sending commands to a AS400 FTP server
Date: 2015-08-28 15:23:25
From: Garling Beard
Source: sending-commands-as400-ftp-server
----------------------------------------------------------------------

I am sending files to an AS400 and need to run a command between each file, here is a copy of my code:
 
[code lang='c#']
 
Ftp client = new Ftp();
 
            custnum = custnum.ToString().PadLeft(10, '0');
            client.Connect("xxx");
            client.Authenticate("xxx", "xxx");
            client.Passive = true;
            client.SendCommand("SITE NAMEFMT 1");
 
            FtpResponse res = client.ReadResponse();
            Console.WriteLine(res.RawResponse);
 
            client.SetCurrentDirectory("/xxx");
            client.UploadFile("C:\\xxx\\xxx\\" + custfile, custfile);
                        
            client.SendCommand("quote rcmd call pgm(xxx / xxx) parm('"+ custnum +"')");
            FtpResponse res2 = client.ReadResponse();
            Console.WriteLine(res2.RawResponse);
            Console.ReadLine();
            client.Disconnect();
 [/code]
 
I get the following response from the AS400
500 Subcommand QUOT not valid
 
I have a FTP script that contains that command it it works using batch files and the script but not using the C# FTP component.
Can someone tell me what is wrong or will this  component not handle QUOTE commands?
---------------------------------------------------------------------- Note: This question has been asked on the Q&A forum of Thang Dang's fraudulent ComponentPro brand If you purchased anything from ComponentPro, you have been scammed. Contact the payment processor who sold you the license and ask for your money back. Back to ComponentPro Q&A Forum Index