Mohammed Rafi
Mohammed Rafi

Reputation: 11

Job parameter from file on server in datastage

Hello Datastage developers, I'm pretty new to the tool. I'm trying to develop a parallel job with Oracle stage. I need the database parameters to be populated at run time. I see there are jobs designed for our project which take these parameters(DB name, userID, password, schema) from a file located on the ETL server. I'm unable to find how the job hits that file and gets the values. I hope I've put the question clearly. Can you guide me step by step how to get the parameters from a file?

Upvotes: 1

Views: 5860

Answers (1)

Abhisek
Abhisek

Reputation: 21

When a file based parameter set is used, the parameter set picks up the contents of the file at the time the job is started. This provides excellent flexibility as long job could manipulate a parameter set file, and leave new parameters for a subsequent job. The key is that the parameters are not compiled into the job or the parameter set. The following steps detail the creation and use of file based parameter sets.

  1. File > New > Other > Parameter Set
  2. In the general tab name the parameter set.

(Alphanumeric and Underscore characters only. No spaces.)

For example: my_file_parm_set

  1. In the Parameters tab create the parameters and defaults

  2. In the Values tab put the name of the file in the "Value File Name" column.

Specify file name only. No path component Use alpha numeric characters etc. No spaces.

For example: parm_file.txt

In the same row, list values for each parameter defined in the Parameters tab. The table should look like this:

  1. Click OK and save the the parameter set.

  2. At this point the parameter set file should have been created using the following system:

Projects/ParameterSets//

In our example the file name would be:InformationServer\Server\Projects\foo2\ParameterSets\my_file_parm_set\parm_file.txt

  1. The contents of the file looks like this:

    • foo=Parm file value for foo
    • bar=Parm file value for bar
  2. In the job, navigate to Edit > Job Properties and select the Parameters tab.

Click Add Parameter Set and select the newly created parameter set:

=============== Create the Sequence Job ===========================

  1. Create a new sequence and add a Job Activity stage to it. Double click on the stage to edit its properties, and click on the button to select a Job name. Once the job is loaded, its parameters become visible in the Parameters section of the Job Activity screen. The new parameter set should be in the list. Click on the drop down selector in the Value Expression column and select the parameter file:

Click OK and save the sequence.

  1. Now every time the sequence is run, parameters are read from the file at run time and passes to the job. Any preceding jobs in the sequence can change the file to dynamically modify the parameters.

Upvotes: 1

Related Questions