Solved

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

Posted on 1998-04-03
7
378 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
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…
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…

713 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