Page 1 of 1

Environment Variables Usage

Posted: Mon Oct 24, 2016 6:21 am
by s_avneet
Hi All,

I have a quick question about the usage of environment variables and Parameters.

I would build around 35 jobs, performing the same functionality of moving files from one location to other with a minimal of transformation. Now the directories would remain common across all the jobs ( say inbound, outbound, error, archive etc) and the file names will be different. Will it be a good approach to use a single set of environment variables common across all the jobs? Can i call a common environment variables set from all the job sequences?/

Here is my design:

Job sequencer -> Px Jobs

Posted: Mon Oct 24, 2016 7:14 am
by tradersjoe57
Define Environment variables (in Admin) and then use the same variables by defining as parameter set and then use the same parameter set across all the jobs. I think that will make defining variables in each job easier.

Posted: Mon Oct 24, 2016 9:30 am
by asorrell
TradersJoe57 is right, a parameter set is the way to go. Make sure and set the environment variables in the parameter set to $PROJDEF so they'll take the default setting you configured in the admin client.

Posted: Mon Oct 24, 2016 10:32 am
by s_avneet
Ok so as I understand, I create Environment Variables in Admin Client and create Parameter Set containing the variables, set to $PROJDEF.

One last question. From a performance perspective, will this ever be a problem? I would be sharing the same set across different jobs at the same time.

Posted: Mon Oct 24, 2016 10:40 am
by asorrell
Nope - it performs extremely well. I've had thousands of jobs running that were referencing several shared parameter sets with dozens of environment variables.

Be sure and have your Parameter Set structure completely figured out before you start using it in jobs. If you have to add or delete an environment variable later, you'll need to recompile everything that references the parameter set.

Posted: Wed Oct 26, 2016 7:40 am
by s_avneet
Thanks a lot, I will go ahead with the approach.

Another point I need to ask,

All the incoming files will be in the Inbound folder, I will move them all to Inprocess folder. I plan to use Execute_Command for the same. Can I use a single script for all the jobs sequencers or do I need a separate script per job?

The functionality of the script will be same, as it will be moving from one location to another, will parameterise the file name from job ($1)

Sample Script:

Code: Select all

#!/bin/bash
var_src_dir="/dev/data/Inbound/"
var_tgt_dir="/dev/data/Inprocess/"
var_file_pattern=$1
var_file_name=`ls -t $var_src_dir$var_file_pattern | head -n 1 |  xargs -n1 basename`
mv $var_src_dir$var_file_name  $var_tgt_dir$var_file_name
echo $var_file_name

Posted: Wed Oct 26, 2016 8:06 am
by chulett
You can certainly use a single script if it is parameterized appropriately.

Posted: Fri Oct 28, 2016 6:20 am
by s_avneet
Thanks a lot :)

Marked as resolved