Error while reading environment variable

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
mdbatra
Premium Member
Premium Member
Posts: 175
Joined: Wed Oct 22, 2008 10:01 am
Location: City of London

Error while reading environment variable

Post by mdbatra »

Hi All,
I am trying to read an environment variable in transformer but i am getting the following error.

Output from transformer compilation follows:

##I IIS-DSEE-TFCN-00001 12:18:00(000) <main_program>
IBM WebSphere DataStage Enterprise Edition 8.0.1.4989
Copyright (c) 2001, 2005-2007 IBM Corporation. All rights reserved



##I IIS-DSEE-TUTL-00031 12:18:00(001) <main_program> The open files limit is 150; raising to 65536.
##I IIS-DSEE-TOSH-00002 12:18:00(002) <main_program> orchgeneral: loaded
##I IIS-DSEE-TOSH-00002 12:18:00(003) <main_program> orchsort: loaded
##I IIS-DSEE-TOSH-00002 12:18:00(004) <main_program> orchstats: loaded
##W IIS-DSEE-TOSH-00049 12:18:00(007) <main_program> Parameter specified but not used in flow: DSPXWorkingDir
##W IIS-DSEE-TFTM-00012 12:18:01(000) <transform> Error when checking composite operator: The number of reject datasets "0" is less than the number of input datasets "1".
##E IIS-DSEE-TFTK-00001 12:18:01(001) <transform> Error when checking composite operator: Unexpected tokens: ; [line 11,character 7].
##E IIS-DSEE-TFPS-00012 12:18:01(002) <transform> Error when checking composite operator: Invalid local variable declaration: ; [line 11, character 7].
##E IIS-DSEE-TFTK-00001 12:18:01(003) <transform> Error when checking composite operator: Unexpected tokens: ; [line 39,character 16].
##E IIS-DSEE-TFPS-00027 12:18:01(004) <transform> Error when checking composite operator: Expected an operand; [line 39, character 14].
##E IIS-DSEE-TFPS-00038 12:18:01(005) <transform> Error when checking composite operator: Expected semi-colon; [line 39, character 16].
##E IIS-DSEE-TFSR-00019 12:18:01(006) <main_program> Could not check all operators because of previous error(s)
##E IIS-DSEE-TCOS-00029 12:18:01(007) <main_program> Creation of a step finished with status = FAILED. (skey.Transformer_15)

*** Internal Generated Transformer Code follows:
0001: //
0002: // Generated file to implement the V0S15_skey_Transformer_15 transform operator.
0003: //
0004:
0005: // define our input/output link names
0006: inputname 0 DSLink6;
0007: outputname 0 DSLink23;
0008:
0009: global {
0010: // Job parameter declaration
0011: string $SKEY;
0012: }
0013:
0014: initialize {
0015: // define our row rejected variable
0016: int8 RowRejected0;
0017:
0018: // define our null set variable
0019: int8 NullSetVar0;
0020:
0021: // declare our intermediate variables for this section
0022: string InterVar0_0;
0023:
0024: // initialise constant values which require conversion
0025: InterVar0_0 = 1;
0026: // Stage variable declaration and initialisation
0027: string StageVar0_StageVar;
0028: StageVar0_StageVar = "";
0029: }
0030:
0031: mainloop {
0032: // initialise our row rejected variable
0033: RowRejected0 = 1;
0034:
0035: // evaluate the stage variables first
0036: StageVar0_StageVar = InterVar0_0;
0037:
0038: // evaluate columns (no constraints) for link: DSLink23
0039: DSLink23.COl1 = $SKEY;
0040: writerecord 0;
0041: RowRejected0 = 0;
0042: }
0043:
0044: finish {
0045: }
0046:
*** End of Internal Generated Transformer Code
Actually, i want to read an integer value("1") using this environment variable but i got the same error as above. Then i tried reading with a string variable but no luck.

what can be the cause ???
Rgds,
MB
nagarjuna
Premium Member
Premium Member
Posts: 533
Joined: Fri Jun 27, 2008 9:11 pm
Location: Chicago

Post by nagarjuna »

Are you using getenvironment function to read an env variable ? How you are reading env variable in transformer ??
Nag
mdbatra
Premium Member
Premium Member
Posts: 175
Joined: Wed Oct 22, 2008 10:01 am
Location: City of London

Post by mdbatra »

i added that env variable in job parameters & then read in the transformer. Should be okay ..right ?
Rgds,
MB
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Define precisely what "read in the transformer" means.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Just using the environment variable reference ($SKEY) alone does not work. You either have to supply the environment variable value through a job parameter (which can be a reference directly to the environment variable and which must be added from the parameter helper in the Expression Editor) or you must use the GetEnvironment() function - which a Search would have revealed to you.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
mdbatra
Premium Member
Premium Member
Posts: 175
Joined: Wed Oct 22, 2008 10:01 am
Location: City of London

Post by mdbatra »

sorry i forget to mention that... yes i first called that env variable in job parameters & then used in the transformer. In transformer, i am using that just for the output column derivation.
Rgds,
MB
mdbatra
Premium Member
Premium Member
Posts: 175
Joined: Wed Oct 22, 2008 10:01 am
Location: City of London

Post by mdbatra »

i used GetEnvironment function & that worked. But, i dont understand why the first one didn't work.
Anyways, thanks guys !!!
Rgds,
MB
datisaq
Participant
Posts: 154
Joined: Wed May 14, 2008 4:34 am

Post by datisaq »

I have a similar problem, i set the environment variable "$APT_MIN_TRANSPORT_BLOCK_SIZE" as parameter and in the transformer stage under output column derivation i used
"O/p Coumn--->GetEnvironment($APT_MIN_TRANSPORT_BLOCK_SIZE)"

But my job is not getting compiled getting the similar error as "mdbatra" got.

Please help me out in resoving this issue..
IBM Certified - Information Server 8.1
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

What about "GetEnvironment('$APT_MIN_TRANSPORT_BLOCK_SIZE')"
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

From what I recall, you don't use the $ with that function.
-craig

"You can never have too many knives" -- Logan Nine Fingers
datisaq
Participant
Posts: 154
Joined: Wed May 14, 2008 4:34 am

Post by datisaq »

Yes Arndw you're correct.Thanks for your help.

We need to enclose the parameter in ''.
And craig without "$" it throws compilation error.

But the ouput i'm getting as blank. I tried with varios environment variables but for all of them the output i got as blank.

Do GetEnvironment(EnvVar) would not return anything?

Please help me out..
IBM Certified - Information Server 8.1
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Sorry, but you need no quotes and no dollar sign as a simple search of the forums here would reveal.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Lol - I should have done that as well. Thanks.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Remember that NAME is the name of an environment variable, while $NAME is a reference to the value of the environment variable. The GetEnvironment() function needs to be told the name of the environment variable from which it is expected to retrieve the value.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply