Using the Reflection API for scripted file transfers increases error handling, flexibility and security. You can use the mainframe file transfer provided with Reflection to transfer files. If your host has an FTP server, you can optionally transfer files with Secure File Transfer Protocol (SFTP).
Transferring Files with Reflection Mainframe File Transfer
This sample transfers a file from a local directory to the host, using SFTP and SSH. The sample assumes that a passphraseless key is used for authentication.
Perform FTP File Transfer |
Copy Code
|
---|---|
Sub TransferFileWithFTP() Dim ftp As Object Set ftp = CreateObject("Reflection.FTP") With ftp .UseSSH = True .UseSFTP = True 'open connection with host name and user name .Open "hostname", "guest" If .LastError <> 0 Then MsgBox .LastErrorString End If 'Send file from local directory to mainframe .SendFile "C:\junk\test.txt", "./test.txt" If .LastError <> 0 Then MsgBox .LastErrorString End If End With End Sub |
This sample uses the Reflection mainframe file transfer feature to send a file to an IBM 3270 system with a TSO operating environment.
This sample applies only to IBM terminals
Perform mainframe file transfer |
Copy Code
|
---|---|
'This sample sends a file to the host. Before you run the sample, make sure the cursor is on a TSO command line. Sub FileTransferSendSample() path = Environ$("USERPROFILE") & "\Documents\Micro Focus\Reflection\" & "test.txt" 'Set the 3270 operating environment to TSO ThisIbmTerminal.FileTransfer.XfrHostSys = HostSystem_Tso ThisIbmTerminal.FileTransfer.INDSendFile path, "fileNameOnHost.txt", INDFileTransferType_Ascii, FileExistsOption_Overwrite, True End Sub |
To fully automate a TSO file transfer, you could set up the macro to navigate to the screen with the TSO command line and place the cursor on the line (see Navigating Sessions and Controlling Macro Execution.