Reverse a string

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
josy
Participant
Posts: 14
Joined: Wed Oct 29, 2003 5:44 am

Reverse a string

Post by josy »

Hi all,

Is there any function or routine which will reverse a string?

For example abcdef has to become fedcba.

Regards

Josy
jseclen
Participant
Posts: 133
Joined: Wed Mar 05, 2003 4:19 pm
Location: Lima - Peru. Sudamerica
Contact:

Re: Reverse a string

Post by jseclen »

Hi Josy,

I think there isn't a function in DataStage for that , but i send a code that reverse any string ...

Cad = ''
For i=1 to Len(x)
Cad = x[i,1] : Cad
Next
Ans = Cad

I hope this help.

:lol:
Saludos,

Miguel Seclén
Lima - Peru
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Creating this function is one of the "fun" exercises in the Programming with DataStage BASIC class. :D
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply