Unable to execute function.

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
sylvan_rydes
Participant
Posts: 47
Joined: Wed Apr 12, 2006 12:13 pm

Unable to execute function.

Post by sylvan_rydes »

Hi All,

This is my first post. I am new to DS. I have the following function.

Iconv(Trim(UpCase(Input.Link)),"MY")

Now it is good when input is just character. But it doesn't work when I have any alpha character in there.

Also anyone can suggest any idea to convert the link character by character.

Thanks.
Sylvan
sylvan rydes
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Welcome to DSXchange, Sylvan.
Could you tell us what the data is that comes in and what you want output? The conversion looks a bit too complicated.
sylvan_rydes
Participant
Posts: 47
Joined: Wed Apr 12, 2006 12:13 pm

Post by sylvan_rydes »

Hi Arnd,

Thank you. Well as I have said the function already. The link value may look like V@O.45. Now I need to convert it character by character to ASCII. So it should look like 866470465253. Well I am trying otherwise look for some other code generation.

It would be great if you caould write the function.
Sylvan
sylvan rydes
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

It is not clear to me from what format to what format are you trying to convert. But the eg that you gave. That tells me that your changing from ascii to its code value.
User the seq() function. That will get you what you want.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
sylvan_rydes
Participant
Posts: 47
Joined: Wed Apr 12, 2006 12:13 pm

Post by sylvan_rydes »

Thanks for your reply. You are very true. We have email address and we are generating equivalent ASCII value. Well your suggestion gives me value for first character. Is there anyway I can do it without using a loop.

Sylvan
sylvan rydes
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

No, write a DS function to do the work on a passed string. Something like this should work:

Code: Select all

StrLen=LEN(Arg1)
Ans = ""
For i=1 to StrLen
  Ans := SEQ(Arg1[i,1])
Next i
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Write a routine
I played with it , heres what i got

Code: Select all

      x = ''
      LnX = 0
      Val=''
      Curr = ''
      num = 0

      x = trimB(Arg1)

      LnX = Len(x)

      For n = 1 To LnX

         Curr = x[n,1]
         Val := Seq(Curr)

      Next n

      Ans = Val
This should work
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Ken's solution is much better, pretty much the same, sorry Ken, failed to see your reply
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Style points count :wink: I have an unfair advantage having programmed in DS BASIC since 1988. :shock:
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
sylvan_rydes
Participant
Posts: 47
Joined: Wed Apr 12, 2006 12:13 pm

Post by sylvan_rydes »

That was awesome. Thank all you people. I din know it is so good here.

Thanks again,
Sylvan
sylvan rydes
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

It sure does. :P
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply