Upper Case Conversion

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
dhiraj
Participant
Posts: 68
Joined: Sat Dec 06, 2003 7:03 am

Upper Case Conversion

Post by dhiraj »

Hi,

Is it possible to convert the entire input record read from a sequential file in to upper case. i am aware of the UpCase function, but if i use this i'll have to apply this funtion for each and every field. isn't there any generic way in which i can apply this to athe entire incoming record at once.

also i have some 100 odd jobs for which i have to convert all the inputs in to upper case . is there any other easier way of doing this.
mass relace or something.

thanx

dhiraj
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
You can convert the entire row in 2 ways:
1. run a batch script to do it, or a basic routine that reads the entire file and converts it (this might have issues if you use NLS).

2. define the max length of your row and define a seq file stage to have 1 column of varchar(<max length>) and simply use the upper case function on the entire row.

If you choose the 2nd option you need to write it to a seq file and continue from there, or use a filed(...) function to brake down the string to the actual columns in a transformer.

IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

DataStage is perfectly at home with the idea of case under NLS. Definition of what is upper case and what is lower case and how to get from one to the other and back again are all part of the CTYPE category of the locale. For example, accented lower case letters lose their accents when converted to upper case in France, but keep their accents in Canada.

So a simple before-stage subroutine might go something like:

Code: Select all

OpenSeq filepath1 To InFileVar
Then
   OpenSeq filepath2 To OutFileVar
   Then
      WeofSeq OutFileVar  ; * overwrite if exists
   End
   Else
      If Status() Then GoTo CloseDown
   End
   Loop
   While ReadSeq Line From InFileVar
      WriteSeq Upcase(Line) To OutFileVar Else NULL
   Repeat
CloseDown:
   CloseSeq OutFileVar
   CloseSeq InFileVar
End
Error and "locked file" processing has been omitted for clarity. Your job would then process filepath2 rather than filepath1.
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