This is a HTML application that uses VBScript and the Windows DOS ftp command to download a file from the mainframe. Very handy for files that you have to download on a daily basis. You can customize the code (it is all in text) and download multiple files or change it to upload. Although I use it to download files from the mainframe you can use it for any FTP server.
What you need to do:
- Cut and save the code below and save it on your desktop.Give the file a .HTA file extension.
- Edit the code with notepad and change the DNS server addresses for your FTP servers.
To execute simple double click on the .HTA file. This will open with Internet Exploder (sorry Explorer). You can then supply your mainframe z/OS user id and password. Specify your file name in the box(without quotes) and click download. The file will be downloaded to your desktop.
Read more >>
What you need to do:
- Cut and save the code below and save it on your desktop.Give the file a .HTA file extension.
- Edit the code with notepad and change the DNS server addresses for your FTP servers.
To execute simple double click on the .HTA file. This will open with Internet Exploder (sorry Explorer). You can then supply your mainframe z/OS user id and password. Specify your file name in the box(without quotes) and click download. The file will be downloaded to your desktop.
<head>
<title>Mainframe Transfer FTP</title>
<HTA:APPLICATION
APPLICATIONNAME="MF FTP xfr"
SCROLL="yes"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
>
</head>
<script language="VBScript">
Sub TestSub
Dim FSO, WS, ftpServer, username, password, ftpFile1,ftpFile2, putType, NewFile, Target
Set FSO = CreateObject("Scripting.FileSystemObject")
Set WS = CreateObject("WScript.Shell")
ftpServer = Environment.value
username = MFUser.value
password = MFPass.value
ftpFile1 = "'" & MFName1.value & "'"
putType = "asci"
Target = "C:\TEMP_FTP.txt"
If (FSO.FileExists(Target)) Then
FSO.DeleteFile(Target)
Set NewFile = FSO.OpenTextFile(Target, 2, "True")
Else
Set NewFile = FSO.OpenTextFile(Target, 2, "True")
End If
NewFile.WriteLine "open " & ftpServer
NewFile.WriteLine username
NewFile.WriteLine password
NewFile.WriteLine putType
NewFile.WriteLine "get " & ftpFile1 & " FILE.TXT"
NewFile.WriteLine "close"
NewFile.WriteLine "bye"
NewFile.Close()
WS.Run "cmd /k ftp -s:" & Target,1,true
FSO.DeleteFile(Target)
End Sub
</script>
<body>
<p>
<table>
<tr><td>Environment:</td><td><select size="1" name="Environment">
<option selected value="unit.somewhere.com">Unit</option>
<option value="it.somewhere.com">Integration</option>
<option value="uat.somewhere.com">User Acceptance</option>
<option value="prod.somewhere.com">Production</option>
</select></td></tr>
<tr><td>Mainframe User-Id:</td><td><input type="text" name="MFUser" size="8"></td></tr>
<tr><td>Mainframe Password:</td><td><input type="password" name="MFPass" size="8"></td></tr>
<tr><td>Mainframe Dataset:</td><td><input type="text" name="MFName1" size="50">File</td></tr>
</table></p>
<input type="button" value="Download from Mainframe" name="run_button" onClick="TestSub"><p>
</body>

