Receive a file

This topic describes receiver, or target-initiated, transfer modes in Transfer CFT flows. You can configure these flows either using Central Governance or Transfer CFT, and execute via the Transfer CFT interface.

Note For the complete RECV syntax, refer to the Transfer CFT Command Guide.

How to use the RECV FILE command

A RECV request may refer to a single partner or a list of partners. The partner parameter (PART parameter) of the RECV command can reference various partner characteristics.

Transfer modes when receiving a file

There are two ways to make a file available for a partner pickup when using a receive command, either implicit or explicit. In both cases the file transfer is triggered by executing a RECV command.

Implicit mode

The implicit mode allows you to have a file continually available for multiple partners to perform a pickup.

Explicit mode

The explicit mode requires that you have a specific file available with the status STATE=HOLD, which is ready for a partner pickup.

Caution

It is possible that there are two flows that have the same model identifier, one set to use implicit and the other explicit mode. When you execute a send for this identifier though, the model defined for explicit mode is used. If there is no explicit model for this identifier, then the default model is used.

Mode priority

If you use an implicit flow model identifier  in a SEND command that also contains the STATE=HOLD, performing a pull using that model identifier returns the file associated with the explicit model.

  • Create an implicit mode model (NewModel) with a file called report1
  • Create SEND on the source using the implicit mode identifier (NewModel) and set state=hold (explicit mode)
  • send part=store1, idf=NewModel, state=hold, fname=report2
  • Trigger a pull that uses the implicit mode identifier (recv idf=NewModel)
  • recv part=store2, idf=NewModel
  • Result is that the file report2, which corresponds to the explicit model, is returned
Note If there is no explicit model for this identifier, even if there is an implicit model with the same identifier, then the default explicit mode model is used.

Conclusion  The explicit mode (STATE=HOLD) takes priority over the implicit mode definition.

Use or override default value

Override the model file default values

A new model file overrides the global default model file value when specified in a RECV command.

recv part=store1, idf=newmodel
Note If you enter the name of a model file identifier that does not exist, then the global model file default is used. If the default model is not authorized (the UCONF cft.default_idf.enable=NO parameter), an error occurs.

Override the model file values

Using additional recv command parameters, such as the file name, you can override values in the model file.

recv part=store1, idf=model, fname=newfile

Use file name parameters

There are several ways for you to provide the file name in the RECV command to achieve the actions described in this section, such as receiving files based on a list.

When using the Central Governance default values for file reception, the Transfer CFT checks to see if the file already exists.

  • if it exists it is deleted
  • if the file does not exist, the file is created

You can override the default values when using the RECV command. In the following example, file1 must exist and be empty, otherwise the transfer fails with an error.

Example

recv part=store1, idf=newmodel, fname=file1, faction=verify, fdisp=old

For more information, see FACTION and FDISP.

Receive a file using open mode

  • On the source, create a model where the file is named &nfname.
  • Perform the recv command:
recv part=store1, idf=newmodel, fname=file1, nfname=myfolder/report1

Results are that the target downloads the report1 file.

If the model does not include a &nfname definition, then the command fails. However, if in the recv command

Receive a list of all of a folder contents

This section describes how to receive a list of all of the files that are contained in a source site folder. In each of the examples in this section, you must configure the sender, or source site, to allow this action.

Receive a list of the contents of one folder

  • Begin by creating a pull flow, pullfiles, on the source machine (site sending the file) and define the filename using the name of the folder reports.
  • Perform the recv command:
recv part=store1, idf=pullfiles, fname=list
  • The list of file in the folder reports is provided in the list file. The remote site only enables you to see what is defined by that site - the receiver cannot see other folders on that site.

Configure remote side provide full open access

  • Begin by creating a pull flow, pullfiles, on the source machine (site sending the file) and define the filename using the &nfname value.
  • Perform the recv command:
recv part=store1, idf=newmodel, fname=list, nfname=*
  • The list file provides a list of all files in the remote Transfer CFT runtime directory.

Configure remote side with restricted access

  • Begin by creating a pull flow, pullfiles, on the source machine (site sending the file) and define the filename using the &nfname value, and the reports working directory.
  • Perform the recv command:
recv part=store1, idf=newmodel, fname=list, nfname=*
  • The list file provides a list of all files in the reports folder.

Multiple get files

This example describes how to get all files in a specific folder using a single receive command. The remote source site must be configured to allow this action.

Note When using the FILE=ALL parameter setting, files are transferred sequentially and not in parallel.
Caution   If the RECV command specifies an IDF in “identifier” form (no mask) and if the corresponding model files, at the server end, are declared in implicit send mode (IMPL = YES), the option FILE = ALL initiates an uninterrupted repetition of the transfer, concerning the first file waiting to be sent.

Get all files from a single folder in heterogeneous mode

The following example is performed in heterogeneous mode.

  • Begin by creating a pull flow, pullfiles, on the source machine (site sending the file) and define the filename using the name of the folder reports prefaced by the indirection character (for example on UNIX @reports/*).
  • Perform the recv command:
recv part=store1, idf=pullfiles, file=all, fname=putfiles/&froot
  • All of the files that were in the reports folder are copied to the putfiles folder.

Get all files from a single folder in homogeneous mode

The following example is performed in homogeneous mode.

  • Begin by creating a pull flow, pullfiles, on the source machine (site sending the file) and define the filename using the name of the folder reports prefaced by the indirection character (for example on UNIX @reports/*). Additionally you must define a temporary filename for the archive file.
  • Perform the recv command. In homogenous mode though, the FILE=ALL parameter is optional.
recv part=store1, idf=pullfiles, fname=putfiles, wfname=temp_archive
  • All of the files that were in the reports folder are transferred to the putfiles folder.

Receive files using full open access in heterogeneous mode

  • Begin by creating a pull flow, pullfiles, on the source machine (site sending the file) and define the filename using the &nfname value.
  • Perform the recv command, where the sending site is a UNIX system (use the nfname syntax of the remote site):
recv part=store1, idf=pullfiles, file=all, fname=putfiles/&froot, nfname='@reports/*'
  • All of the files that were in the reports are transferred to the putfiles folder.

Configure remote side with restricted access

  • Begin by creating a pull flow, pullfiles, on the source machine (site sending the file) and define the filename using the &nfname value, and the MyWorkDir working directory.
  • Perform the recv command, where the sending site is a UNIX system (use the nfname syntax of the remote site):
recv part=store1, idf=pullfiles, file=all, fname=putfiles/&froot, nfname='@*'
  • All of the files that were in the MyWorkDir are transferred to the putfiles folder.

Receive files using a model file template wildcard

  • Begin by creating multiple pull flows with the selected partner.
  • Perform the recv command, using the wildcard character to indicate all flows with the designated partner:
recv part=store1, idf=*, file=all

This command transfers all files available on the store1 source regardless of the model file template.

Use scheduling features

Trigger a recv according to the transfer status

You can use the recv command with STATE parameters so that the recv occurs once the transfer has a predefined status.

D = disp

Transfers are carried out immediately. (default)

K = keep

You can use this status to store several transfers, for example, until all are ready to go. Use a manual START command to trigger the transfers.

recv part=store1, idf=newmodel, state=disp

Perform a recv at a specific time

You can use the mintime and mindate parameters to schedule a transfer for a given date and time. These can be relative or absolute values; for more information see Delayed transfers in Transfer scheduling.

recv part=store1, idf=newmodel, mindate= 20150924, mintime=204500

How to define a periodic recv

You can use the cycle and tcycle parameters to define a periodic recv. See Cyclic transfer requests.

recv part=store1, idf=newmodel, cycle=7, tcycle=day

Define a recv based on a transfer timeout

You can define that beyond a specified time in minutes, the transfer is canceled. See also maxduration.

recv part=store1, idf=newmodel, maxduration=10

See also Transfer scheduling.

Execute pre and post transfer activities

For details transfer activities and scheduling, see Processing execution policy.

How to trigger pre execution scripts

recv part=store1, idf=model, preexec=exec/preexec.cmd

How to trigger post execution scripts

recv part=store1, idf=model, exec=exec/postexec.cmd

How to trigger a script when a transfer fails

See Transfer error procedures for more information.

recv part=store1, idf=model, exece=exec/errorexec.cmd
Note You can use the _NONE_ keyword in send and receive commands to disable the EXECSF, EXECRF, EXECSE, EXECRE and EXECSFA procedures that are defined in the general Transfer CFT environment parameter settings.

When using visibility features to link an application to a transfer, or to link a transfer to other transfers, you can use the appobjid and the appcycid parameters. These parameters refer to tracked object and the cycle id.

recv part=store1, idf=model, appobjid=appliobject, appcycid=Appl1

Miscellaneous send features

How to toggle the protocol used for a recv

In the partner definition create a choice of protocols, for example prot=(nossl, ssl), sap=(1761, 1762). Use the PROT parameter with the RECV command to indicate for that particular transfer it should use the specified protocol.

recv part=store1, idf=model, prot=ssl

How to provide passwords when required by the remote partner

You must provide both the user and corresponding password in recv command as defined on the remote partner in the send file template.

recv part=store1, idf=model, suser=guest, spasswd=guestpassword

Wait for a synchronous transfer to complete before continuing

After configuring the synchronous communication, add the wstate and wtimeout to the recv command.

config type=com, mediacom=tcpip, fname=xhttp://localhost:1765

recv part=store1, idf=model, wstates=X, wtimeout=120

How to send additional information to the remote partner

Use the following parameters to further refine the recv command and provide more information to the remote partner concerning a transfer:

  • parm = a free parameter that allows you to add information to send with your transfer (512 characters)
  • sappl, rappl = send information about the applications performing the transfer
  • suser, ruser = send information related to the transfer users

recv part=store1, idf=model, parm='containsall daily reports'

Related Links