C++ routine error

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

prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

C++ routine error

Post by prasson_ibm »

hi all,
We are trying to make C++ routine,we have developed a code

Code: Select all

]#include<stdio.h> 
#include<stdlib.h> 
#include<string.h> 
#include<conio.h> 

char * substr(char a[] ,int s,int l) 
{ 
int i; 
char * b; 
b=NULL; 
for(i=s;i<=s+l-1;i++) 
{ 
b[i-s]=a[i-1]; 
} 
b[i-1]='\0'; 
//printf("%s",b); 

return b; 
} 

int Calc_call_code(int CALL_TYPE_CODE,int CALL_SERVICE_TYPE_CODE, char CALL_TERMINATING_NBR[],char TER_OPR_CD[],char CALL_TYPE[],char ORG_TER_OPR_NAME[], char CALL_ROAM_NET_OPERATOR_CODE[]) 
{ 
int CALL_CODE; 

switch(CALL_TYPE_CODE) 
{ 
case 1: { CALL_CODE=55;break;} 
case 2: { CALL_CODE=56;break;} 
case 3: { 
switch(CALL_SERVICE_TYPE_CODE) 
{ 
case -722: {CALL_CODE=72;break;} 
case -679: {CALL_CODE=86;break;} 
case -99 : {CALL_CODE=52;break;} 
};break; 
} 
case 4:{switch(CALL_SERVICE_TYPE_CODE) 
{ 
case -732: 
case -728: 

case -726: 
case -724: {CALL_CODE=54;break;} 
case -730:{CALL_CODE=53;break;} 
}; break; 
} 
case 5: { {CALL_CODE=51;} 
break; 
} 
case 6: {if(CALL_TERMINATING_NBR != "-99" && strcmp(substr(CALL_TERMINATING_NBR,1,5),"56465") == 0) { 

CALL_CODE=35;} 
else CALL_CODE=39; 
break;} 

default: CALL_CODE=1000; 
} 
return CALL_CODE; 
} 
This code is working fine for case :1,2,3,4,5
but in the case of 6,30 my job get aborts :(
I am not able to find what exactly is the issue,i think this is due to some library,here i thnink Strcmp is not working
Please help me to resolve this problem.
Last edited by prasson_ibm on Sun Jul 12, 2009 12:41 am, edited 1 time in total.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Please post the complete error message that you get at runtime.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Your call_terminating_nbr in 6 needs strcmp.

Please enclose the code in 'code' tag so others can see better.

Also you may reduce the burden by removing all codes after 6 and check whether 1-6 works fine.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Your call_terminating_nbr in 6 needs strcmp.

Please enclose the code in 'code' tag so others can see better.

Also you may reduce the burden by removing all codes after 6 and check whether 1-6 works fine.
meet_deb85
Premium Member
Premium Member
Posts: 132
Joined: Tue Sep 04, 2007 11:38 am
Location: NOIDA

Post by meet_deb85 »

ArndW wrote:Please post the complete error message that you get at runtime.
when i run a job it dont give any error messabe but with fatal it gets aborts..... :(
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Test the code as a stand-alone before calling from datastage.
meet_deb85
Premium Member
Premium Member
Posts: 132
Joined: Tue Sep 04, 2007 11:38 am
Location: NOIDA

Post by meet_deb85 »

Sainath.Srinivasan wrote:Test the code as a stand-alone before calling from datastage.
When i am running the entire code with main on C++ compiler,its running fine and giving proper output.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

meet_deb85 wrote:
ArndW wrote:Please post the complete error message that you get at runtime.
when i run a job it dont give any error messabe but with fatal it gets aborts..... :(
Please just post the contents of the fatal message in the log, otherwise everyone here would just be guessing as to what your problem might be.
meet_deb85
Premium Member
Premium Member
Posts: 132
Joined: Tue Sep 04, 2007 11:38 am
Location: NOIDA

Post by meet_deb85 »

ArndW wrote:
meet_deb85 wrote:
ArndW wrote:Please post the complete error message that you get at runtime.
when i run a job it dont give any error messabe but with fatal it gets aborts..... :(
Please just post the contents of the fatal message in the log, otherwise everyone here would just be guessing as to what your problem might be.
error message in log is

APT_CombinedOperatorController(2),0: Operator terminated abnormally: received signal SIGSEGV
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Make the code write incoming values into a file so you can cross-check the failed values.
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

Sainath.Srinivasan wrote:Make the code write incoming values into a file so you can cross-check the failed values. ...
same error i m getting....... :(
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Provide some sample values for which the code fails.
Last edited by Sainath.Srinivasan on Fri Jul 10, 2009 2:35 pm, edited 1 time in total.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Edit the original post and fix your code tags. Your closing code tag is incomplete.
Mamu Kim
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

kduke wrote:Edit the original post and fix your code tags. Your closing code tag is incomplete. ...
I have made the code small........but still the problem is same......it is working well when i run this same code in turbo c++ compiler but when i call in routine its gives error...i think it is not able to call the other first function in the second function in datastage......well i need your input in this...
Last edited by prasson_ibm on Sun Jul 12, 2009 12:44 am, edited 1 time in total.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Is this still true? And is the error exactly the same? If not, post it.
This code is working fine for case: 1,2,3,4,5 but in the case of 6,30 my job get aborts
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply