Solved

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

Posted on 1998-04-03
7
379 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
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!

 

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…

734 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