Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP

Status
Not open for further replies.

121854

MIS
Aug 2, 2003
60
0
0
US
Does anyone has FTP jcl to download a TSO file to my own pc? I tried to use the FTP command from the DOS prompt and I'm not able to get acccess.

Any help will be appreciated.

 
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

With ftpInfo
hlINetSession = InternetOpen("MyFTPClient", 1, "", "", 0)
hlSession = InternetConnect(hlINetSession, .MAINFRAME_ADDRESS, False, .USER_ID, .PASSWORD, 1, 0, 0)

fnGetFile = FtpGetFile(hlSession, .MAINFRAME_FILE_NAME, .PC_FILE_NAME, False, &H80000000, &H1, 0)

Call InternetCloseHandle(hlSession)
Call InternetCloseHandle(hlINetSession)
End With

End Function


Sub Main()
Dim ftpInfo As udtFtpInfo

With ftpInfo
.MAINFRAME_ADDRESS = "sysc.servername.com"
.USER_ID = "userid"
.PASSWORD = "password"
.MAINFRAME_FILE_NAME = "'full.dataset.name'"
.PC_FILE_NAME = "c:\results.txt"
End With

Call fnGetFile(ftpInfo)

End Sub
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top