Examples of using fteCreateTransfer to start programs

You 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.

All these examples use the following syntax to specify a program:
[type:]commandspec[,[retrycount][,[retrywait][,successrc]]]
For more information about this syntax, see fteCreateTransfer (create 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 IBM 4690 executable program in the background

The following example specifies an executable program called mycmd.bat. A value of 9 is specified for priority and a value of message123 is specified for message. These values mean that the program will be given the highest priority, and message123 is displayed on the IBM 4690 system background control screen for the command. No value is specified for successrc, so the only successful return code is the default value of 0.

os4690background:mycmd.bat(arg1,arg2),,,9,message123
To run this program at the source agent AGENT1 before the transfer starts, use the following command:
fteCreateTransfer -sa AGENT1 -presrc os4690background:mycmd.bat(arg1,arg2),,,9,message123

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

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 will be 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
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