Page 1 of 1

Compilation error in using environment variable in Job

Posted: Fri Dec 09, 2005 4:07 am
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

Posted: Fri Dec 09, 2005 4:15 am
by ArndW
dsusr,

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

Posted: Fri Dec 09, 2005 4:56 am
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

Posted: Fri Dec 09, 2005 5:10 am
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.

Posted: Fri Dec 09, 2005 5:58 am
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

Posted: Fri Dec 09, 2005 11:07 pm
by kumar_s
Hi dsusr,

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

-Kumar

Posted: Mon Dec 12, 2005 6:16 am
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

Posted: Mon Dec 12, 2005 5:02 pm
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.

Posted: Tue Dec 13, 2005 12:11 am
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

Posted: Tue Dec 13, 2005 3:19 pm
by ray.wurlod
Are you putting "#" characters around job parameter references in passive stages? For example #$RBUSER#

Yes, it's a known bug in PX transform

Posted: Tue Dec 13, 2005 5:47 pm
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.