Page 1 of 1

hot to pass environment variable in server routine

Posted: Sun Jul 31, 2005 4:01 am
by pongal
Hi,
I would like to pass environment variable $TargetFilePath into server routine.
if i write this code, it is giving an error
strFileLoc = DSGetParamInfo(DSJ.ME,"#$TargetFileDir#", DSJ.PARAMVALUE)
Call DSLogInfo("strACRFileLoc :":strFileLoc, DSJ.ME)

how to read environment variable's valve in server routine
do i need to define anything

Thanks

Re: hot to pass environment variable in server routine

Posted: Sun Jul 31, 2005 8:14 am
by benny.lbs
Pass the environment variable to Input Argument
pongal wrote:Hi,
I would like to pass environment variable $TargetFilePath into server routine.
if i write this code, it is giving an error
strFileLoc = DSGetParamInfo(DSJ.ME,"#$TargetFileDir#", DSJ.PARAMVALUE)
Call DSLogInfo("strACRFileLoc :":strFileLoc, DSJ.ME)

how to read environment variable's valve in server routine
do i need to define anything

Thanks

Posted: Sun Jul 31, 2005 8:24 am
by elavenil
Tried using the dummy environment variable with $ symbol and it gives error message. And tried assigning this env variable to the argument and it gives error.

Can you pls share us how the env variable can be assigned to Argument of the routine.

Thanks for the inputs.

Regards
Saravanan

Posted: Sun Jul 31, 2005 5:26 pm
by ray.wurlod
Tell us the exact error.

Also tell us if you've included JOBCONTROL.H in your routine, where the DEFFUN for DSGetParamInfo() function lives. (It is not necessary to include it in a job control routine.)

If there's no DEFFUN, the error is likely to be something like "dimensioned array not defined".

Posted: Mon Aug 01, 2005 12:54 am
by benny.lbs
What kind of server routine do you use ? Before/After ?

Where do you call the routine ? Before/After job routine or within Job Sequence ?

Maybe you should add the env variable to Job properties first, and then code as #$env_var# in Before/After job routine, only $env_var in sequence routine activity.
elavenil wrote:Tried using the dummy environment variable with $ symbol and it gives error message. And tried assigning this env variable to the argument and it gives error.

Can you pls share us how the env variable can be assigned to Argument of the routine.

Thanks for the inputs.

Regards
Saravanan

Re: hot to pass environment variable in server routine

Posted: Mon Aug 01, 2005 12:56 am
by roy
Hi,
why do you have # signs around the parameter name?
pongal wrote:Hi,
I would like to pass environment variable $TargetFilePath into server routine.
if i write this code, it is giving an error
strFileLoc = DSGetParamInfo(DSJ.ME,"#$TargetFileDir#", DSJ.PARAMVALUE)
Call DSLogInfo("strACRFileLoc :":strFileLoc, DSJ.ME)

how to read environment variable's valve in server routine
do i need to define anything

Thanks

Re: hot to pass environment variable in server routine

Posted: Mon Aug 01, 2005 1:28 am
by benny.lbs
It seems it can't be compiled with $TargetFileDir, "$" unexpected.
roy wrote:Hi,
why do you have # signs around the parameter name?
pongal wrote:Hi,
I would like to pass environment variable $TargetFilePath into server routine.
if i write this code, it is giving an error
strFileLoc = DSGetParamInfo(DSJ.ME,"#$TargetFileDir#", DSJ.PARAMVALUE)
Call DSLogInfo("strACRFileLoc :":strFileLoc, DSJ.ME)

how to read environment variable's valve in server routine
do i need to define anything

Thanks

Posted: Mon Aug 01, 2005 1:46 am
by roy
Well

Code: Select all

ErrCode = DSSetParam(hJob1, "$DS_ENABLE_RESERVED_CHAR_CONVERT", "True")
this is part of a job control code added automatically when adding a job with env variable as above
it compiles fine :roll:

Posted: Mon Aug 01, 2005 2:19 am
by elavenil
Hi All,

Thanks for your inputs.

Hi Ray,

The error message is as follows.

Compiling: Source = 'DSU_BP/DSU.ttrd', Object = 'DSU_BP.O/DSU.ttrd'
*
WARNING: Variable 'TestInput' never assigned a value.

Compilation Complete.

Pls let me know if any of the header file to be included.

Hi Benny,

I am trying to create this as new server routine.

Hi Roy,

Tried using the variable without $ but it did not work.

The test code is as follows.

SS = TestInput

If SS = 'S' Then
Ans = 'RRRR'
End

If SS <> 'S' Then
Ans = 'TTT'
End

TestInput has been defined as env variable in the Administrator.

Pls let me know your inputs.

Regards
Saravanan

Posted: Mon Aug 01, 2005 3:07 am
by benny.lbs
I have create a very simple routine only contain

Code: Select all

Call DSLogInfo("$APT_CONFIG_FILE", 'RoutineName')
, but the output is string "$APT_CONFIG_FILE"
roy wrote:Well

Code: Select all

ErrCode = DSSetParam(hJob1, "$DS_ENABLE_RESERVED_CHAR_CONVERT", "True")
this is part of a job control code added automatically when adding a job with env variable as above
it compiles fine :roll:

Posted: Mon Aug 01, 2005 3:48 am
by pongal
env variable is working fine in After job routine.
we should give parameter as '$TargetFilePath' and include
#INCLUDE DSINCLUDE JOBCONTROL.H

Thanks all of you.... :D