fixed with file as targets

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
sonia jacob
Participant
Posts: 122
Joined: Mon Jul 05, 2004 1:33 pm
Location: MA

fixed with file as targets

Post by sonia jacob »

my requirement is to generate a fixed width flat file with around 200 columns. But my source do not give me all that I require for my target, hence I am required to set a default value (space for character and 0 for numeric). This I can deal with.

My other requirement is that I need to pad non null numeric value with zeros (prefix the value with adequate no. of zeros).

eg for a numeric column of size (7,2) if my value from source is 10.1 my target should have 00010.10

For this i tried using the "Null String" and "Padding" option of the column definition of a sequential file. but instead of getting a value prefixed by zeros i get it prefixed by spaces. :cry:

So i ended up using routines to manually do that.

Please help. Thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Use the Fmt() function for padding. Look it up in on-line help or in the BASIC manual. Its first argument is the value to be formatted, its second argument is a specification about how to format that value, and includes
[ width ] [ background ] justification [ conversion ] [ mask ]

In your example, you're looking for a background character of "0" and two decimal places.

Code: Select all

Fmt(TheValue, "8'0'R2")
(The width must include character positions for decimal place, thousands delimiters, currency symbols, sign, and so on, if used.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sonia jacob
Participant
Posts: 122
Joined: Mon Jul 05, 2004 1:33 pm
Location: MA

Post by sonia jacob »

Hi Ray,

My current design has a container and within which I use the Fmt funtion to do the padding. This container is used in all the jobs of my project. But after seeing the Datastage option of padding string and null string I thought my jobs could live without the Container.

Thanks
Sonia
Post Reply