FTP Documents to a Mainframe

I needed to upload some documents to an IBM mainframe. The problem was that the mainframe's default type was variable block and the dataset needed to be fixed block. So, by running the following agent with the MVSFTP.BAT below I achieved the results required.

ftp -s:g:\informat\common\scttos\command.ftp
>g:\informat\common\scttosoutput.ftp

This has only been tested on a Windows client.


Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim TaskID As Integer
Dim ftpOutput As String
Set uidoc = workspace.CurrentDocument

'''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''
' Build the command file for the FTP to use
'''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''

Open "g:\informat\common\scttos\command.ftp" For Output As #1
Print #1, "open ftp.YourSite.Org"
Print #1, Inputbox$("Enter your user id")
Print #1, Inputbox$("Enter your password")
Print #1, "quote site lrecl=80 recfm=fb blksize=7440"
Print #1, "put g:\informat\common\scttos\";"temp.txt";" ";Inputbox$("Enter your Host filename")
Print #1, "quit"
Close #1

'''''''''''''''''''''''''''
'''''''''''''''''''''''''''
' Run the FTP
'''''''''''''''''''''''''''
'''''''''''''''''''''''''''
TaskID = Shell("g:\informat\common\scttos\mvsftp.bat",1)

'''''''''''''''''''''''''''
'''''''''''''''''''''''''''
' Wait for the FTP to get started and delete the command file
'''''''''''''''''''''''''''
'''''''''''''''''''''''''''
Sleep 10
Kill "g:\informat\common\scttos\command.ftp"
Kill "g:\informat\common\scttos\temp.txt"
'''''''''''''''''''''''''''
'''''''''''''''''''''''''''
' Report the results to the user
'''''''''''''''''''''''''''
'''''''''''''''''''''''''''
Open "g:\informat\common\scttos\output.ftp" For Input As #1
ftpOutput = Input$(Lof(1),#1)
If (Instr(1, ftpOutput, "250") <> 0) Then
ftpOutput = ftpOutput + Chr$(10)+ "TRANSFER WAS SUCCESSFUL"
Else
ftpOutput = ftpOutput + Chr$(10)+ "TRANSFER HAS FAILED"
End If
Messagebox ftpOutput, MB_OK, "FTP Output"
Close #1

This was first published in November 2000

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.