Compilation error in using environment variable in Job

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
dsusr
Premium Member
Premium Member
Posts: 104
Joined: Sat Sep 03, 2005 11:30 pm

Compilation error in using environment variable in Job

Post by dsusr »

Hi All,

We have defined one environment variable for our project. But when we are assigning that environment variable to one of the column in the transformer it is giving a compilation error. But if we do the same thing in server job then it is working fine.

Can someone tell that is this the problem with our PX configuration??

Thanks
dsusr
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

dsusr,

you won't be getting any userful advice unless you actually tell us what the compiler error is.
dsusr
Premium Member
Premium Member
Posts: 104
Joined: Sat Sep 03, 2005 11:30 pm

Post by dsusr »

ArndW wrote:dsusr,

you won't be getting any userful advice unless you actually tell us what the compiler error is.
Hi ArndW,

I didnt specify the error for the first time since i thought this is a problem with PX. PFB the compilation error:-

Output from transformer compilation follows:

##I TFCN 000001 16:54:25(000) <main_program>
Ascential DataStage(tm) Enterprise Edition 7.5.0.1
Copyright (c) 2004, 1997-2004 Ascential Software Corporation.
All Rights Reserved


##I TOSH 000002 16:54:25(001) <main_program> orchgeneral: loaded
##I TOSH 000002 16:54:25(002) <main_program> orchsort: loaded
##I TOSH 000002 16:54:25(003) <main_program> orchstats: loaded
##I TFSC 000001 16:54:25(006) <main_program> APT configuration file: /u01/app/Ascential/DataStage/Configurations/default.apt
##I TFSC 000000 16:54:25(007) <main_program>
This step has no datasets.

It has 1 operator:
op0[1p] {(sequential APT_CombinedOperatorController:
(APT_LicenseCountOp in APT_LicenseOperator)
(APT_LicenseCheckOp in APT_LicenseOperator)
) on nodes (
node1[op0,p0]
)}
It runs 1 process on 1 node.
##W TCOS 000049 16:54:26(000) <main_program> Parameter specified but not used in flow: DSPXWorkingDir
##W TFCP 000000 16:54:26(002) <transform> Error when checking composite operator: The number of reject datasets "0"is less than the number of input datasets "1".
##E TFCP 000001 16:54:26(003) <transform> Error when checking composite operator: Unexpected tokens: [line 11,character 8]
##E TFCP 000012 16:54:26(004) <transform> Error when checking composite operator: Invalid local variable declaration: [line 11,character 8]
##E TFCP 000001 16:54:26(005) <transform> Error when checking composite operator: Unexpected tokens: [line 28,character 19]
##E TFCP 000027 16:54:26(006) <transform> Error when checking composite operator: Expected operand [line 28,character 17].
##E TFCP 000038 16:54:26(007) <transform> Error when checking composite operator: Expected semi-colon [line 28,character 19].
##E TFSR 000019 16:54:26(008) <main_program> Could not check all operators because of previous error(s)
##E TCOS 000029 16:54:26(009) <main_program> Creation of step finished with status = FAILED (testjob.Transformer_12)

*** Internal Generated Transformer Code follows:
0001: //
0002: // Generated file to implement the V0S12_testjob_Transformer_12 transform operator.
0003: //
0004:
0005: // define our input/output link names
0006: inputname 0 DSLink2;
0007: outputname 0 DSLink5;
0008:
0009: global {
0010: // Job parameter declaration
0011: ustring $USERID;
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: }
0022:
0023: mainloop {
0024: // initialise our row rejected variable
0025: RowRejected0 = 1;
0026:
0027: // evaluate columns (no constraints) for link: DSLink5
0028: DSLink5.useriodf = $USERID;
0029: writerecord 0;
0030: RowRejected0 = 0;
0031: }
0032:
0033: finish {
0034: }
0035:
*** End of Internal Generated Transformer Code



This job consists of one transformer and in that transformer i am assigning the value of my project level parameter UserId to one of the column.

Thanks,
dsusr
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Yes, looks like a bug - the "$" symbol prefix isn't accepted by the stage compiler. I tried using one in the stage variables as well and it didn't work.
dsusr
Premium Member
Premium Member
Posts: 104
Joined: Sat Sep 03, 2005 11:30 pm

Post by dsusr »

ArndW wrote:Yes, looks like a bug - the "$" symbol prefix isn't accepted by the stage compiler. I tried using one in the stage variables as well and it didn't work.
Yeah it appears that this is a bug with Prallel transformer only. Since we are even able to do this thing in Basic Transformer.

Also we are able to define any directory as project level parameter and are able to use that for reading the file.

Thanks,
dsusr
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Hi dsusr,

May i know where can we use the environmental variable in transformer.

-Kumar
richdhan
Premium Member
Premium Member
Posts: 364
Joined: Thu Feb 12, 2004 12:24 am

Post by richdhan »

Hi Kumar,

Did you mean where to use or how to use.

If you meant how to use then it should be be

GetEnvironment('USERID')

HTH
--Rich
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

You can add an environment variables to your project specific environment variables (which gives you more control over them) and add it to your job as a job parameter using the add environment variable button. It can then be used in the transformer using the $VariableName syntax. You can only add environment variables that are defined via the Administrator in the DSParams file.

To access an operating system environment variable you can either use the GetEnvironment function as shown by Rich or retrieve environment variables in a sequence job Set Variables stage and pass them into the job as normal job parameters.
dsusr
Premium Member
Premium Member
Posts: 104
Joined: Sat Sep 03, 2005 11:30 pm

Post by dsusr »

kumar_s wrote:Hi dsusr,

May i know where can we use the environmental variable in transformer.

-Kumar
Hi Kumar,

We are doing what vmcburney has said i.e. we have defined some project level parameter and when we try to use them in transformer by taking them as job parameter then it is giving an error. The reason for that is the dollar sign appended to the project level parameters.

We have even checked this thing by creating one expression file just similar to the .trx file of the transfomer and by using that file in generic stage using transform operator. In that file we have created one variable with starting with '$' sign just similar to the one created for Project level parameter. There also it is not able to identify that variable.

Thanks,
dsusr
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Are you putting "#" characters around job parameter references in passive stages? For example #$RBUSER#
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pneumalin
Premium Member
Premium Member
Posts: 125
Joined: Sat May 07, 2005 6:32 am

Yes, it's a known bug in PX transform

Post by pneumalin »

dsusr,
This is a known bug in PX 7.5, they promised to fix it in next release. To work around it for now, you can define a job parameter RBUSER, use it in your PX transform, and place this job in a sequencer(I believe you probably need to use it). Finally, you shall be able to pass down the value of environment variable $RBUSER from that sequencer to RBUSER in your job. It's awkward indeed, but it works!
Let me know if this works for you.

Pneuma.
pneumalin@yahoo.com
416-828-4338.
Post Reply