Leading Zeros

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
edison
Participant
Posts: 19
Joined: Mon Sep 17, 2007 4:28 pm

Leading Zeros

Post by edison »

Input is a txt file and output table.

Input

0001
0002
0003
0001,0002
0005
0003,0004

Need out put like

01
02
03
01,02
05
03,04
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Investigate the FMT() function if we are talking about string fields here. What is the datatype of these columns in the target table?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The FMTS() function will be of even more use.

Code: Select all

Convert(@VM,",",Fmts(Convert(",",@VM,InLink,TheString),"2R"))
The inner Convert() changes commas to value marks.
The Fmts() function applies the format specification to each value in the multi-valued field.
The outer Convert() changes the values marks back to commas.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

FMTS... plural? Not familiar with that one or at least it's not ringing a bell, need to look it up later, it would seem. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Plural = multi-valued, yes.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ah, I see...
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply