trim

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
satya99
Participant
Posts: 104
Joined: Thu Nov 30, 2006 1:22 pm

trim

Post by satya99 »

I AM GETTING DATA FROM MAINFRAME AND WRITING DATA TO SEQUENTIAL FILE.

WHEN I AM WRITING DATA TO SEQ FILE I AM GETTING SOME SPACES AT THE END.

SO I USED A TRIMFA(TRIMB(FIELD)) BUT STILL I HAVE THE SAME PROB.

I TRIED ALL OPTIONS WITH TRIM.

EXAMPLE.

213107850

ANY IDEAS.

THANKS IN ADVANCE.
satya
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Trim by setting the type as varchar.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
satya99
Participant
Posts: 104
Joined: Thu Nov 30, 2006 1:22 pm

Re: trim

Post by satya99 »

satya99 wrote:I AM GETTING DATA FROM MAINFRAME AND WRITING DATA TO SEQUENTIAL FILE.

WHEN I AM WRITING DATA TO SEQ FILE I AM GETTING SOME SPACES AT THE END.

SO I USED A TRIMFA(TRIMB(FIELD)) BUT STILL I HAVE THE SAME PROB.

I TRIED ALL OPTIONS WITH TRIM.

EXAMPLE.

213107850

ANY IDEAS.

THANKS IN ADVANCE.
SQL TYPE IS VARCHAR
satya
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

What is your source datatype? Specify both source and target as varchar (not char). Also try with just TRIM(FIELD)
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
satya99
Participant
Posts: 104
Joined: Thu Nov 30, 2006 1:22 pm

Re: trim

Post by satya99 »

satya99 wrote:I AM GETTING DATA FROM MAINFRAME AND WRITING DATA TO SEQUENTIAL FILE.

WHEN I AM WRITING DATA TO SEQ FILE I AM GETTING SOME SPACES AT THE END.

SO I USED A TRIMFA(TRIMB(FIELD)) BUT STILL I HAVE THE SAME PROB.

I TRIED ALL OPTIONS WITH TRIM.

EXAMPLE.

213107850

ANY IDEAS.

THANKS IN ADVANCE.
THERE ARE BOTH VARCHAR TRIED BY USING TRIM(FIELD).

NOT RESOLVED
satya
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

vi the file, press the $ key by holding down the Esc key, does the currsor end up on the last character or after the last character? You might be seeing spaces in the view data but thats just the display definition. There might not be a space.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
satya99
Participant
Posts: 104
Joined: Thu Nov 30, 2006 1:22 pm

Re: trim

Post by satya99 »

satya99 wrote:I AM GETTING DATA FROM MAINFRAME AND WRITING DATA TO SEQUENTIAL FILE.

WHEN I AM WRITING DATA TO SEQ FILE I AM GETTING SOME SPACES AT THE END.

SO I USED A TRIMFA(TRIMB(FIELD)) BUT STILL I HAVE THE SAME PROB.

I TRIED ALL OPTIONS WITH TRIM.

EXAMPLE.

213107850

ANY IDEAS.

THANKS IN ADVANCE.

THERE ARE SPACES COMING UP IN THE FIELD, IF I VIEW IN VI EDITOR THE CURSOR ENDS WHERE IT IS SUPPOSED TO BE.

WHEN I AM USING THE PROPERTY AS FIXED I AM HAVING THIS PROBLEM, HAD IT BEEN UNCHECKED ITS FINE.
satya
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

First of all, its bad ettiquetes to use all caps as its a sign of shouting.
Second of all, you should have mentioned this before that its a fixed width file. A fixed width file will be loaded with spaces to honor the length of the field. But that is if the type is set as 'char'.
Keep the spaces as it wont harm you. Trim it before loading to a table and you will be fine. Trim it before loading to a delimited flat file and you will be, yet again, fine.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
satya99
Participant
Posts: 104
Joined: Thu Nov 30, 2006 1:22 pm

Re: trim

Post by satya99 »

satya99 wrote:I AM GETTING DATA FROM MAINFRAME AND WRITING DATA TO SEQUENTIAL FILE.

WHEN I AM WRITING DATA TO SEQ FILE I AM GETTING SOME SPACES AT THE END.

SO I USED A TRIMFA(TRIMB(FIELD)) BUT STILL I HAVE THE SAME PROB.

I TRIED ALL OPTIONS WITH TRIM.

EXAMPLE.

213107850

ANY IDEAS.

THANKS IN ADVANCE.
Only for readability i have been using caps, I am not aware of this issue, new point i noted today.

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

Post by ray.wurlod »

Maybe a COBOL programmer! :wink:

The data you get from the mainframe is fixed width. That is the basic source of the pad characters (spaces). Look at the imported table definition - choose the Layout tab and select COBOL to see what I mean.

You do need to trim the strings, even though your declared data type is VarChar. "FRED FLINTSTONE . . . " is a valid VarChar even with the trailing space characters.
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