Using Variables in FTP Jobs

This page provides explains how to specify and use variables in FTP Jobs.

Note:

This example assumes that you have at least basic knowledge of Automic Automation features. For more information, see PromptSets (PRPT) and FOREACH Workflows.

We define an FTP Job that has a variable that specifies an FTP host. We use this variable in FTP commands. This is what will happen:

  • If the job is executed individually, the value of the variable is set by a prompt in a PromptSet object, where a VARA object is assigned as the Prompt's data reference. This allows you to select a host from a dynamic list.

  • If the job is executed within a ForEach Workflow, the value of the variable is set by the ForEach Workflow properties, where a VARA object is assigned as the source for the variable's value. When the Workflow runs, it spawns an instance of the FTP Job for every host returned by the VARA object.

An FTP Agent Job named JOBS.FTPAGENT.GET_CARD_TRANSACTIONS_SELECT_REMOTE_HOST is shown below. The variable &CONNECTION# is entered as the From host. This means that when the Job is executed, the value for the From host will be determined by the value of the &CONNECTION# variable.

The Job includes the three commands shown in detail the three images below. Each command also uses the &CONNECTION# variable:

The &CONNECTION# variable is set each time the JOBS.FTPAGENT.GET_CARD_TRANSACTIONS_SELECT_REMOTE_HOST Job is executed by a prompt defined in a PromptSet object named PRPT.CONNECTION, which is assigned to the Job as shown below:

The PromptSet definition for PRPT.CONNECTION is shown below. Notice that the VARA object VARA.SQLI.CONNECTION_NAME is the data reference for PRPT.CONNECTION's only prompt.

The VARA definition for VARA.SQLI.CONNECTION_NAME is shown below. It includes the following SQL statement.

select oh_name from oh where oh_otype='CONN' and oh_name like '%STORE%' and oh_name not like '%OLD%'

This SQL statement returns a list of hosts based on the naming convention STORE<number>.

JOBS.FTPAGENT.GET_CARD_TRANSACTIONS_SELECT_REMOTE_HOST is included as the only task in the JOBP.FOREACH.REMOTE_HOST For Each Workflow below.

In the For Each details, VARA.SQLI.CONNECTION_NAME is specified as the variable in the Name field. And &CONNECTION# is set as the variable to publish values to.

When the JOBP.FOREACH.REMOTE_HOST Workflow is executed, it spawns an instance of the JOBS.FTPAGENT.GET_CARD_TRANSACTIONS_SELECT_REMOTE_HOST FTP Job for every host returned by the VARA.SQLI.CONNECTION_NAME VARA object.

See also: