Error when using user defined env variable in transformer

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
DS_MJ
Participant
Posts: 157
Joined: Wed Feb 02, 2005 10:00 am

Error when using user defined env variable in transformer

Post by DS_MJ »

Hello:

We have defined user defined environmental variables for say $LogonID and $Password and $DBName. In the parameters of Job properties we add this environmental variable.

In the Transform I use $LogonId as the value for COL_ID. When I try to compile this job get error in the Transformer.

Code: Select all

Ascential DataStage(tm) Enterprise Edition 7.5.2
Copyright (c) 2004, 1997-2004 Ascential Software Corporation.
All Rights Reserved


##I TUTL 000031 11:18:04(001) <main_program> The open files limit is 2000; raising to 2147483647.
##I TOSH 000002 11:18:04(002) <main_program> orchgeneral: loaded
##I TOSH 000002 11:18:04(003) <main_program> orchsort: loaded
##I TOSH 000002 11:18:04(004) <main_program> orchstats: loaded
##I TFSC 000001 11:18:04(007) <main_program> APT configuration file: /ibmdscode/Configurations/CGI/apt_config_max
##W TCOS 000049 11:18:04(008) <main_program> Parameter specified but not used in flow: DSPXWorkingDir
##W TFCP 000000 11:18:05(000) <transform> Error when checking composite operator: The number of reject datasets "0" is less than the number of input datasets "1".
##E TFCP 000001 11:18:05(001) <transform> Error when checking composite operator: Unexpected tokens: ; [line 12,character 7].
##E TFCP 000012 11:18:05(002) <transform> Error when checking composite operator: Invalid local variable declaration: ; [line 12, character 7].
##E TFCP 000001 11:18:05(003) <transform> Error when checking composite operator: Unexpected tokens: ; [line 40,character 42].
##E TFCP 000027 11:18:05(004) <transform> Error when checking composite operator: Expected an operand; [line 40, character 40].
##E TFCP 000038 11:18:05(005) <transform> Error when checking composite operator: Expected semi-colon; [line 40, character 42].
##E TFCP 000001 11:18:05(006) <transform> Error when checking composite operator: Unexpected tokens: ; [line 43,character 41].
##E TFCP 000027 11:18:05(007) <transform> Error when checking composite operator: Expected an operand; [line 43, character 39].
##E TFCP 000038 11:18:05(008) <transform> Error when checking composite operator: Expected semi-colon; [line 43, character 41].
##E TFSR 000019 11:18:05(009) <main_program> Could not check all operators because of previous error(s)
##E TCOS 000029 11:18:05(010) <main_program> Creation of a step finished with status = FAILED. (DM_D_COMM_TBL_CD.Commission_Table_cd__trn)

*** Internal Generated Transformer Code follows:
0001: //
0002: // Generated file to implement the V0S3_DM_D_COMM_TBL_CD_Commission_Table_cd__trn transform operator.
0003: //
0004: 
0005: // define our input/output link names
0006: inputname 0 Commission_Table_cd__lnk;
0007: outputname 0 Commission_Table_cd__out;
0008: outputname 1 Table_Rows_out;
0009: 
0010: global {
0011: 	// Job parameter declaration
0012: 	string $DMSQLLogon;
0013: 	string ProcessID;
0014: 	string Category;
0015: 	string DSJobStartTimestamp;
0016: }
0017: 
0018: initialize {
0019: 	// define our row rejected variable
0020: 	int8 RowRejected0;
0021: 
0022: 	// define our null set variable
0023: 	int8 NullSetVar0;
0024: 
0025: 	// declare our intermediate variables for this section
0026: 	string InterVar0_0;
0027: 	string InterVar0_1;
0028: 
0029: 	// initialise constant values which require conversion
0030: 	InterVar0_0 = "CURR";
0031: 	InterVar0_1 = "COMMISSION_TABLE_CD";
0032: }
0033: 
0034: mainloop {
0035: 	// initialise our row rejected variable
0036: 	RowRejected0 = 1;
0037: 
0038: 	// evaluate columns (no constraints) for link: Commission_Table_cd__out
0039: 	Commission_Table_cd__out.COMM_TBL_CD = upper_case(Commission_Table_cd__lnk.COMM_TBL_CD);
0040: 	Commission_Table_cd__out.CRETD_OPER_ID = $DMSQLLogon;
0041: 	Commission_Table_cd__out.CRETD_DT = timestamp_from_string(DSJobStartTimestamp);
0042: 	Commission_Table_cd__out.RCD_STAT_CD = InterVar0_0;
0043: 	Commission_Table_cd__out.LAST_OPER_ID = $DMSQLLogon;
0044: 	Commission_Table_cd__out.LAST_UPD_DT = timestamp_from_string(DSJobStartTimestamp);
0045: 	Commission_Table_cd__out.COMM_TY_DESC = upper_case(Commission_Table_cd__lnk.COMM_TY_DESC);
0046: 	writerecord 0;
0047: 	RowRejected0 = 0;
0048: 	// evaluate columns (no constraints) for link: Table_Rows_out
0049: 	Table_Rows_out.Processid = ProcessID;
0050: 	Table_Rows_out.Category = Category;
0051: 	Table_Rows_out.TableName = InterVar0_1;
0052: 	Table_Rows_out.RowValue = Commission_Table_cd__lnk.COMM_TBL_CD;
0053: 	writerecord 1;
0054: 	RowRejected0 = 0;
0055: }
0056: 
0057: finish {
0058: }
0059: 
*** End of Internal Generated Transformer Code
How do I use this environmental variable in the transformer?
Thanks in advance,
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

In order to get the value of an environment variable, use GetEnvironment(%envvar%) which is present under functions->Utility.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
DS_MJ
Participant
Posts: 157
Joined: Wed Feb 02, 2005 10:00 am

Post by DS_MJ »

DSguru2B wrote:In order to get the value of an environment variable, use GetEnvironment(%envvar%) which is present under functions->Utility.
Thank you DSguru2B.
Thanks in advance,
Post Reply