First Character as uppercase character

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
RAJEEV KATTA
Participant
Posts: 103
Joined: Wed Jul 06, 2005 12:29 am

First Character as uppercase character

Post by RAJEEV KATTA »

Which function in transformer do I need to use to find whether the first character of a string is upper case or not.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If

Use substring or Left() to isolate the first character.
Test this against itself with the UpCase() function applied, or against an upper case alphabet using the Index() function.
Use If to generate an int8 result.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Re: First Character as uppercase character

Post by JoshGeorge »

Depends on your exact requirement.

Code: Select all

 If (Left(InputLink.InputColumn,1) > CHAR(64) and Left(InputLink.InputColumn,1) < CHAR(91)) then 'Y' else 'N'

Ex: "1test" will give you 'N'
Ex: "test" will give you 'N'
Ex: "Test" will give you 'Y'
or

Code: Select all

If (Left(InputLink.InputColumn,1) = UpCase(Left(InputLink.InputColumn,1)))  Then 'Y' else 'N'

Ex: "1test" will give you 'Y'
Ex: "test" will give you 'N'
Ex: "Test" will give you 'Y'
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Performance Tip
Putting the Left() function result into a stage variable would mean that you execute it once per row rather than twice per row. For squillions of rows this can make a noticeable difference.
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