Routine Function
Moderators: chulett, rschirm, roy
Routine Function
Hi All ,
I have the below requirement .Please help me to write routinee function ?
Input: string (varchar) -> any character string
Output: int -> the position of first non-numeric character of the input string. If all are numbers return -1.
E.g.
Input Output
ADB234 1
123ABC 4
12 456 3
1224-52 5
1234 -1
Regards
Ora
I have the below requirement .Please help me to write routinee function ?
Input: string (varchar) -> any character string
Output: int -> the position of first non-numeric character of the input string. If all are numbers return -1.
E.g.
Input Output
ADB234 1
123ABC 4
12 456 3
1224-52 5
1234 -1
Regards
Ora
Re: Routinee Function
Hi All
I have developed server routinee for this logic .But I ca n't call server routinee in transformer stage.
Can you please help me to write parallel routinee using above server routinee?
I have developed server routinee for this logic .But I ca n't call server routinee in transformer stage.
Code: Select all
ConvertString=CONVERT(' ABCDEFGHIJKLMNOPQRSTUVWXYZ-!@#$%^&*()_+=<>?|`/\:.,;"','####################################################',Arg1)
StringPosition=INDEX(ConvertString,'#',1)
if num(Arg1)=1 then
Ans=-1
end
Else
Ans=StringPosition
end
Can you please help me to write parallel routinee using above server routinee?
-
- Participant
- Posts: 597
- Joined: Fri Apr 29, 2005 6:19 am
- Location: Singapore
-
- Participant
- Posts: 597
- Joined: Fri Apr 29, 2005 6:19 am
- Location: Singapore
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
It appears to me that you lack C++ programming skills and want someone else to create the routine. You have implemented the logic in a Transformer stage, so that part is under control. Why not inspect the C++ source code that is generated when the Transformer stage is "compiled"? You will find this in the RT_SCnnn sub-directory in the project, where nnn is the job number from DS_JOBS table.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Hi All
I have developed parallel routine to get the position of first non-numeric character of the input string.Unfortunatley I don't have compiler previllages and can any one please execute the progarm and tell me the result if possible ?
Regards
I have developed parallel routine to get the position of first non-numeric character of the input string.Unfortunatley I don't have compiler previllages and can any one please execute the progarm and tell me the result if possible ?
Regards
Code: Select all
/******************************************************************************
* FirstNonNumPos
*
* Finds the first character in a list of characters
* e.g. [b]FirstNonNumPos( "1234abcd" ) returns 5[/b]*
******************************************************************************/
#include <cstdlib>
#include <iostream>
using namespace std;
int findchar(char *str)
{
int i=0;
while(1)
{
if((str[i]>=48)&&(str[i]<=57))
{
++i;
continue;
}
else
break;
}
return (i+1);
}