InfoConnect for Airlines VBA Guide
HowTos / Transfer Files
In This Topic
    Transfer Files
    In This Topic

    Using the InfoConnect 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 FTP

    Transferring Files with Reflection Mainframe File Transfer

    Transferring Files with FTP

    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.

     To run this sample

    1. Open an IBM session in InfoConnect and then, from the Tools menu, open the Visual Basic Editor.
    2. Select the Common project folder, and then select Insert | Module to insert a module in the Common project.
    3. Copy the following code into the module code window.
      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
      

    4. Replace the placeholders for the host name and user name and then press F5 to run the sample.

    Transferring Files with InfoConnect Mainframe File Transfer

    This sample uses the InfoConnect 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

    To run this sample

    1. Open an IBM session in InfoConnect and then, from the Tools menu, open the Visual Basic Editor.
    2. Select the session project folder, and then select Insert | Module to insert a module into the project.
    3. Copy the following code into the module's code window.       
      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\InfoConnect\" & "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
      

    4. Replace the placeholders for the local and host file names and save the session.
    5. Back in InfoConnect, navigate to a TSO command line and run the sample.

    Concepts

    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.

     

     

    See Also