Transfer() action

From The x3270 Wiki

The Transfer() action is the way to do file transfers in scripts, as well as at the x3270> prompt.

Parameters

At the x3270> prompt, Transfer() can be invoked with no parameters. It will prompt interactively for the parameters it needs.

Otherwise, it takes a number of parameters, consisting of option names and values. Values can be specified in one of two ways. They can be attached to the option name:

option=value

Or they can be specified separately:

option,value

Options

direction
The direction of the transfer.
The value send means sending a file to the host. This is the default.
The value receive means receiving a file from the host.
hostfile
The name of the file on the host. This option is required.
localfile
The name of the file on the workstation. This option is required.
If doing a receive, this option can also specify a local folder. The name of the local file is then taken as the same as the name of the host file.
host
Defines the host type: tso (the default), vm or cics.
mode
Specifies whether the file contains text or opaque data.
The value ascii indicates a text file, which may involve translation between the host and workstation. This is the default.
The value binary indicates a binary file, which is untranslated.
cr
Defines how end-of-line (the newline character or the CR/LF sequence) is handled during the transfer of text files.
The value remove causes end-of-line to be stripped from local files before transferring them to the host
The value add causes end-of-line characters to be added to each host file record before transferring it to the local workstation. This is the default.
The value keep causes end-of-line to be preserved when transferring files.
remap
Controls EBCDIC/ASCII translation for text files.
The value yes (the default) causes the emulator to remap the text encoding to ensure maximum compatibility between the workstation's character set and encoding and the host code page.
The value no causes the emulator to pass the text to or from the host as-is, leaving all translation to the IND$FILE program on the host.
exist
Controls what happens when the destination file already exists in direction=receive mode.
The value keep (the default) preserves the file, causing the Transfer() action to fail.
The value replace overwrites the destination file with the source file.
The value append appends the source file to the existing destination file.
recfm
Controls the record format of files created on the host. (TSO and VM hosts only.)
The value fixed creates a file with fixed-length records.
The value variable creates a file with variable-length records.
The value undefined creates a file with undefined-length records (TSO hosts only).
lrecl
Specifies the record length (or maximum record length) for files created on the host. (TSO and VM hosts only, and only for recfm=fixed and recfm=variable.)
blksize
Specifies the block size for files created on the host. (TSO and VM hosts only.)
allocation
Specifies the units for the primaryspace and secondaryspace options: tracks, cylinders or avblock. (TSO hosts only.)
primaryspace
Primary allocation for a file. The units are given by the allocation option. Required when the allocation is specified as something other than default. (TSO hosts only.)
secondaryspace
Secondary allocation for a file. The units are given by the allocation option. (TSO hosts only.)
avblock
Average block size, required when allocation specifies avblock. (TSO hosts only.)
buffersize
Buffer size for DFT-mode transfers. The value can range from 256 to 32768. Larger values give better performance, but some hosts may not be able to support them.
otherOptions
Specifies additional options to provide to the host IND$FILE command, such as NOTRUNC. New in 4.3
defaults
Use default values for all options. Must be the only option.
cancel
Cancel a transfer in progress. Must be the only option.

Related resources

Individual resources can be used to specify default values for each of the options.

Notes on bulk transfers

Bulk file transfers are often implemented by putting calls to multiple Transfer() actions in a text file, then reading the file with the Source() action. This is not always as straightforward as it could be, because the host may not be ready to accept the next transfer as soon as the previous transfer completes. This issue can be addressed by adding a specific Wait() action action between each Transfer(), as described below.

VM/CMS Ready prompt

When doing bulk transfers this way at the VM/CMS Ready prompt, insert the following action between each Transfer():

Wait(CursorAt,n,1)

where n is the number of rows in the display, minus 1. For example, for a 3270 model 4 with 43 rows:

Transfer(host=vm,mode=send,localfile=file1,hostfile=file1)
Wait(CursorAt,42,1)
Transfer(host=vm,mode=send,localfile=file2,hostfile=file2)
Wait(CursorAt,42,1)
Transfer(host=vm,mode=send,localfile=file3,hostfile=file3)

ISPF command screen

When doing bulk transfers this way from the ISPF command screen (option 6 from the main ISPF menu), insert the following action between each Transfer():

Wait(CursorAt,6,7)

For example:

Transfer(host=tso,mode=send,localfile=file1,hostfile=file1)
Wait(CursorAt,6,7)
Transfer(host=tso,mode=send,localfile=file2,hostfile=file2)
Wait(CursorAt,6,7)
Transfer(host=tso,mode=send,localfile=file3,hostfile=file3)

TSO READY prompt

When doing bulk transfers this way from the TSO READY prompt, no special action is needed between the Transfer() actions. For example:

Transfer(host=tso,mode=send,localfile=file1,hostfile=file1)
Transfer(host=tso,mode=send,localfile=file2,hostfile=file2)
Transfer(host=tso,mode=send,localfile=file3,hostfile=file3)