Solved

Shelling out a .BAT file to execute FTP in VB 5.0

Posted on 1998-04-03
7
377 Views
Last Modified: 2008-03-03
I am having a problem shelling out a .BAT file that executes FTP (VB 5.0).  FTP gets a quit command prior to the file transfer.  Please note that when I execute this .BAT file from DOS, it transfers the file without error.  The code shown below is working under VB 3.0.
---------------------------------------------
  Dim lWhnd as Long
  Dim sStartTime as String
  lWhnd = Shell("C:\FTPUPLD.BAT", 6)
  sStartTime = Now
  Do While DateDiff("s", sStartTime, Now) < 30
    DoEvents
  Loop
-------------------------------------------
The FTP output is listed below:

Connected to {IP ADDRESS NOT DISCLOSED FOR SECURITY}.
220-NETIFTP IBM MVS V3R1 at SYS.COM, 09:43:54 on 1998/04/03
220 Connection will close if idle for more than 5 minutes.
ftp> 221 Quit command received. Goodbye.
----------------------------------------------
The FTP program referred to in this question is FTP.EXE included with Windows 95.

Thank you for your time and attention to this matter.
-David
0
Comment
Question by:dfhaines
  • 4
  • 2
7 Comments
 

Expert Comment

by:mirk
ID: 1460308
Hi again David,
I'm doing a very similar thing with VB5 under NT, I found I had to create a "script" file for FTP to work correctly...

heres the text from the Win95 help

-s:filename    Specifies a text file containing FTP commands; the
               commands will automatically run after FTP starts.

Are you running something like this?  It would be helpful to see the batch file, or at least get an idea of what it is doing :)
Mirk.
0
 

Author Comment

by:dfhaines
ID: 1460309
Mirk,

Perhaps the "script" file to which you refer is equivalent to the .CTL file I call from the .BAT file used to start FTP.  I create the .CTL file on the fly each time I run the app.  The .CTL and .BAT file contents are listed below.

--------------------- .BAT ----------------------
c:\windows.000\ftp.exe -n -s:C:\FTPUPLD.ctl {IP ADDRESS} > c:\FTPUPLD.log
--------------------- .CTL ----------------------
user {USER NAME} (USER PASSWORD}
literal site recfm=fb
literal site lrecl=718
literal site bl=27284
put {SOURCE FILE} {DESTINATION FILE NAME}
-------------------------------------------------
I hope this information is helpful.

Thanks for your quick response.

David
0
 
LVL 1

Accepted Solution

by:
ggnabasik earned 70 total points
ID: 1460310
Why not use the internet control which comes with VB ?
There are also third party controls which make this very, very easy...
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:dfhaines
ID: 1460311
ggnabasik,

Thank you for your suggestion.  In order for the file to reach the mainframe in the correct format, I need to specify the following parameters:
----------------------
literal site recfm=fb
literal site lrecl=718
literal site bl=27284
----------------------
How might I pass these parameters when I execute the transfer?
-David

0
 

Author Comment

by:dfhaines
ID: 1460312
ggnabasik,

Clarification:  How might I pass these parameters when I execute the transfer via the Microsoft INET Control?

-David
0
 
LVL 1

Expert Comment

by:ggnabasik
ID: 1460313
I guess you can't using the Microsoft Control.  However, you might want to try the controls by Mabry (www.mabry.com) or Distinct (www.distinct.com).  Good Luck
0
 

Author Comment

by:dfhaines
ID: 1460314
ggnabasik,

I successfully ran FTP with Mabry's FTP control.  I passed the necessary LRECL and BLKSIZE parameters via the WRITEDATA and WRITE methods.

Thanks for your input.
-David
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

838 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question