I have a file that I'm sending to an external agency. It is a text file where each record has a length of 1200.
at the end of each record, I add enough ' ' until the length equals 1200.
When I transfer the file, (see code below), the name of the file I'm putting on the server also has to have a length of 1200. So again, I'm adding ' ' to the end of the file name string. However, when I pass strFileName to the Put procedure, it's too long!! I have added the site command prior to the put command (without the ' ' at the end of the file name) which I was told would set the correct length, but that didn't work either.
Any suggestions?
Leslie
Code:
MP 218 John Doe 123 Main St.
MP 218 Jane Johnson 312 S. Nowhere Ave
MP 218 Thomas Thompson 456 N. Anywhere
at the end of each record, I add enough ' ' until the length equals 1200.
When I transfer the file, (see code below), the name of the file I'm putting on the server also has to have a length of 1200. So again, I'm adding ' ' to the end of the file name string. However, when I pass strFileName to the Put procedure, it's too long!! I have added the site command prior to the put command (without the ' ' at the end of the file name) which I was told would set the correct length, but that didn't work either.
Any suggestions?
Leslie
Code:
procedure TfrmMain.TransferPaymentFile1Click(Sender: TObject);
var
strFileName : string;
begin
if frmMain.OpenDialog1.Execute then
begin
FTP_AOC.Connect(True);
If FTP_AOC.Connected then
begin
FTP_AOC.ChangeDirUp;
FTP_AOC.ChangeDir('FA1.MET.UPLOADS');
//FTP_AOC.Site('lrecl=1200 blksize=0 recfm=fb cyl pri=1 sec=1');
strFileName := 'G0001V04';
while length(strFileName) < 1200 do
strFileName := strFileName + ' ';
FTP_AOC.Put(OpenDialog1.FileName, strFileName);
FTP_AOC.Disconnect;
end
else
ShowMessage('Not connected');
end;
end;