RIGHT/LEFT Justify

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
cosec
Premium Member
Premium Member
Posts: 230
Joined: Tue May 08, 2007 8:10 pm

RIGHT/LEFT Justify

Post by cosec »

When I view the records in the database through datastage it seems all the fields are left justified...how could I left Justify non numeric fields and Right justify numeric fields....I used the FMT Function but I dont think I am doing it right ... Pls advice
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Do you mean with "view data" in the designer or from somewhere else? The FMT function will work from the command line, but has nothing to do with "view data", where the datatypes and widths play a role in how things are displayed.
cosec
Premium Member
Premium Member
Posts: 230
Joined: Tue May 08, 2007 8:10 pm

Post by cosec »

Yes using the View Data both in the designer and the DB2 Client it shows as left justified.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

You threw me off with FMT reference, since that isn't applicable to "view data". You cannot right justify in that window, the only formatting DS really uses is the field width to presize the display width.
cosec
Premium Member
Premium Member
Posts: 230
Joined: Tue May 08, 2007 8:10 pm

Post by cosec »

I want the fields to be stored in the database as right justified...how do i accomplish that throuhg datastage
ArndW wrote:You threw me off with FMT reference, since that isn't applicable to "view data". You cannot right justify in that window, the only formatting DS really uses is the field width to presize the display w ...
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

cosec wrote:I want the fields to be stored in the database as right justified...how do i accomplish that throuhg datastage
You don't have to do anything special in Datastage. Check in your database using an appropriate tool to confirm.
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Think in terms of, "How would I do this outside DataStage?" Is it even possible. I say have a chat with your friendly neighbourhood DBA.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

cosec wrote:I want the fields to be stored in the database as right justified...
Um... why? :?

One generally doesn't worry about 'justification' inside a database. Perhaps if we were talking about a flat file with specific requirements on string fields, but since we're not...

You need to do this or just want to do this? What field datatypes are we talking about here? Unless for some odd reason you've been given explicit requirements to right justify string fields, doing so could just screw up any process using that data that's not expecting it to be stored like that.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Numbers cannot be stored justified. If you want a string to be stored "right justified" then you need to explicitly pad the string with spaces on the left. Note that some datatypes such as VarChar2 will strip those leading spaces out of the string! Justification is never a data value issue, just a display method.

Craig - oops, I didn't notice your post until after I had submitted mine. Sorry for duplicating the content.
Post Reply