Solved

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

Posted on 1998-04-03
7
376 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

803 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