IBM Support

Using FTP to Transfer a Variable Blocked File with Binary Data

Troubleshooting


Problem

FTP does not provide direct support to transfer an MVS variable blocked file which contains binary data from one system to another. This is especially true if the file must be transferred through one or more intermediate servers which are not z/OS.

Resolving The Problem

You can transfer a variable blocked file with binary data included within it between z/OS system(s) if the following conditions apply:

  1. Client is a z/OS system.
  2. Server is a z/OS system
  3. EBCDIC and BLOCK are used for the transfer:
    type e
     mode b

If the file is first transferred to an intermediate non-z/OS server before being sent to its final destination, the above technique will not work because the above transfer type is EBCDIC which will not be supported.

If you transfer the file in binary mode, it will not work as there is no record delimiter inserted into the data stream to separate the individual records. When the file is received at the destination host, FTP is unable to replicate the original file as data integrity is lost.

Although FTP provides capability by way of the RDW option to include the length of the data being transferred to a remote system at the beginning of each record, it becomes part of the data for that record and will not be recognized by the FTP at the final destination as an RDW.

To transfer a variable blocked file, you must build an intermediate file on the source mainframe and then transfer it through the network to the destination in binary mode. At the destination, the original source file is restored from the transferred file.

Following is a summary of methods which you can use to accomplish this transfer:


Method 1: FTP only method

        LOCAL                    REMOTE
        z/OS         non          z/OS  
      +-------+      z/OS       +-------+
   +--|  MVS  |     server      |  MVS  |<-+
 1.|  |       |     +----+      |       |  |4.
   |  |-------|     |    |      |-------|  |
   +->| local |---->|    |----> | local |--+
      | HFS   | 2.  +----+ 3.   | HFS   |
      +-------+                 +-------+
 
   1. Create an intermediate file in the local HFS.
   2. Transfer the intermediate file to the
      server in binary mode.
   3. Transfer the intermediate file from the
      server to the remote host's local HFS in
      binary mode.
   4. Transfer the file from the local HFS into
      an MVS dataset.


Method 2: Utilize the TSO TRANSMIT/RECEIVE commands in conjunction with FTP.                


         LOCAL                    REMOTE
         z/OS         non          z/OS  
      +--------+      z/OS       +---------+
   +--| SRC D/S|     server      | Dest D/S|<-+
 1.|  |        |     +----+      |         |  |4.
   |  |        |     |    |      |         |  |
   +->| XMIT   |---->|    |----> | XMIT    |--+
      | COPY   | 2.  +----+ 3.   | COPY    |
      +--------+                 +---------+

   1. Use the TSO TRANSMIT command and create an
      intermediate file.
   2. Transfer the intermediate file to the
      server in binary mode.
   3. Transfer the intermediate file from the
      server to the remote host's local HFS in
      binary mode.
   4. Use the TSO Receive command to extract
      the file to its original format.


Method 3: Terse the data and transmit via FTP.                


         LOCAL                    REMOTE
         z/OS         non          z/OS  
      +--------+      z/OS       +---------+
   +--| SRC D/S|     server      | Dest D/S|<-+
 1.|  |        |     +----+      |         |  |4.
   |  |        |     |    |      |         |  |
   +->| TERSED |---->|    |----> | TERSED  |--+
      | COPY   | 2.  +----+ 3.   | COPY    |
      +--------+                 +---------+

   1. Terse the data to create a
      tersed dataset.
   2. Transfer the intermediate file to the
      server in binary mode.
   3. Transfer the intermediate file from the
      server to the remote host's local HFS in
      binary mode.
   4. Extract the data from the tersed dataset
      into its original format.

Additional detail on each of the described methods follows:

Method 1: FTP only method 

This approach uses FTP to create an intermediate file to be transferred.

1. Create an intermediate file in the local HFS.

     Sample FTP commands:
     loopback
     your_userid your_password
     mode b
     type e
     quote type i
     quote mode s
     sendsite
     put source_file /tmp/source_file.bin

where: source_file is the file in MVS and /tmp/source_file.bin
is the name of the file in the HFS.

In this step, the FTP client is set up to transmit an EBCDIC
file in BLOCK mode. The server is set up to receive a binary image in stream mode.

2. Transfer the intermediate file to the server in binary mode.

   Sample FTP commands:
   remote_server_hostname
   remote_server_userid remote_server_password
   type i
   sendsite
   cd appropriate_remote_directory
   put /tmp/source_file.bin source_file.bin

3. Transfer the intermediate file from the server to the remote
   host's local HFS in binary mode.

   Sample FTP commands:
   remote_server_hostname
   remote_server_userid remote_server_password
   type i
   cd appropriate_remote_directory
   lcd local_hfs_directory
   get source_file.bin

4. Transfer the file from the local HFS into an MVS dataset.

   Sample FTP commands:
   loopback
   your_userid your_password
   type i
   mode s
   quote mode b
   quote type e
   site recfm=vb lrecl=214 blksize=27998
   lcd local_mainframe_hfs
   put source_file.bin mvs_destination_file

   You must tailor the SITE command to the specific values of
   the originating source file.  In this example the originating
   file had an LRECL=214 and BLKSIZE=27998. This step reverses
   the data transfer performed in step 1 to create the dataset
   into the HFS.

Method 2: Utilize the TSO TRANSMIT/RECEIVE commands in conjunction with FTP.

1. Use the TSO TRANSMIT command to create an XMIT copy of the
    file to be sent.
    TRANSMIT userid da(source_file)
               outdsn(source_file.xmit) seq
    where: userid is a valid MVS TSO ID
           source_file is file name of file to be transmitted
           source_file.xmit is same name as source file with
           xmit as a suffix.
    This creates a file with consistent attributes which has
    encoded within it the file attributes of the file being
    transmitted and the originator of that file.

 2. Transfer the intermediate file to the server in binary mode.

    ftp remote_server_host_name
    remote_userid  remote_password
    type i
    mode s
    put source_file.xmit

 3. Transfer the intermediate file from the server to the remote
    host's local HFS in binary mode.

    ftp remote_server_host_name
    userid
    password
    type i
    mode s
    locsite recfm=fb lrecl=80 blksize=3120
    get source_file.xmit mvs_file_name.xmit
             
    where: mvs_file_name is the name of the file saved on the
    MVS host with .xmit as a suffix.

    The attributes on the locsite command are the attributes of
    the file created by the TSO TRANSMIT command.  

 4. Extract the file from the received data set.  In using this
    command, you will receive a prompt for restore parameters.

    RECEIVE indsn(mvs_file_name.xmit)
    Dataset source_file from userid on hostname
    Enter restore parameters or 'DELETE' or 'END' +

    Entering a null line will result in the source_file being
    created.

    Enter the following to create a different file name:

    da('new_source_file_name')                          

    Restore successful to dataset
    file_name_of_created_file    

    After the file has been successfully restored, the
    mvs_file_name.xmit can be deleted.

Method 3: Terse the data and transmit via FTP.

Please refer to the appropriate document for detailed instructions on using IBM's tersing utilities:

[{"Product":{"code":"SSSN3L","label":"z\/OS Communications Server"},"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Component":"All","Platform":[{"code":"PF035","label":"z\/OS"}],"Version":"1.6;1.7;1.8;1.9;1.10;1.11;1.12;1.13;2.1;2.2;2.3","Edition":"All Editions","Line of Business":{"code":"LOB35","label":"Mainframe SW"}}]

Document Information

Modified date:
15 June 2018

UID

swg21188301