substring + Len

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

substring + Len

Post by DS_MJ »

Server:
Substrings(Trim(DSLink49.COL_NM),len(Trim(DSLink49.COL_NM)) -2,3)
Is the following code a correct translattion of the above code in PX?

PX:
Len(trim(DSLink340.COL_NM[-2,3]))


In the transformer it does not show red. But when I go to compile the job it doesnt compile. It points to the transformer and when I set more I see the following:

Output from transformer compilation follows:

Code: Select all

##I TFCN 000001 17:56:39(000) <main_program> 
Ascential DataStage(tm) Enterprise Edition 7.5.2
Copyright (c) 2004, 1997-2004 Ascential Software Corporation.
All Rights Reserved


##I TUTL 000031 17:56:39(001) <main_program> The open files limit is 2000; raising to 2147483647.
##I TOSH 000002 17:56:39(002) <main_program> orchgeneral: loaded
##I TOSH 000002 17:56:39(003) <main_program> orchsort: loaded
##I TOSH 000002 17:56:39(004) <main_program> orchstats: loaded
##I TFSC 000001 17:56:39(007) <main_program> APT configuration file: /ibmdscode/Configurations/CGI/apt_config_max
##W TCOS 000049 17:56:39(008) <main_program> Parameter specified but not used in flow: DSPXWorkingDir
##W TFCP 000000 17:56:39(010) <transform> Error when checking composite operator: The number of reject datasets "0" is less than the number of input datasets "1".
##E TFCP 000005 17:56:39(011) <transform> Error when checking composite operator: The argument value in function substring_1, [line 59, character 88], is less than the lower limit of 0.
##E TFSR 000019 17:56:39(012) <main_program> Could not check all operators because of previous error(s)
##E TCOS 000029 17:56:39(013) <main_program> Creation of a step finished with status = FAILED. (CGI_DW_InsertCignaSlsComCd_Prev.Tgt_Producer_Agency_trn)

*** Internal Generated Transformer Code follows:
0001: //
0002: // Generated file to implement the V0S205_repos_Tgt_Producer_Agency_trn transform operator.
0003: //
0004: 
0005: // define our input/output link names
0006: inputname 0 DSLink348;
0007: outputname 0 Producer_Agency_rows_in;
0008: outputname 1 Table_Rows_Read_out;
0009: outputname 2 Table_Rows_Loaded_out;
0010: 
0011: global {
0012: 	// Job parameter declaration
0013: 	string Load_SchemaName;
0014: 	string EXTRACTSTARTDT;
0015: 	string EXTRACTENDDT;
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_2;
0028: 	string InterVar0_3;
0029: 	string InterVar0_4;
0030: 	string InterVar0_5;
0031: 	string InterVar0_6;
0032: 
0033: 	// initialise constant values which require conversion
0034: 	InterVar0_0 = "590";
0035: 	InterVar0_2 = ".PRODUCER_AGENCY";
0036: 	InterVar0_3 = "Records read from ";
0037: 	InterVar0_4 = "DWSQL";
0038: 	InterVar0_5 = "Records loaded into ";
0039: 	InterVar0_6 = "DWDB2";
0040: }
0041: 
0042: mainloop {
0043: 	// initialise our row rejected variable
0044: 	RowRejected0 = 1;
0045: 
0046: 	// declare our intermediate variables for this section
0047: 	string InterVar0_1;
0048: 
0049: 	// evaluate columns (no constraints) for link: Producer_Agency_rows_in
0050: 	Producer_Agency_rows_in.PRODCR_STAT_CD = set_null();
0051: 	Producer_Agency_rows_in.ORG_DT = set_null();
0052: 	Producer_Agency_rows_in.ORG_TY_CD = set_null();
0053: 	Producer_Agency_rows_in.TERMN_DT = set_null();
0054: 	Producer_Agency_rows_in.PRIM_TAX_ID_NUM = set_null();
0055: 	Producer_Agency_rows_in.SRC_SYS_CD = set_null();
0056: 	if (null(DSLink348.PRODCR_FIRM_CD)) {
0057: 		Producer_Agency_rows_in.SLS_OFFC_CD = InterVar0_0;
0058: 	} else {
0059: 		InterVar0_1 = string_length(trimc_string(substring_1(DSLink348.PRODCR_FIRM_CD , -2 , 3)));
0060: 		Producer_Agency_rows_in.SLS_OFFC_CD = InterVar0_1;
0061: 	}
0062: 	//;
0063: 	Producer_Agency_rows_in.NATL_PRODCR_NUM_TXT = set_null();
0064: 	Producer_Agency_rows_in.SLS_AGNT_ID = -1;
0065: 	Producer_Agency_rows_in.AGNCY_CNTCT_TEL_NUM = set_null();
0066: 	Producer_Agency_rows_in.URL_TXT = set_null();
0067: 	Producer_Agency_rows_in.CMMNT_TXT = set_null();
0068: 	writerecord 0;
0069: 	RowRejected0 = 0;
0070: 	// evaluate columns (no constraints) for link: Table_Rows_Read_out
0071: 	Table_Rows_Read_out.TableName = (Load_SchemaName + InterVar0_2);
0072: 	Table_Rows_Read_out.TableNumber = 1;
0073: 	Table_Rows_Read_out.Description = (InterVar0_3 + get_environment(InterVar0_4));
0074: 	Table_Rows_Read_out.Database = get_environment(InterVar0_4);
0075: 	Table_Rows_Read_out.DeltaStart = EXTRACTSTARTDT;
0076: 	Table_Rows_Read_out.DeltaEnd = EXTRACTENDDT;
0077: 	Table_Rows_Read_out.RowValue = DSLink348.CIGNA_PRODCR_FIRM_CD;
0078: 	writerecord 1;
0079: 	RowRejected0 = 0;
0080: 	// evaluate columns (no constraints) for link: Table_Rows_Loaded_out
0081: 	Table_Rows_Loaded_out.TableName = (Load_SchemaName + InterVar0_2);
0082: 	Table_Rows_Loaded_out.TableNumber = 2;
0083: 	Table_Rows_Loaded_out.Description = (InterVar0_5 + get_environment(InterVar0_6));
0084: 	Table_Rows_Loaded_out.Database = get_environment(InterVar0_6);
0085: 	Table_Rows_Loaded_out.DeltaStart = EXTRACTSTARTDT;
0086: 	Table_Rows_Loaded_out.DeltaEnd = EXTRACTENDDT;
0087: 	Table_Rows_Loaded_out.RowValue = DSLink348.CIGNA_PRODCR_FIRM_CD;
0088: 	writerecord 2;
0089: 	RowRejected0 = 0;
0090: }
0091: 
0092: finish {
0093: }
0094: 
*** End of Internal Generated Transformer Code

Please help explain the error.
Thanks in advance,
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

In a PX transform stage you would do:

Code: Select all

Trim(DSLink49.COL_NM)[Len(Trim(DSLink49.COL_NM))-2,3]
rsripathy
Participant
Posts: 21
Joined: Wed Sep 19, 2007 8:46 am

here is the way to give in transformer

Post by rsripathy »

Trim(DSLink49.COL_NM[Len(Trim(DSLink49.COL_NM))-2,3])
DS_MJ
Participant
Posts: 157
Joined: Wed Feb 02, 2005 10:00 am

Re: here is the way to give in transformer

Post by DS_MJ »

Thanks ArndW and rsripathy, appreciate it. Have a great day.
Thanks in advance,
Post Reply