Try this It uses the internet controls, but with late binding and api's:
Option Explicit
Declare Function FtpGetFile Lib "wininet.dll" Alias "FtpGetFileA" ( _
ByVal hFtpSession As Long, _
ByVal lpszRemoteFile As String, _
ByVal lpszNewFile As String, _
ByVal fFailIfExists As Long, _
ByVal dwFlagsAndAttributes As Long, _
ByVal dwFlags As Long, _
ByVal dwContext As Long) As Long
Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" ( _
ByVal sAgent As String, _
ByVal nAccessType As Long, _
ByVal sProxyName As String, _
ByVal sProxyBypass As String, _
ByVal nFlags As Long) As Long
Declare Function InternetConnect Lib "wininet.dll" Alias "InternetConnectA" ( _
ByVal hInternetSession As Long, _
ByVal sServerName As String, _
ByVal nServerPort As Integer, _
ByVal sUsername As String, _
ByVal sPassword As String, _
ByVal nService As Long, _
ByVal dwFlags As Long, _
ByVal dwContext As Long) As Long
Declare Function InternetCloseHandle Lib "wininet.dll" ( _
ByVal hInet As Long) As Integer
Type udtFtpInfo
USER_ID As String
PASSWORD As String
MAINFRAME_ADDRESS As String
MAINFRAME_FILE_NAME As String
PC_FILE_NAME As String
End Type
Function fnGetFile(ftpInfo As udtFtpInfo) As Integer
Dim hlINetSession As Long
Dim hlSession As Long
First, here is sample JCL from OS/390 to download a file.
//FTPSTP1 EXEC PGM=FTP,REGION=2048K,
// PARM='172.16.13.16 21 (TIMEOUT 20'
//* 172.16.13.16 is address of intended receiver of data
//* 21 is the FTP port
//STEPLIB DD DSN=TCPIP.SEZALINK,DISP=SHR
//SYSTCPD DD DSN=TCPIP.PARMLIB(TCPDATA),
// DISP=SHR
//SYSFTPD DD DSN=TCPIP.PARMLIB(FTPDATA),
// DISP=SHR
//SYSMDUMP DD SYSOUT=X
//SYSPRINT DD SYSOUT=X
//OUTPUT DD SYSOUT=X
//INPUT DD *
mvs2dumbo 38Dum1Bo <== userid+pw
CD ..
CD ..
PUT 'TEST.TBLA' TBLA.CSV
CLOSE
QUIT
/*
You must have a TSO userid on the mainframe to perform this
and RACF must be altered to allow FTP to/from this userid.
Otherwise, DOS FTP should probably be made to work
before you attempt the download.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.