Solved

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

Posted on 1998-04-03
7
371 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…

706 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now