Examples of using fteCreateTransfer to start programs

We can use the fteCreateTransfer command to specify programs to run before or after a transfer.

In addition to using fteCreateTransfer, there are other ways to invoke a program before or after a transfer. For more information, see Specifying programs to run with MFT.

All these examples use the following syntax to specify a program:
[type:]commandspec[,[retrycount][,[retrywait][,successrc]]]
For more information about this syntax, see fteCreateTransfer: start a new file transfer.


Running an executable program

The following example specifies an executable program called mycommand and passes two arguments, a and b, to the program.
mycommand(a,b)
To run this program at the source agent AGENT1 before the transfer starts, use the following command:
fteCreateTransfer -sa AGENT1 -da AGENT2 -presrc mycommand(a,b) 
destinationSpecification sourceSpecification


Running, and retrying, an executable program

The following example specifies an executable program called simple, which does not take any arguments. A value of 1 is specified for retrycount and a value of 5 is specified for retrywait. These values mean that the program will be retried once if it does not return a successful return code, after a wait of five seconds. No value is specified for successrc, so the only successful return code is the default value of 0.
executable:simple,1,5
To run this program at the source agent AGENT1 after the transfer has completed, use the following command:
fteCreateTransfer -sa AGENT1 -da AGENT2 -postsrc executable:simple,1,5 
destinationSpecification sourceSpecification


Running an Ant script and specifying successful return codes

The following example specifies an Ant script called myscript and passes two properties to the script. The script is run using the fteAnt command. The value for successrc is specified as >2&<7&!5|0|14, which specifies that return codes of 0, 3, 4, 6, and 14 indicate success.
antscript:myscript(prop1=fred,prop2=bob),,,>2&<7&!5|0|14
To run this program at the destination agent AGENT2 before the transfer has started, use the following command:
fteCreateTransfer -sa AGENT1 -da AGENT2 -predst 
"antscript:myscript(prop1=fred,prop2=bob),,,>2&<7&!5|0|14"destinationSpecification sourceSpecification


Running an Ant script and specifying targets to call

The following example specifies an Ant script called script2 and two targets, target1 and target2, to call. The property prop1 is also passed in, with a value of recmfm(F,B). The comma (,) and parentheses in this value are escaped using a backslash character (\).
antscript:script2(target1,target2,prop1=recmfm\(F\,B\)),,,>2&<7&!5|0|14
To run this program at the destination agent AGENT2 after the transfer has completed, use the following command:
fteCreateTransfer -sa AGENT1 -da AGENT2 
-postdst "antscript:script2(target1,target2,prop1=recmfm\(F\,B\)),,,>2&<7&!5|0|14" 
destinationSpecification sourceSpecification


Use metadata in an Ant script

We can specify an Ant task as any of the following calls for a transfer:

  • pre source
  • post source
  • predestination
  • post destination
When the Ant task is run, the user meta data of the transfer is made available using environment variables. We can access this data using, for example, the following code:
<property environment="environment" />
<echo>${environment.mymetadata}</echo>
where mymetadata is the name of some meta data inserted into the transfer.


Running a JCL script

The following example specifies a JCL script called ZOSBATCH. A value of 3 is specified for retrycount, a value of 30 is specified for retrywait and a value of 0 is specified for successrc. These values mean that the script is retried three times if it does not return a successful return code of 0, with a wait of thirty seconds between each attempt.
jcl:ZOSBATCH,3,30,0
where ZOSBATCH is a member of a PDS called MYSYS.JCL, and the agent.properties file contains the line commandPath=....://'MYSYS.JCL':... To run this program at the source agent AGENT1 after the transfer has completed, use the following command:
fteCreateTransfer -sa AGENT1 -da AGENT2 -postsrc jcl:ZOSBATCH,3,30,0 
destinationSpecification sourceSpecification